{
  "openapi": "3.0.1",
  "info": {
    "title": "HTML to Image: Render HTML and CSS to PNG, JPEG or PDF",
    "description": "Render your own HTML and CSS to PNG, JPEG, WebP or PDF with Chromium. Templates with {{variables}}, batches of up to 500 items, Google Fonts, retina scale, transparent background, crop to element. For OG images, certificates and invoices in Make, n8n, Zapier.",
    "version": "0.1",
    "x-build-id": "NSQTPdqvrbllcA5Wh"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/forgeloop~html-to-image/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-forgeloop-html-to-image",
        "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/forgeloop~html-to-image/runs": {
      "post": {
        "operationId": "runs-sync-forgeloop-html-to-image",
        "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/forgeloop~html-to-image/run-sync": {
      "post": {
        "operationId": "run-sync-forgeloop-html-to-image",
        "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": "The HTML to render. A fragment like <div>...</div> or a full document. Placeholders: {{name}} inserts a variable HTML-escaped, {{{name}}} inserts it raw, {{user.name}} reads nested values. Max 2 MB. Ignored when a built-in template is selected."
          },
          "css": {
            "title": "CSS",
            "type": "string",
            "description": "Optional CSS, added in a <style> tag in the head. Placeholders work here too. Page margins are already 0."
          },
          "template": {
            "title": "Template",
            "enum": [
              "custom",
              "og-card",
              "certificate"
            ],
            "type": "string",
            "description": "Custom uses your HTML above. The built-in templates need only variables. og-card (1200 x 630): tag, title, subtitle, brand, url, background, color. certificate (1600 x 1131): kicker, title, presentedTo, name, description, date, dateLabel, issuer, issuerLabel, accent.",
            "default": "custom"
          },
          "variables": {
            "title": "Variables",
            "type": "object",
            "description": "Values for the {{placeholders}}, like {\"title\": \"Hello\"}. Used for a single render, and as defaults for every item below. Unknown placeholders become empty and are listed in missingVariables."
          },
          "items": {
            "title": "Items (batch)",
            "type": "array",
            "description": "Render many files from one template. Each item is an object of variables, like {\"label\": \"alice\", \"name\": \"Alice\"}, or {\"label\": \"alice\", \"variables\": {...}}. The label names the file. Each item is one charged file. Max 500 items per run, more are skipped."
          },
          "format": {
            "title": "Output format",
            "enum": [
              "png",
              "jpeg",
              "webp",
              "pdf"
            ],
            "type": "string",
            "description": "PNG keeps every pixel and supports transparency. JPEG and WebP give smaller files. PDF keeps text selectable.",
            "default": "png"
          },
          "width": {
            "title": "Width (px)",
            "minimum": 16,
            "maximum": 4096,
            "type": "integer",
            "description": "Viewport width in CSS pixels, 16 to 4096. Also the PDF page width for the custom paper size. Default 1200, or the size of the built-in template."
          },
          "height": {
            "title": "Height (px)",
            "minimum": 16,
            "maximum": 4096,
            "type": "integer",
            "description": "Viewport height in CSS pixels, 16 to 4096. Default 630, or the size of the built-in template."
          },
          "deviceScaleFactor": {
            "title": "Pixel density",
            "minimum": 1,
            "maximum": 3,
            "type": "integer",
            "description": "1 gives an image exactly width x height. 2 doubles both sides for sharp retina images, 3 triples them.",
            "default": 1
          },
          "quality": {
            "title": "Quality (JPEG and WebP)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "1 to 100. Higher means better quality and bigger files.",
            "default": 90
          },
          "transparentBackground": {
            "title": "Transparent background",
            "type": "boolean",
            "description": "PNG and WebP only. Areas without a background stay transparent, for logos, badges and overlays.",
            "default": false
          },
          "selector": {
            "title": "Crop to element (CSS selector)",
            "type": "string",
            "description": "Capture only the first element that matches, for example .card or #chart. Empty captures the viewport. Not used for PDF."
          },
          "fullPage": {
            "title": "Full page",
            "type": "boolean",
            "description": "Capture the whole content height instead of the viewport, up to 10,000 px. For PDF with the custom paper size the page grows to the content height.",
            "default": false
          },
          "googleFonts": {
            "title": "Google Fonts",
            "type": "array",
            "description": "Font families to load from Google Fonts, then use them in your CSS. A name like Inter, or a name with weights like Inter:wght@400;700.",
            "items": {
              "type": "string"
            }
          },
          "waitForFonts": {
            "title": "Wait for fonts",
            "type": "boolean",
            "description": "Wait until all web fonts have loaded before the capture.",
            "default": true
          },
          "waitMs": {
            "title": "Extra wait (ms)",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Wait this long after loading, for JavaScript charts or animations. 0 to 10,000.",
            "default": 0
          },
          "pdfPaperFormat": {
            "title": "PDF paper size",
            "enum": [
              "custom",
              "A4",
              "A5",
              "A3",
              "Letter",
              "Legal"
            ],
            "type": "string",
            "description": "Custom uses width and height above. A @page size rule in your CSS wins over this setting.",
            "default": "custom"
          },
          "pdfLandscape": {
            "title": "PDF landscape",
            "type": "boolean",
            "description": "Turn the paper sideways. Only for the paper sizes, not for custom.",
            "default": false
          },
          "escapeHtml": {
            "title": "Escape variables",
            "type": "boolean",
            "description": "On: {{name}} inserts text safely, so < and & show as characters. Off: {{name}} inserts raw HTML like {{{name}}}.",
            "default": true
          },
          "label": {
            "title": "File label (single render)",
            "type": "string",
            "description": "Names the file of a single render, like og-release-2. Items use their own label."
          },
          "maxConcurrency": {
            "title": "Parallel renders",
            "minimum": 1,
            "maximum": 5,
            "type": "integer",
            "description": "How many items are rendered at the same time. 1 to 5.",
            "default": 2
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}