{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Markdown, Tables & OCR Extractor",
    "description": "Convert PDFs and scanned documents to Markdown, header-mapped tables (JSON + CSV) and schema JSON, with OCR and page-level provenance.",
    "version": "1.0",
    "x-build-id": "mk0nYBYEdXFsru53u"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/cylindrical_lighthouse~document-intelligence/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-cylindrical_lighthouse-document-intelligence",
        "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/cylindrical_lighthouse~document-intelligence/runs": {
      "post": {
        "operationId": "runs-sync-cylindrical_lighthouse-document-intelligence",
        "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/cylindrical_lighthouse~document-intelligence/run-sync": {
      "post": {
        "operationId": "run-sync-cylindrical_lighthouse-document-intelligence",
        "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 PDF URLs to convert (text or scanned). Each URL becomes one dataset item with Markdown, pages and tables. Example: https://www.federalreserve.gov/releases/g19/current/g19.pdf. Duplicates are processed once; no login or paywalled URLs.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "ocrMode": {
            "title": "OCR mode",
            "enum": [
              "auto",
              "always",
              "never"
            ],
            "type": "string",
            "description": "When to run OCR. \"auto\" (default): only pages without a usable text layer (scans). \"always\": every page, for scans with a poor embedded text layer; charged as OCR pages. \"never\": text layer only, cheapest. Example: auto.",
            "default": "auto"
          },
          "ocrLanguage": {
            "title": "OCR language",
            "pattern": "^[a-z_]{3,}(\\+[a-z_]{3,})*$",
            "type": "string",
            "description": "Tesseract language code(s) of the scanned text, combined with +. Examples: eng, deu, fra, spa, eng+deu, chi_sim. English is built in; other languages are downloaded once per run (1-10 MB).",
            "default": "eng"
          },
          "maxPagesPerDocument": {
            "title": "Max pages per document",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum pages to process per document, counted from page 1. Caps cost for long PDFs; later pages are skipped and the item is marked truncated. Example: 50.",
            "default": 200
          },
          "maxDocuments": {
            "title": "Max documents",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Maximum documents to process in this run, including failed ones. Example: 100.",
            "default": 100
          },
          "datasetId": {
            "title": "Dataset ID (chain from another Actor)",
            "type": "string",
            "description": "Read document URLs from an Apify dataset, e.g. the output of Website Content Crawler or any crawler. Example: aBcD1234EfGh5678 or username~my-dataset."
          },
          "datasetUrlField": {
            "title": "Dataset URL field",
            "type": "string",
            "description": "Field of each dataset item that holds the document URL (dot paths allowed; arrays of URLs are expanded). Example: url, or links.pdf.",
            "default": "url"
          },
          "keyValueStoreId": {
            "title": "Key-value store ID",
            "type": "string",
            "description": "Key-value store that holds PDF files, e.g. files saved by Website Content Crawler with saveFiles. Example: aBcD1234EfGh5678 or username~my-store."
          },
          "keyValueStoreKeys": {
            "title": "Key-value store keys",
            "type": "array",
            "description": "Record keys of the PDF files in the key-value store above. Example: invoice-001.pdf.",
            "items": {
              "type": "string"
            }
          },
          "extractionSchema": {
            "title": "Extraction JSON Schema (optional)",
            "type": "object",
            "description": "Optional JSON Schema describing the data to extract from each document with your own LLM API key. Example: { \"type\": \"object\", \"properties\": { \"invoiceNumber\": { \"type\": \"string\" }, \"total\": { \"type\": \"number\" } } }. The result is in \"extracted\" with page citations per field. Leave empty to skip (no LLM calls, no extraction charge)."
          },
          "extractionInstructions": {
            "title": "Extraction instructions",
            "type": "string",
            "description": "Optional extra guidance for the model. Example: Amounts are in USD; use ISO dates (YYYY-MM-DD)."
          },
          "llmProvider": {
            "title": "LLM provider",
            "enum": [
              "anthropic",
              "openai"
            ],
            "type": "string",
            "description": "Which provider your API key belongs to. Example: anthropic.",
            "default": "anthropic"
          },
          "llmModel": {
            "title": "LLM model ID",
            "type": "string",
            "description": "The model ID exactly as listed in your provider's model documentation (docs.anthropic.com or platform.openai.com). Required when an extraction schema is set."
          },
          "llmApiKey": {
            "title": "LLM API key",
            "type": "string",
            "description": "Your Anthropic or OpenAI API key. Stored encrypted by Apify, never logged and never written to the output. Required when an extraction schema is set. Example format: sk-..."
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Skip files larger than this, with a clear error record. Very large files need more memory. Example: 100.",
            "default": 100
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Not needed for most public documents. Enable only if a server blocks direct downloads. Example: Apify datacenter proxy.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}