{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Text & Markdown: Office Files, Scans, OCR",
    "description": "Convert PDF, Word, PowerPoint, Excel, EPUB, HTML and scanned images to clean text and Markdown for LLMs and RAG. Tables come out as Markdown and CSV, scanned pages go through Tesseract OCR, and you can split the text into overlapping chunks. Failed files are free.",
    "version": "0.1",
    "x-build-id": "vaLi6ULaBr94pliT6"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/fernandosord~document-to-markdown/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-fernandosord-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/fernandosord~document-to-markdown/runs": {
      "post": {
        "operationId": "runs-sync-fernandosord-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/fernandosord~document-to-markdown/run-sync": {
      "post": {
        "operationId": "run-sync-fernandosord-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 to convert: PDF, DOCX, PPTX, XLSX, EPUB, HTML, TXT, Markdown, CSV, or images (PNG, JPG, TIFF, BMP, GIF, WebP). Each file becomes one row in the dataset. Only these URLs are fetched; links inside the files are not followed.",
            "items": {
              "type": "string"
            }
          },
          "file": {
            "title": "Upload a file",
            "type": "string",
            "description": "Upload one file from your computer instead of (or as well as) giving URLs. It is stored in your Apify account and converted like any other URL."
          },
          "datasetId": {
            "title": "Dataset with file URLs",
            "type": "string",
            "description": "ID of an Apify dataset whose rows hold file URLs, for example the output of a scraper that collected PDF links. Up to 1,000 rows are read."
          },
          "datasetUrlField": {
            "title": "URL field in the dataset",
            "type": "string",
            "description": "The field in each dataset row that holds the file URL.",
            "default": "url"
          },
          "keyValueStoreId": {
            "title": "Key-value store with files",
            "type": "string",
            "description": "ID of an Apify key-value store. Every record in it is converted as a file (INPUT and OUTPUT are skipped)."
          },
          "keyValueStorePrefix": {
            "title": "Only keys starting with",
            "type": "string",
            "description": "Convert only the key-value store records whose key starts with this text."
          },
          "ocrMode": {
            "title": "OCR mode",
            "enum": [
              "auto",
              "always",
              "off"
            ],
            "type": "string",
            "description": "<b>Auto</b> runs OCR only on PDF pages without a usable text layer (scans and photos) and on images. <b>Always</b> runs OCR on every PDF page, which is slower and charged as OCR pages. <b>Off</b> never runs OCR; images then fail and scanned pages come out empty.",
            "default": "auto"
          },
          "ocrLanguages": {
            "title": "OCR languages",
            "type": "array",
            "description": "Languages Tesseract looks for. Pick the languages of your scans; each extra language makes OCR slower. This setting does not affect files that already have a text layer.",
            "items": {
              "type": "string",
              "enum": [
                "eng",
                "spa",
                "fra",
                "deu",
                "ita",
                "por",
                "nld",
                "pol",
                "tur",
                "rus",
                "ukr",
                "chi_sim",
                "jpn",
                "kor",
                "ara",
                "hin"
              ],
              "enumTitles": [
                "English",
                "Spanish",
                "French",
                "German",
                "Italian",
                "Portuguese",
                "Dutch",
                "Polish",
                "Turkish",
                "Russian",
                "Ukrainian",
                "Chinese (simplified)",
                "Japanese",
                "Korean",
                "Arabic",
                "Hindi"
              ]
            },
            "default": [
              "eng"
            ]
          },
          "ocrDpi": {
            "title": "OCR resolution",
            "minimum": 100,
            "maximum": 400,
            "type": "integer",
            "description": "Resolution used to render scanned PDF pages for OCR. 300 suits most scans; 200 is faster; go higher only for very small print.",
            "default": 300
          },
          "pageRange": {
            "title": "Pages to convert",
            "type": "string",
            "description": "Only these pages, slides or sheets, for example <code>1-5, 8, 10-12</code>. Leave empty for all. Applies to PDFs, PPTX slides, XLSX sheets and multi-page TIFFs."
          },
          "maxPages": {
            "title": "Maximum pages per document",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Pages (or slides, sheets, TIFF frames) after this many are not converted, so a 900-page file can't use up your budget. The row says when this happened.",
            "default": 500
          },
          "pdfTables": {
            "title": "PDF table detection",
            "enum": [
              "ruled",
              "auto",
              "bordered",
              "off"
            ],
            "type": "string",
            "description": "<b>Standard</b> finds tables drawn with cell borders and borderless tables whose number columns line up with white space, as in financial statements, bank statements and statistical releases. Each borderless table must pass checks (at least 3 rows with numbers, columns that stay in place, no running text), so ordinary paragraphs are left alone. <b>Standard plus rule-only tables</b> also tries tables that only have horizontal rules (common in papers); it finds more tables but sometimes mistakes a chart or diagram for one. <b>Bordered tables only</b> is the behaviour before October 2026. <b>Off</b> keeps all PDF text as paragraphs. DOCX, PPTX, XLSX and HTML tables are always extracted.",
            "default": "ruled"
          },
          "saveTablesAsCsv": {
            "title": "Save tables as CSV files",
            "type": "boolean",
            "description": "Save every table as a CSV file in the run's key-value store and add its link to the row. Tables are always in the Markdown too.",
            "default": true
          },
          "removeHeadersFooters": {
            "title": "Remove running headers and page numbers",
            "type": "boolean",
            "description": "In PDFs, drop lines that repeat at the top or bottom of most pages (running titles, page numbers). Needs at least 3 pages.",
            "default": true
          },
          "includePageText": {
            "title": "Include text per page",
            "type": "boolean",
            "description": "Add a <code>pages</code> list with the Markdown of each page, slide or sheet, and whether it was read with OCR.",
            "default": false
          },
          "addPageMarkers": {
            "title": "Mark page breaks in the Markdown",
            "type": "boolean",
            "description": "Put an HTML comment such as <code>&lt;!-- page 3 --&gt;</code> before each page in the Markdown, so you can cite pages later.",
            "default": false
          },
          "saveMarkdownFile": {
            "title": "Save Markdown file",
            "enum": [
              "auto",
              "always",
              "never"
            ],
            "type": "string",
            "description": "Also save the full Markdown as a .md file in the key-value store and link it in <code>markdownFileUrl</code>. <b>Auto</b> does this for documents over 100,000 characters. Markdown over 1,000,000 characters is always saved as a file, because the dataset row only holds the first 1,000,000.",
            "default": "auto"
          },
          "chunkSize": {
            "title": "Chunk size for LLM / RAG",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Split the Markdown into chunks of at most this size and add them as <code>chunks</code>, with headings and page numbers for each chunk. 0 turns chunking off. 500 to 1,000 tokens is a common choice for retrieval.",
            "default": 0
          },
          "chunkUnit": {
            "title": "Chunk size unit",
            "enum": [
              "tokens",
              "characters"
            ],
            "type": "string",
            "description": "Count chunk size and overlap in tokens (OpenAI's cl100k_base tokenizer) or in characters.",
            "default": "tokens"
          },
          "chunkOverlap": {
            "title": "Chunk overlap",
            "minimum": 0,
            "maximum": 50000,
            "type": "integer",
            "description": "How much of the end of each chunk is repeated at the start of the next, in the unit above. At most half the chunk size.",
            "default": 0
          },
          "maxFileSizeMb": {
            "title": "Maximum file size",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Files larger than this are not downloaded and the row says why. Not charged.",
            "default": 100
          },
          "downloadTimeoutSecs": {
            "title": "Download time limit",
            "minimum": 10,
            "maximum": 900,
            "type": "integer",
            "description": "A download that takes longer than this is stopped and the file is marked as failed (not charged).",
            "default": 120
          },
          "documentTimeoutSecs": {
            "title": "Conversion time limit per document",
            "minimum": 30,
            "maximum": 3600,
            "type": "integer",
            "description": "When converting one file takes longer than this, the pages finished so far are returned with a warning, and only they are charged. A file that hangs is stopped 30 s later.",
            "default": 600
          },
          "respectRobotsTxt": {
            "title": "Respect robots.txt",
            "type": "boolean",
            "description": "Skip files that the site's robots.txt does not allow bots to fetch, and wait between files from the same site as its Crawl-delay asks. Turn off only for files on sites you own or have permission to fetch. Files in your own Apify storage are always allowed.",
            "default": true
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}