{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Markdown Extractor & Document Parser: Tables, JSON, OCR",
    "description": "Extract text and tables from PDF, Word, Excel, PowerPoint, HTML and scanned images. Returns LLM-ready Markdown, tables as JSON/CSV, RAG chunks and metadata. OCR for scanned PDFs, optional AI field extraction (invoices, forms). No API key; pay per document.",
    "version": "1.0",
    "x-build-id": "BwpaN80ZWLMwmUSad"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/fguiraud~document-to-markdown-tables/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-fguiraud-document-to-markdown-tables",
        "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/fguiraud~document-to-markdown-tables/runs": {
      "post": {
        "operationId": "runs-sync-fguiraud-document-to-markdown-tables",
        "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/fguiraud~document-to-markdown-tables/run-sync": {
      "post": {
        "operationId": "run-sync-fguiraud-document-to-markdown-tables",
        "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": {
          "sources": {
            "title": "Document URLs",
            "type": "array",
            "description": "Document URLs. Supported: PDF (native or scanned), DOCX, XLSX, XLS, PPTX, HTML pages, CSV, TXT and images. Share links from Google Drive, Google Docs/Sheets/Slides, Dropbox, OneDrive/SharePoint and GitHub are converted to downloads automatically (the file must be shared as 'Anyone with the link'). The real file type is detected from the content.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "base64Files": {
            "title": "Files as base64 (optional)",
            "type": "array",
            "description": "For files that are not reachable by URL, e.g. from an AI agent or a local script: a list of objects {\"fileName\": \"report.pdf\", \"content\": \"<base64>\"}. A data: URI is also accepted as content. Keep the total input under ~9 MB; use URLs for bigger files."
          },
          "followDocumentLinks": {
            "title": "Also process documents linked from web pages",
            "type": "boolean",
            "description": "If a source URL is a web page, find links to PDF/DOCX/XLSX/XLS/PPTX/CSV files on it and convert those documents instead (e.g. a reports, filings or publications page). The page itself is not billed.",
            "default": false
          },
          "maxLinkedDocuments": {
            "title": "Max linked documents per page",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Limit for 'Also process documents linked from web pages'.",
            "default": 20
          },
          "outputs": {
            "title": "What to return",
            "type": "array",
            "description": "Fields to include for each document. 'markdown': whole document as LLM-ready Markdown (headings, lists, tables). 'tables': every table as header + rows + CSV. 'text': plain text. 'pages': Markdown per page/slide/sheet. 'chunks': Markdown split into RAG chunks with page numbers.",
            "items": {
              "type": "string",
              "enum": [
                "markdown",
                "tables",
                "text",
                "pages",
                "chunks"
              ],
              "enumTitles": [
                "Markdown",
                "Tables (JSON + CSV)",
                "Plain text",
                "Per-page content",
                "RAG chunks"
              ]
            },
            "default": [
              "markdown",
              "tables"
            ]
          },
          "saveFiles": {
            "title": "Also save downloadable files",
            "type": "boolean",
            "description": "Save each document's Markdown as a .md file, each table as a .csv file and all tables together as an Excel workbook (.xlsx, one sheet per table) in the run's key-value store; the result includes their download links (handy without code: open the link, get the file).",
            "default": false
          },
          "tableDetection": {
            "title": "PDF table detection",
            "enum": [
              "lines",
              "text"
            ],
            "type": "string",
            "description": "'lines': detect tables drawn with borders/grid lines (precise, recommended). 'text': also detect borderless tables by aligning text columns (experimental: finds more tables, but columns can be split imperfectly).",
            "default": "lines"
          },
          "removeHeadersFooters": {
            "title": "Remove running headers and footers",
            "type": "boolean",
            "description": "Drop lines repeated at the top or bottom of most PDF pages (page numbers, document titles, confidentiality notices) so Markdown and RAG chunks stay clean.",
            "default": true
          },
          "ocr": {
            "title": "OCR mode",
            "enum": [
              "auto",
              "always",
              "never"
            ],
            "type": "string",
            "description": "'auto': run OCR only on scanned pages that contain no text (recommended). 'always': OCR every page, even if it has a text layer. 'never': no OCR (images and scanned pages return no text). OCR pages are billed separately.",
            "default": "auto"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "array",
            "description": "Languages of the scanned text. Adding more languages is slightly slower.",
            "items": {
              "type": "string",
              "enum": [
                "eng",
                "spa",
                "deu",
                "fra",
                "por",
                "ita",
                "nld"
              ],
              "enumTitles": [
                "English",
                "Spanish",
                "German",
                "French",
                "Portuguese",
                "Italian",
                "Dutch"
              ]
            },
            "default": [
              "eng"
            ]
          },
          "pageRange": {
            "title": "Page range",
            "type": "string",
            "description": "Pages to process, e.g. '1-5, 8'. Applies to PDF pages, PowerPoint slides and Excel sheets. Leave empty for all."
          },
          "maxPages": {
            "title": "Max pages per document",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Safety limit on pages processed per document.",
            "default": 500
          },
          "chunkSize": {
            "title": "Chunk size (characters)",
            "minimum": 100,
            "maximum": 20000,
            "type": "integer",
            "description": "Maximum chunk length when 'RAG chunks' output is selected. Chunks follow paragraph boundaries.",
            "default": 1000
          },
          "chunkOverlap": {
            "title": "Chunk overlap (characters)",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Characters from the end of the previous chunk repeated at the start of the next one, to keep context.",
            "default": 100
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Documents larger than this are skipped (not billed).",
            "default": 50
          },
          "pdfPassword": {
            "title": "PDF password",
            "type": "string",
            "description": "Password for encrypted PDFs (applies to all PDFs in the run)."
          },
          "maxCharactersPerDocument": {
            "title": "Max characters per document",
            "minimum": 0,
            "maximum": 10000000,
            "type": "integer",
            "description": "Truncate 'markdown' and 'text' to this many characters (0 = no limit). Useful for AI agents with limited context windows.",
            "default": 0
          },
          "extractionFields": {
            "title": "Fields to extract (AI, optional)",
            "type": "array",
            "description": "Pull specific values out of every document with Claude, e.g. [\"invoice_number\", \"invoice_date\", {\"name\": \"total\", \"type\": \"number\"}, \"vendor_name\"]. Results appear in 'extracted'. Requires your Anthropic API key. Billed as one extra 'AI extraction' event per document (Claude usage is billed to your own Anthropic account)."
          },
          "extractionSchema": {
            "title": "Extraction JSON Schema (advanced)",
            "type": "object",
            "description": "Instead of a field list, a full JSON Schema (type: object) for nested data, e.g. invoice line items. Every property is returned; missing values come back as null."
          },
          "extractionInstructions": {
            "title": "Extraction instructions",
            "type": "string",
            "description": "Optional guidance, e.g. 'Dates as YYYY-MM-DD; amounts without currency symbols'."
          },
          "anthropicApiKey": {
            "title": "Anthropic API key",
            "type": "string",
            "description": "Your key from console.anthropic.com. Stored as a secret input; used only to call Claude for this run."
          },
          "extractionModel": {
            "title": "Claude model",
            "enum": [
              "claude-opus-5",
              "claude-sonnet-5",
              "claude-haiku-4-5"
            ],
            "type": "string",
            "description": "'claude-opus-5': most accurate (default). 'claude-sonnet-5': cheaper, great for invoices/forms. 'claude-haiku-4-5': cheapest, for simple fields.",
            "default": "claude-opus-5"
          },
          "failOnError": {
            "title": "Fail the run if any document fails",
            "type": "boolean",
            "description": "Mark the run as FAILED when a document cannot be processed or yields no text. Useful for pipelines and monitoring. Successfully processed documents are still returned (and billed).",
            "default": false
          },
          "maxConcurrency": {
            "title": "Max parallel documents",
            "minimum": 1,
            "maximum": 8,
            "type": "integer",
            "description": "How many documents are processed at the same time.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}