{
  "openapi": "3.0.1",
  "info": {
    "title": "HTML to PDF: Templates, Invoices & Arabic RTL",
    "description": "HTML to PDF converter for templates and Markdown. Merge JSON, CSV or dataset rows with Handlebars to make one PDF per row: invoices, certificates, reports. Page size, margins, header, footer, page numbers, Arabic RTL fonts. Public PDF links.",
    "version": "0.1",
    "x-build-id": "kAzBAwXxSErpsx5IJ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/maliksaid~html-to-pdf/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-maliksaid-html-to-pdf",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/maliksaid~html-to-pdf/runs": {
      "post": {
        "operationId": "runs-sync-maliksaid-html-to-pdf",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/maliksaid~html-to-pdf/run-sync": {
      "post": {
        "operationId": "run-sync-maliksaid-html-to-pdf",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "template": {
            "title": "Template (HTML or Markdown)",
            "type": "string",
            "description": "Your HTML or Markdown with Handlebars fields such as {{customer}}. Each data row fills the fields and makes one PDF. Loops ({{#each items}}), conditions ({{#if paid}}) and helpers (formatNumber, formatCurrency, formatDate, sum, multiply, json) work. Leave empty to use the sample invoice."
          },
          "templateType": {
            "title": "Template type",
            "enum": [
              "html",
              "markdown"
            ],
            "type": "string",
            "description": "HTML gives full control with your own CSS. Markdown is turned into a clean printable page with headings and tables.",
            "default": "html"
          },
          "templateUrl": {
            "title": "Template URL",
            "type": "string",
            "description": "Optional. Load the template from a public URL instead, for example a raw GitHub file. Used only when the Template field is empty. Local and private network addresses are refused."
          },
          "data": {
            "title": "Data rows (JSON)",
            "type": "array",
            "description": "A JSON list of objects. Each object fills the template once and makes one PDF. Nested lists such as invoice lines work with {{#each}}."
          },
          "csvData": {
            "title": "Data rows (CSV)",
            "type": "string",
            "description": "Paste CSV text with a header row. Each line makes one PDF. Comma or semicolon separators and quoted values work. Column names become the field names."
          },
          "datasetId": {
            "title": "Apify dataset ID",
            "type": "string",
            "description": "Use the items of an Apify dataset as data rows, for example the output of another Actor. Read page by page, so large datasets work."
          },
          "dataUrl": {
            "title": "Data URL (JSON or CSV)",
            "type": "string",
            "description": "A public URL that returns a JSON list or CSV text, up to 10 MB. Local and private network addresses are refused."
          },
          "fileName": {
            "title": "File name",
            "type": "string",
            "description": "Name for each PDF, with Handlebars fields, for example invoice-{{number}}. Letters other than a to z become dashes in the storage key. Default: document-{{_rowNumber}}."
          },
          "pageFormat": {
            "title": "Page size",
            "enum": [
              "A4",
              "A3",
              "A5",
              "Letter",
              "Legal",
              "Tabloid",
              "Ledger"
            ],
            "type": "string",
            "description": "Paper size of each PDF.",
            "default": "A4"
          },
          "landscape": {
            "title": "Landscape",
            "type": "boolean",
            "description": "Print the pages sideways.",
            "default": false
          },
          "zipAll": {
            "title": "Also save one ZIP of all PDFs",
            "type": "boolean",
            "description": "Also save one ZIP file with every generated PDF, free of charge. A ZIP part holds up to 1,000 PDFs or 1 GB; larger runs get several parts. Links are in the BUNDLES record of the key-value store.",
            "default": false
          },
          "mergeAll": {
            "title": "Also save one merged PDF",
            "type": "boolean",
            "description": "Also save one PDF with all generated PDFs in row order, for printing, free of charge. A part holds up to 100 MB of PDFs; larger runs get several parts. Links are in the BUNDLES record.",
            "default": false
          },
          "marginTop": {
            "title": "Top margin",
            "type": "string",
            "description": "A number with mm, cm, in or px, for example 15mm. Headers and footers print inside the top and bottom margins.",
            "default": "15mm"
          },
          "marginRight": {
            "title": "Right margin",
            "type": "string",
            "description": "A number with mm, cm, in or px, for example 15mm. Headers and footers print inside the top and bottom margins.",
            "default": "12mm"
          },
          "marginBottom": {
            "title": "Bottom margin",
            "type": "string",
            "description": "A number with mm, cm, in or px, for example 15mm. Headers and footers print inside the top and bottom margins.",
            "default": "15mm"
          },
          "marginLeft": {
            "title": "Left margin",
            "type": "string",
            "description": "A number with mm, cm, in or px, for example 15mm. Headers and footers print inside the top and bottom margins.",
            "default": "12mm"
          },
          "headerTemplate": {
            "title": "Header HTML",
            "type": "string",
            "description": "Optional HTML printed at the top of every page. Handlebars fields work. Chromium fills <span class=\"pageNumber\"></span>, <span class=\"totalPages\"></span>, <span class=\"date\"></span> and <span class=\"title\"></span>. Images must be data: URLs."
          },
          "footerTemplate": {
            "title": "Footer HTML",
            "type": "string",
            "description": "Optional HTML printed at the bottom of every page. Same rules as the header. When empty and Page numbers is on, the footer says Page 1 of 3 (in Arabic for right-to-left documents)."
          },
          "pageNumbers": {
            "title": "Page numbers",
            "type": "boolean",
            "description": "Add a Page X of Y footer when no footer HTML is given.",
            "default": true
          },
          "direction": {
            "title": "Text direction",
            "enum": [
              "auto",
              "ltr",
              "rtl"
            ],
            "type": "string",
            "description": "Auto keeps the dir attribute of your HTML. Without one, it picks right to left when most letters are Arabic or Hebrew.",
            "default": "auto"
          },
          "language": {
            "title": "Language code",
            "type": "string",
            "description": "Optional lang attribute for the page, for example ar, en or fa. Helps hyphenation and font choice."
          },
          "defaultFont": {
            "title": "Default font",
            "enum": [
              "noto-sans",
              "noto-naskh",
              "cairo",
              "amiri",
              "none"
            ],
            "type": "string",
            "description": "Font for text your CSS does not style. All five bundled fonts (Noto Sans, Noto Sans Arabic, Noto Naskh Arabic, Cairo, Amiri) can also be named in your own CSS.",
            "default": "noto-sans"
          },
          "printBackground": {
            "title": "Print backgrounds",
            "type": "boolean",
            "description": "Print background colours and images.",
            "default": true
          },
          "scale": {
            "title": "Scale",
            "minimum": 0.1,
            "maximum": 2,
            "type": "number",
            "description": "Zoom of the page content, from 0.1 to 2.",
            "default": 1
          },
          "preferCssPageSize": {
            "title": "Use CSS page size",
            "type": "boolean",
            "description": "Use the size from an @page rule in your CSS instead of Page size.",
            "default": false
          },
          "taggedPdf": {
            "title": "Tagged PDF (accessibility)",
            "type": "boolean",
            "description": "Add a structure tree for screen readers. Files get much larger: a 200-page table went from about 1 MB to 11 MB in tests.",
            "default": false
          },
          "allowedAssetHosts": {
            "title": "Allowed asset hosts",
            "type": "array",
            "description": "Hosts your template may load images, fonts, CSS or scripts from, for example cdn.jsdelivr.net or fonts.googleapis.com and fonts.gstatic.com. Subdomains are included. All other network requests are blocked, and private addresses are always refused.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "enableJavaScript": {
            "title": "Run JavaScript",
            "type": "boolean",
            "description": "Run scripts in the template, for example a chart library. Scripts cannot reach the network except the allowed hosts.",
            "default": true
          },
          "waitForSelector": {
            "title": "Wait for element",
            "type": "string",
            "description": "Print only after an element matching this CSS selector appears, for example #chart[data-ready]. Waits up to 20 s per row. A row whose element never appears fails with a reason and is not charged. Extra wait applies after it."
          },
          "waitMs": {
            "title": "Extra wait (ms)",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Wait this long after the page and fonts load, for example for chart animations. Up to 10,000 ms.",
            "default": 0
          },
          "maxPdfs": {
            "title": "Maximum PDFs",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many PDFs. The default keeps test runs short. Set 0 for no limit.",
            "default": 100
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}