{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF & Document to JSON Extractor (AI) — Invoices, Forms",
    "description": "Turn PDF, DOCX and HTML documents into JSON that matches your own schema: invoices, contracts, forms, statements. Free rules mode, or Claude with your key or ours (fast, balanced, best tiers). Pay per document and page, no browser, no proxies.",
    "version": "0.1",
    "x-build-id": "DE4CNhiGuqs3B3NMd"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/owlabee~document-to-json-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-owlabee-document-to-json-extractor",
        "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/owlabee~document-to-json-extractor/runs": {
      "post": {
        "operationId": "runs-sync-owlabee-document-to-json-extractor",
        "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/owlabee~document-to-json-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-owlabee-document-to-json-extractor",
        "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",
        "required": [
          "urls",
          "schema"
        ],
        "properties": {
          "urls": {
            "title": "Document URLs",
            "minItems": 1,
            "uniqueItems": true,
            "type": "array",
            "description": "Documents to extract from, one per line: public http(s) URLs of PDF, DOCX, HTML, Markdown or plain-text files, Apify key-value-store references in the form kvs://<storeId>/<key> (use kvs://default/<key> for this run's own store), or data: URLs with inline base64 content. Each entry becomes one JSON object in the dataset. The prefilled PDF (IRS Form W-9) is the small public file used by Apify's daily automated test.",
            "items": {
              "type": "string"
            }
          },
          "schema": {
            "title": "JSON Schema of the object to extract",
            "type": "object",
            "description": "A JSON Schema (draft-07 subset) describing the object you want per document: `type: object` at the top with `properties`; field types string, number, integer, boolean, array and object; `description` on each field tells the extractor what to look for; `format: date` normalizes dates to YYYY-MM-DD; `enum` restricts values. Fields not found in a document come back as null. The prefilled schema describes a government form; replace it with your own (invoice, contract, statement…)."
          },
          "extractor": {
            "title": "Extractor",
            "enum": [
              "rules",
              "byok",
              "hosted"
            ],
            "type": "string",
            "description": "Leave empty for the default (the Console prefills `rules` so Apify's daily automated test never calls a model; clear it or pick a mode): AI extraction by the hosted Claude model (`hosted`) when the Actor has its model key configured, otherwise the free rules extractor. Set `rules` for a free, model-free run (deterministic label matching, tables, dates and amounts; no key), or `byok` to use your own Anthropic API key (tokens billed by Anthropic to you). In hosted mode a model problem never fails the run: the document gets the rules extraction, `extractionMethod: \"rules-fallback\"` and is charged the rules price."
          },
          "anthropicApiKey": {
            "title": "Anthropic API key (byok mode)",
            "type": "string",
            "description": "Your Anthropic API key, used only when Extractor is `byok`. Stored encrypted as a secret and sent only to api.anthropic.com. Get one at console.anthropic.com."
          },
          "modelTier": {
            "title": "Model tier (byok and hosted modes)",
            "enum": [
              "fast",
              "balanced",
              "best"
            ],
            "type": "string",
            "description": "`fast` (default): Claude Haiku 5.5, cheapest and quick, fine for invoices, forms and statements. `balanced`: Claude Sonnet 5.5, better on long contracts and messy layouts. `best`: Claude Opus 5.5 for the hardest documents. In hosted mode the tier sets the per-document and per-page prices ($0.02 + $0.002/page, $0.15 + $0.02/page, $0.30 + $0.04/page); in byok mode the tier only changes what Anthropic bills you.",
            "default": "fast"
          },
          "instructions": {
            "title": "Extraction instructions (model modes, optional)",
            "type": "string",
            "description": "Extra guidance for the model, in plain language: conventions (\"amounts in EUR without VAT\", \"dates are day-first\"), what to ignore (\"skip the cover letter\"), or how to pick between candidates (\"the vendor is the party at the top left\"). Ignored by the rules extractor."
          },
          "maxInputTokens": {
            "title": "Max input tokens per document (model modes)",
            "minimum": 2000,
            "maximum": 40000,
            "type": "integer",
            "description": "Documents longer than this (estimated) are cut to the cap before the model call and the item is marked `inputTruncated: true`. 40,000 tokens is roughly 60 pages of text. Lower it to cut your own token cost in byok mode.",
            "default": 40000
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 5,
            "type": "integer",
            "description": "Documents processed in parallel (downloads, conversion and model calls). Large PDFs need memory: keep it at 2 on 1 GB unless the files are small.",
            "default": 2
          },
          "includeMarkdown": {
            "title": "Include the document text",
            "type": "boolean",
            "description": "Also write the document's full converted Markdown on each item as `markdown` (capped at 1,000,000 characters). Off by default; every item always carries a 1,000-character `textPreview`.",
            "default": false
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "Files larger than this are rejected with a TOO_LARGE error item instead of being downloaded. Raise it up to 50 MB for large files; bigger files need more memory.",
            "default": 25
          },
          "downloadTimeoutSecs": {
            "title": "Download timeout (seconds)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Maximum time to download one file before it is recorded as a TIMEOUT error item.",
            "default": 20
          },
          "webhookUrl": {
            "title": "Webhook URL (optional)",
            "pattern": "^https?://.+",
            "type": "string",
            "description": "If set, the Actor POSTs a JSON summary of the run (documents, errors, pages, fields filled, model token totals, charges) to this URL when it finishes — 10 s timeout, 2 retries. Failures are logged, never fatal."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}