{
  "openapi": "3.0.1",
  "info": {
    "title": "Invoice & PDF to JSON Parser (OCR) – DOCX to Markdown",
    "description": "Convert PDF, DOCX and scanned documents to clean Markdown, tables and structured JSON. Extracts invoice & receipt fields (vendor, dates, totals, tax, line items, IBAN, VAT ID) with no AI key required. Fast, batch, pay per document.",
    "version": "1.0",
    "x-build-id": "clly8BeN8OgigzpzA"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/gazidev~document-invoice-to-json/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-gazidev-document-invoice-to-json",
        "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/gazidev~document-invoice-to-json/runs": {
      "post": {
        "operationId": "runs-sync-gazidev-document-invoice-to-json",
        "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/gazidev~document-invoice-to-json/run-sync": {
      "post": {
        "operationId": "run-sync-gazidev-document-invoice-to-json",
        "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": {
          "documentUrls": {
            "title": "Document URLs",
            "type": "array",
            "description": "Public URLs of PDF, DOCX, image (PNG/JPG/TIFF/WEBP) or TXT files. Google Drive, Dropbox and GitHub share links are converted to direct downloads automatically. One result row is produced per document.",
            "items": {
              "type": "string"
            }
          },
          "uploadedFiles": {
            "title": "Or upload files",
            "type": "array",
            "description": "Upload documents directly instead of providing URLs."
          },
          "documentType": {
            "title": "Document type",
            "enum": [
              "auto",
              "invoice",
              "generic"
            ],
            "type": "string",
            "description": "'auto' detects invoices/receipts and extracts invoice fields only for them. 'invoice' always runs invoice extraction. 'generic' only returns Markdown, text and tables.",
            "default": "auto"
          },
          "includeMarkdown": {
            "title": "Include Markdown",
            "type": "boolean",
            "description": "Clean Markdown with headings, paragraphs, lists and tables - ideal for LLMs, RAG and AI agents.",
            "default": true
          },
          "includeTables": {
            "title": "Include tables as JSON",
            "type": "boolean",
            "description": "Every detected table as {header, rows} arrays (page number and bounding box included).",
            "default": true
          },
          "includeText": {
            "title": "Include plain text",
            "type": "boolean",
            "description": "Full plain text of the document.",
            "default": false
          },
          "includePages": {
            "title": "Include per-page output",
            "type": "boolean",
            "description": "Adds a 'pages' array with text, Markdown and tables for each page (useful for citations / page-level RAG).",
            "default": false
          },
          "ocrMode": {
            "title": "OCR mode",
            "enum": [
              "auto",
              "force",
              "off"
            ],
            "type": "string",
            "description": "'auto' runs OCR only on pages without a text layer (scans, photos) and on image files. 'force' OCRs every page. 'off' never runs OCR (fastest, cheapest). OCR pages are billed with the extra 'ocr-page' event.",
            "default": "auto"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "string",
            "description": "Tesseract language codes joined with '+'. Available: eng, deu, fra, spa, ita, por, nld, tur. Example: 'eng+deu'.",
            "default": "eng"
          },
          "tableStrategy": {
            "title": "Table detection",
            "enum": [
              "lines",
              "text",
              "none"
            ],
            "type": "string",
            "description": "'lines' detects ruled/bordered tables (accurate, recommended). 'text' additionally tries whitespace-aligned tables when no ruled table is found on a page (can produce noisy tables). 'none' disables table detection.",
            "default": "lines"
          },
          "maxPagesPerDocument": {
            "title": "Max pages per document",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Pages beyond this limit are skipped (and not billed).",
            "default": 300
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Larger files are rejected (and not billed).",
            "default": 50
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 16,
            "type": "integer",
            "description": "How many documents are downloaded/processed in parallel.",
            "default": 4
          },
          "pdfPassword": {
            "title": "PDF password",
            "type": "string",
            "description": "Password for encrypted PDFs (applied to all documents)."
          },
          "llmProvider": {
            "title": "LLM refinement (optional, bring your own key)",
            "enum": [
              "none",
              "anthropic",
              "openai"
            ],
            "type": "string",
            "description": "Invoice fields are extracted with built-in rules and need no API key. Optionally let an LLM refine them using YOUR key - billed by your LLM provider, not by this Actor. 'openai' works with any OpenAI-compatible endpoint (OpenAI, OpenRouter, Groq, Together...).",
            "default": "none"
          },
          "llmApiKey": {
            "title": "LLM API key",
            "type": "string",
            "description": "Your Anthropic or OpenAI(-compatible) API key. Stored encrypted."
          },
          "llmModel": {
            "title": "LLM model",
            "type": "string",
            "description": "Model ID. Defaults: 'claude-opus-5' (Anthropic), 'gpt-4o-mini' (OpenAI). Use a smaller model such as 'claude-haiku-4-5' for lower LLM cost."
          },
          "llmBaseUrl": {
            "title": "OpenAI-compatible base URL",
            "type": "string",
            "description": "Only for provider 'openai'. Default https://api.openai.com/v1 (e.g. https://openrouter.ai/api/v1)."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}