{
  "openapi": "3.0.1",
  "info": {
    "title": "Document to Markdown - PDF, Word, PowerPoint, Excel & OCR",
    "description": "Convert documents to Markdown or text for LLMs: PDF, Word (DOCX), PowerPoint (PPTX), Excel (XLSX), HTML, EPUB and scanned images (Tesseract OCR). Input: file URLs or uploaded files. Returns per document: Markdown, title, page count, word count, tables and optional RAG chunks.",
    "version": "1.0",
    "x-build-id": "SKFxAeweBj3lKhKuz"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/kadi_bence~document-to-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-kadi_bence-document-to-markdown",
        "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/kadi_bence~document-to-markdown/runs": {
      "post": {
        "operationId": "runs-sync-kadi_bence-document-to-markdown",
        "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/kadi_bence~document-to-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-kadi_bence-document-to-markdown",
        "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": {
          "urls": {
            "title": "Document URLs",
            "type": "array",
            "description": "Direct links to the files, one per line, e.g. https://arxiv.org/pdf/2401.18059. Supported: PDF, DOCX, PPTX, XLSX/XLS, CSV, HTML, EPUB, ODT/ODS/ODP, RTF, DOC, TXT/MD/JSON and images (PNG, JPG, TIFF, BMP, GIF, WEBP). The file type is detected from the content, so links without an extension are fine. Apify key-value store record URLs and pre-signed S3/Azure/GCS links work too. Login pages and Google Drive share links do not.",
            "items": {
              "type": "string"
            }
          },
          "uploadedFiles": {
            "title": "Upload files",
            "type": "array",
            "description": "Optional. Upload documents from your computer. They are stored in your own Apify account's key-value store, under your control."
          },
          "keyValueStoreId": {
            "title": "Key-value store with your files",
            "type": "string",
            "description": "Optional. ID or name of an Apify key-value store that holds your files, e.g. my-contracts (Console > Storage > Key-value stores, or the API). Every record is converted unless you list keys below."
          },
          "keyValueStoreKeys": {
            "title": "Record keys",
            "type": "array",
            "description": "Optional. Only convert these records of the key-value store above, e.g. handbook.pdf. Leave empty to convert all records.",
            "items": {
              "type": "string"
            }
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "markdown",
              "text",
              "both"
            ],
            "type": "string",
            "description": "Markdown keeps headings, lists and tables (best for LLMs and RAG). Plain text has no markup. Both = a markdown and a text field per document.",
            "default": "markdown"
          },
          "includeTables": {
            "title": "Tables as Markdown tables",
            "type": "boolean",
            "description": "Keep tables as Markdown tables (PDF tables with ruling lines or booktabs rules, Word, PowerPoint, Excel, HTML). Off = table cells as tab-separated text lines.",
            "default": true
          },
          "includePageMarkers": {
            "title": "Page markers",
            "type": "boolean",
            "description": "Insert <!-- Page 3 --> (Slide / Sheet for PowerPoint and Excel) before each page, so you can cite page numbers. Markers are HTML comments, so they are invisible when the Markdown is rendered.",
            "default": true
          },
          "includePageContents": {
            "title": "Per-page content",
            "type": "boolean",
            "description": "Also return a pageContents array with the content of each page, slide or sheet separately. Useful when you index page by page.",
            "default": false
          },
          "chunkSize": {
            "title": "RAG chunk size (characters)",
            "minimum": 0,
            "maximum": 50000,
            "type": "integer",
            "description": "0 = no chunks. Otherwise also return chunks[] of about this many characters, split on headings, paragraphs and tables, each with its heading path and page numbers. Example: 2000. 1,500-3,000 characters (~400-800 tokens) suits most embedding models.",
            "default": 0
          },
          "chunkOverlap": {
            "title": "Chunk overlap (characters)",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "How many characters at the end of one chunk are repeated at the start of the next one, e.g. 200. Only used when the chunk size is above 0.",
            "default": 200
          },
          "ocrMode": {
            "title": "OCR (scanned pages and images)",
            "enum": [
              "auto",
              "always",
              "off"
            ],
            "type": "string",
            "description": "Auto = read images and PDF pages that have no text layer with Tesseract OCR; normal text pages are extracted directly (fast, exact). Always = OCR every PDF page (for PDFs with a broken text layer). Off = never OCR. Each OCR page is charged as an ocr-page event.",
            "default": "auto"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "array",
            "description": "Languages in the scanned documents, e.g. English + German. Pick only the ones you need: each extra language makes OCR slower.",
            "items": {
              "type": "string",
              "enum": [
                "eng",
                "deu",
                "fra",
                "spa",
                "ita"
              ],
              "enumTitles": [
                "English",
                "German",
                "French",
                "Spanish",
                "Italian"
              ]
            },
            "default": [
              "eng"
            ]
          },
          "removeHeadersFooters": {
            "title": "Remove repeated headers and footers (PDF)",
            "type": "boolean",
            "description": "Drop running headers, footers and page numbers that repeat on most PDF pages, so they don't pollute your chunks.",
            "default": true
          },
          "maxPagesPerDocument": {
            "title": "Max pages per document",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Convert at most this many pages (PDF pages, slides, sheets or image frames) of each document, e.g. 50. The rest is skipped and the item is marked truncated. Fewer pages = lower cost.",
            "default": 200
          },
          "pageRange": {
            "title": "Page range",
            "type": "string",
            "description": "Optional, e.g. 1-5, 8, 20- . Applies to PDF pages, slides, sheets and image frames. Empty = all pages."
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Larger files are skipped and not charged. Give the run more memory (4-8 GB) for files above 100 MB.",
            "default": 50
          },
          "maxConcurrency": {
            "title": "Parallel downloads",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "How many files are downloaded at the same time, e.g. 5. Conversion itself uses the CPU of the run (give it 4-8 GB of memory to convert several big files in parallel).",
            "default": 5
          },
          "requestTimeoutSecs": {
            "title": "Download timeout (seconds)",
            "minimum": 10,
            "maximum": 600,
            "type": "integer",
            "description": "Give up on a download after this many seconds, e.g. 120. Downloads are retried twice on 429/5xx errors and timeouts.",
            "default": 120
          },
          "pdfPassword": {
            "title": "PDF password",
            "type": "string",
            "description": "Optional password for encrypted PDFs, used for all PDFs in this run. Stored as a secret. Encrypted Office files are not supported."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}