{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Markdown & Document to Markdown: OCR, RAG Chunks",
    "description": "PDF to Markdown and document to Markdown converter for LLMs, RAG and AI agents. PDF, scanned PDF (OCR), DOCX, PPTX, XLSX, EPUB and HTML to clean Markdown or plain text, with tables, headings and table-aware RAG chunks. $0.003 per document.",
    "version": "1.1",
    "x-build-id": "hSZOjgBnkcFZxgkSJ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/tobbyb~document-to-markdown-converter/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-tobbyb-document-to-markdown-converter",
        "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/tobbyb~document-to-markdown-converter/runs": {
      "post": {
        "operationId": "runs-sync-tobbyb-document-to-markdown-converter",
        "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/tobbyb~document-to-markdown-converter/run-sync": {
      "post": {
        "operationId": "run-sync-tobbyb-document-to-markdown-converter",
        "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": {
          "files": {
            "title": "Files or file URLs",
            "type": "array",
            "description": "PDF, Word (DOCX), PowerPoint (PPTX), Excel (XLSX/XLS/CSV), EPUB, HTML, TXT/Markdown or image files. Paste public URLs or upload files. Google Drive, Google Docs, Dropbox and GitHub share links are converted to direct downloads automatically.",
            "default": [
              "https://arxiv.org/pdf/1706.03762"
            ]
          },
          "startUrls": {
            "title": "Document URLs (bulk)",
            "type": "array",
            "description": "Optional list of document URLs, e.g. pasted from a spreadsheet or uploaded as a text file. Each URL's userData is copied to the output.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "base64Files": {
            "title": "Base64 files (API / n8n / Make / Zapier)",
            "type": "array",
            "description": "Send file bytes directly instead of a URL: a list of objects like {\"fileName\": \"invoice.pdf\", \"data\": \"<base64>\"}. A data: URI is also accepted. Handy for n8n, Make, Zapier and API calls where the file is not public."
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "markdown",
              "text"
            ],
            "type": "string",
            "description": "Markdown keeps headings, lists and tables (best for LLMs and RAG). Plain text removes all formatting.",
            "default": "markdown"
          },
          "chunkSize": {
            "title": "Chunk size (characters)",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Split each document into chunks of about this many characters for embeddings/RAG. Chunks break at headings, paragraphs and sentences, and record their pages and section. Set 0 to disable chunking.",
            "default": 1500
          },
          "chunkOverlap": {
            "title": "Chunk overlap (characters)",
            "minimum": 0,
            "maximum": 20000,
            "type": "integer",
            "description": "How many characters consecutive chunks share (at most half the chunk size).",
            "default": 150
          },
          "datasetItemPerChunk": {
            "title": "One dataset item per chunk",
            "type": "boolean",
            "description": "Output one row per chunk (with document metadata) instead of one row per document. Handy for loading straight into vector databases (Pinecone, Qdrant, Weaviate, Chroma integrations).",
            "default": false
          },
          "ocrMode": {
            "title": "OCR (text recognition)",
            "enum": [
              "auto",
              "force",
              "off"
            ],
            "type": "string",
            "description": "Auto: OCR only pages without a usable text layer (scans, photos, broken fonts). Always: OCR every page. Off: never OCR. OCR pages are billed separately.",
            "default": "auto"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "array",
            "description": "Languages printed in the scans. Pick all that apply (fewer is faster and more accurate).",
            "items": {
              "type": "string",
              "enum": [
                "eng",
                "fra",
                "deu",
                "spa",
                "por",
                "ita",
                "nld",
                "pol",
                "ces",
                "swe",
                "dan",
                "nor",
                "fin",
                "tur",
                "rus",
                "ukr",
                "ell",
                "ron",
                "hun",
                "vie",
                "ind",
                "chi_sim",
                "chi_tra",
                "jpn",
                "kor",
                "ara",
                "heb",
                "hin"
              ],
              "enumTitles": [
                "English",
                "French",
                "German",
                "Spanish",
                "Portuguese",
                "Italian",
                "Dutch",
                "Polish",
                "Czech",
                "Swedish",
                "Danish",
                "Norwegian",
                "Finnish",
                "Turkish",
                "Russian",
                "Ukrainian",
                "Greek",
                "Romanian",
                "Hungarian",
                "Vietnamese",
                "Indonesian",
                "Chinese (simplified)",
                "Chinese (traditional)",
                "Japanese",
                "Korean",
                "Arabic",
                "Hebrew",
                "Hindi"
              ]
            },
            "default": [
              "eng"
            ]
          },
          "maxOcrPagesPerDocument": {
            "title": "Max OCR pages per document",
            "minimum": 0,
            "maximum": 2000,
            "type": "integer",
            "description": "Safety limit for OCR cost/time per document. Pages beyond it are listed in warnings.",
            "default": 100
          },
          "saveFiles": {
            "title": "Also save files",
            "type": "array",
            "description": "Save converted files to the run's key-value store; download links appear in each item's 'files'. Word = editable DOCX, Excel = every extracted table as a sheet, searchable PDF = OCR text layer added to scans.",
            "items": {
              "type": "string",
              "enum": [
                "markdown",
                "text",
                "docx",
                "xlsx",
                "searchablePdf",
                "json"
              ],
              "enumTitles": [
                "Markdown (.md)",
                "Plain text (.txt)",
                "Word (.docx)",
                "Excel tables (.xlsx)",
                "Searchable PDF (OCR'd scans)",
                "Full result (.json)"
              ]
            },
            "default": []
          },
          "includePages": {
            "title": "Include page-by-page text",
            "type": "boolean",
            "description": "Add a 'pages' array with the text of every page (PDF, PPTX slides, XLSX sheets).",
            "default": true
          },
          "includeTables": {
            "title": "Include tables as data",
            "type": "boolean",
            "description": "Add a 'tables' array with each table's rows (JSON) and Markdown.",
            "default": true
          },
          "tableFormat": {
            "title": "Table format",
            "enum": [
              "markdown",
              "html"
            ],
            "type": "string",
            "description": "How tables appear in the document content and chunks. HTML keeps merged/spanning cells exactly; Markdown is simpler. Each item in tables[] always has rows, markdown and (when cells are merged) html.",
            "default": "markdown"
          },
          "includeQuality": {
            "title": "Include per-page quality flags",
            "type": "boolean",
            "description": "Adds a quality object to each page: source (text-layer/ocr), OCR confidence, table count and confidence, image coverage, figure count and needsVision (route the page to a vision model).",
            "default": true
          },
          "includeElements": {
            "title": "Include layout elements with bounding boxes",
            "type": "boolean",
            "description": "Adds elements[] to each page: headings, paragraphs, list items and tables with their bounding box [x0, top, x1, bottom] in PDF points (top-left origin). Useful for citations and highlighting. Chunks always carry page boxes for PDFs.",
            "default": false
          },
          "pageRange": {
            "title": "Page range",
            "type": "string",
            "description": "Only convert these pages, e.g. '1-5, 8, 12-'. Empty = all pages."
          },
          "pdfPassword": {
            "title": "PDF password",
            "type": "string",
            "description": "Password for encrypted PDFs (used for every PDF in the run)."
          },
          "extractTables": {
            "title": "Detect tables",
            "type": "boolean",
            "description": "Detect ruled and borderless tables and output them as Markdown tables.",
            "default": true
          },
          "removeHeadersFooters": {
            "title": "Remove running headers, footers and page numbers",
            "type": "boolean",
            "description": "Drop text repeated at the top/bottom of pages (page numbers, running titles).",
            "default": true
          },
          "maxPagesPerDocument": {
            "title": "Max pages per document",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Only the first N pages of each document are converted.",
            "default": 500
          },
          "htmlMainContentOnly": {
            "title": "HTML: main content only",
            "type": "boolean",
            "description": "For web pages, keep the article/main content and drop menus, sidebars, cookie banners and footers.",
            "default": true
          },
          "maxFileSizeMb": {
            "title": "Max file size",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Larger files are skipped with a FILE_TOO_LARGE error item (not charged).",
            "default": 100
          },
          "maxDocuments": {
            "title": "Max documents",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Stop after this many documents.",
            "default": 10000
          },
          "maxConcurrency": {
            "title": "Parallel documents",
            "minimum": 1,
            "maximum": 16,
            "type": "integer",
            "description": "How many documents are processed at once. Default: 1 per GB of memory."
          },
          "downloadTimeoutSecs": {
            "title": "Download timeout",
            "minimum": 5,
            "maximum": 900,
            "type": "integer",
            "description": "Per-file download timeout.",
            "default": 120
          },
          "keyValueStoreId": {
            "title": "Key-value store with files",
            "type": "string",
            "description": "Convert files stored in this key-value store (ID or name)."
          },
          "keyValueStoreKeys": {
            "title": "Keys in that store",
            "type": "array",
            "description": "Record keys to convert. Empty = every record in the store.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}