{
  "openapi": "3.0.1",
  "info": {
    "title": "HTML to PDF Converter: Invoices from Templates, Merge & URLs",
    "description": "Turn an HTML template and a list of records into a PDF each, or HTML and web page URLs into PDFs, in a real Chrome: invoices with line items, A4 or Letter, margins, page numbers, headers and footers, and all of them merged into one PDF. A link to each; failures are free.",
    "version": "0.1",
    "x-build-id": "BCMlvhqtuVLVr56U5"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/pikoulas~html-to-pdf/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-pikoulas-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/pikoulas~html-to-pdf/runs": {
      "post": {
        "operationId": "runs-sync-pikoulas-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/pikoulas~html-to-pdf/run-sync": {
      "post": {
        "operationId": "run-sync-pikoulas-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": {
          "html": {
            "title": "HTML",
            "type": "string",
            "description": "An HTML document to print: an invoice, a report, a ticket. Images, fonts and styles it links to load from public addresses."
          },
          "urls": {
            "title": "Page URLs",
            "type": "array",
            "description": "Web pages to print, as Chrome prints them.",
            "items": {
              "type": "string"
            }
          },
          "documents": {
            "title": "More HTML documents",
            "type": "array",
            "description": "Many documents in one run, mostly through the API: each an HTML string, or {\"html\": \"...\", \"name\": \"invoice-1002\"} to name its file."
          },
          "template": {
            "title": "Template",
            "type": "string",
            "description": "An HTML document with {{fields}} filled from each record of Data, one PDF per record: invoices, certificates, tickets, letters. {{field}} is escaped, {{{field}}} put in as is, {{customer.name}} reads into an object, {{#items}}...{{/items}} repeats for each item of a list (or shows if set), {{^items}}...{{/items}} shows if it's empty."
          },
          "data": {
            "title": "Data",
            "type": "array",
            "description": "The records the template is filled with, each an object such as {\"number\": 1002, \"customer\": {\"name\": \"Example Corp\"}, \"items\": [{\"name\": \"Design\", \"amount\": \"$1,200.00\"}]}. Without data, the template is printed once with its fields empty."
          },
          "fileName": {
            "title": "File name",
            "type": "string",
            "description": "Each PDF's name, filled from its record as the template is, such as invoice-{{number}}. Empty names a PDF by its title."
          },
          "merge": {
            "title": "Merge into one PDF",
            "type": "boolean",
            "description": "Also puts every PDF made into one, merged.pdf in the run's key-value store, in the order given: URLs, HTML, documents, then the template's records. Free.",
            "default": false
          },
          "paper": {
            "title": "Paper size",
            "enum": [
              "A4",
              "Letter",
              "Legal",
              "A3",
              "A5",
              "Tabloid"
            ],
            "type": "string",
            "description": "A size set in the document's own CSS (@page { size: ... }) wins.",
            "default": "A4"
          },
          "landscape": {
            "title": "Landscape",
            "type": "boolean",
            "description": "Wider than tall.",
            "default": false
          },
          "margin": {
            "title": "Margin",
            "type": "string",
            "description": "On all four sides, such as 10mm, 0.5in, 1cm, 40px or 0. Margins set in the document's CSS (@page { margin: ... }) win.",
            "default": "10mm"
          },
          "pageNumbers": {
            "title": "Page numbers",
            "type": "boolean",
            "description": "\"1 / 3\" at the foot of each page.",
            "default": false
          },
          "headerTemplate": {
            "title": "Header",
            "type": "string",
            "description": "HTML repeated at the top of each page, with its styles inline. Elements with the classes pageNumber, totalPages, date, title and url get those filled in."
          },
          "footerTemplate": {
            "title": "Footer",
            "type": "string",
            "description": "HTML repeated at the foot of each page, as the header; it replaces the page numbers."
          },
          "printBackground": {
            "title": "Backgrounds",
            "type": "boolean",
            "description": "Background colours and images printed, as on screen.",
            "default": true
          },
          "media": {
            "title": "Styles",
            "enum": [
              "print",
              "screen"
            ],
            "type": "string",
            "description": "Web pages often hide menus and colours in print; screen styles print what you see.",
            "default": "print"
          },
          "scale": {
            "title": "Scale",
            "type": "string",
            "description": "From 0.1 to 2: below 1 fits more on a page.",
            "default": "1"
          },
          "waitUntil": {
            "title": "Wait until",
            "enum": [
              "load",
              "domcontentloaded",
              "networkidle"
            ],
            "type": "string",
            "description": "When the document counts as ready to print.",
            "default": "load"
          },
          "delaySeconds": {
            "title": "Extra wait",
            "minimum": 0,
            "maximum": 30,
            "type": "integer",
            "description": "More time before printing, for charts drawn by scripts or late content.",
            "default": 0
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}