{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF Text Extractor - Tables, Markdown, RAG Chunks & OCR",
    "description": "Extract text from PDF files by URL: clean text, Markdown with headings, tables as rows, metadata, bookmarks, one row per document, per page or per RAG chunk. Optional OCR for scanned PDFs in 20 languages. Google Drive, Dropbox and arXiv links work. Failed files are free.",
    "version": "0.1",
    "x-build-id": "ZQfhGgZUFJTR1E3Ws"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapewise~pdf-text-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapewise-pdf-text-extractor",
        "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/scrapewise~pdf-text-extractor/runs": {
      "post": {
        "operationId": "runs-sync-scrapewise-pdf-text-extractor",
        "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/scrapewise~pdf-text-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-scrapewise-pdf-text-extractor",
        "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": "PDF links",
            "type": "array",
            "description": "Links to PDF files, one per line. Direct .pdf links, arXiv pages (arxiv.org/abs/...), Google Drive and Dropbox share links and GitHub file links all work (for example https://arxiv.org/pdf/2005.11401). Each PDF gives one row, or one row per page or chunk depending on 'One row per'. Links that are not PDFs or cannot be downloaded return a free error row. Also accepts 'pdfUrls', 'startUrls' or 'url'.",
            "items": {
              "type": "string"
            }
          },
          "pdfFile": {
            "title": "Or upload a PDF",
            "type": "string",
            "description": "Upload one PDF from your computer instead of (or in addition to) the links above. It is stored in your account and read like any other link. Through the API, pass a public URL of the file."
          },
          "storeId": {
            "title": "Or read PDFs from a key-value store",
            "type": "string",
            "description": "Pick one of your Apify key-value stores (through the API, pass its ID). Every record whose key ends in .pdf is read, or only the keys listed below. Handy when another Actor or your own code already saved the files there, so nothing has to be public."
          },
          "keyValueStoreKeys": {
            "title": "Keys to read from the store",
            "type": "array",
            "description": "Optional. Record keys to read from the key-value store above, as a JSON list (for example [\"invoice-001.pdf\"]). Leave empty to read every record whose key ends in .pdf. Ignored when no store is picked.",
            "items": {
              "type": "string"
            }
          },
          "outputMode": {
            "title": "One row per",
            "enum": [
              "document",
              "pages",
              "chunks"
            ],
            "type": "string",
            "description": "Document (default): one row per PDF with the full text, Markdown, tables, metadata and bookmarks. Page: one row per page, with its number, text and Markdown. RAG chunk: the Markdown split into overlapping chunks with the section heading and page numbers of each chunk, ready to embed in a vector database. The price is the same in the three modes.",
            "default": "document"
          },
          "includeMarkdown": {
            "title": "Markdown",
            "type": "boolean",
            "description": "On by default: adds a 'markdown' field with headings rebuilt from font sizes, paragraphs joined across line breaks, bullet lists, tables as Markdown tables and repeated page headers and footers removed. Ideal for LLM prompts. Turn off to keep only the plain 'text' field. RAG chunks are always built from the Markdown.",
            "default": true
          },
          "extractTables": {
            "title": "Extract tables",
            "type": "boolean",
            "description": "On by default: finds tables and returns each one in 'tables' as rows and columns (and as a Markdown table inside the Markdown). Works on tables drawn with lines and on research-paper tables with horizontal rules. Turn off to read very long PDFs (hundreds of pages) many times faster when you only need the text. No effect on price.",
            "default": true
          },
          "includePages": {
            "title": "Add per-page text to document rows",
            "type": "boolean",
            "description": "In Document mode, also adds a 'pages' list with the page number, text and Markdown of each page, so you keep one row per PDF and can still cite pages. Off by default. Ignored in Page and RAG chunk modes, which already split by page.",
            "default": false
          },
          "removeHeadersFooters": {
            "title": "Remove repeated headers and footers",
            "type": "boolean",
            "description": "On by default: leaves running headers, footers and page numbers that repeat on most pages out of the Markdown and the chunks, so they do not break paragraphs or pollute embeddings. The plain 'text' field always keeps everything as printed.",
            "default": true
          },
          "chunkSize": {
            "title": "Chunk size (characters)",
            "minimum": 200,
            "maximum": 20000,
            "type": "integer",
            "description": "RAG chunk mode only: maximum characters per chunk before the overlap (200 to 20,000, default 1,000, about 250 tokens at 4 characters per token). Chunks break at paragraphs, headings and tables when possible, never in the middle of a word. Larger chunks mean fewer rows; the price per PDF does not change.",
            "default": 1000
          },
          "chunkOverlap": {
            "title": "Chunk overlap (characters)",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "RAG chunk mode only: how many characters from the end of each chunk are repeated at the start of the next one (default 150, at most half the chunk size), so a sentence cut at a boundary still appears whole in one chunk. 0 for no overlap.",
            "default": 150
          },
          "pageRange": {
            "title": "Page range",
            "type": "string",
            "description": "Read only these pages, for example 1-5, 8, 12- (12- means page 12 to the end). Pages are numbered from 1 and the range applies to every PDF in the run. Leave empty to read every page. Fewer pages means fewer '10 extra pages' charges on long files."
          },
          "maxPagesPerPdf": {
            "title": "Maximum pages per PDF",
            "minimum": 1,
            "type": "integer",
            "description": "Stop after this many pages of each PDF (for example 50). Every row still says how many pages the file has. Leave empty to read all pages. Caps your cost on very long files: the first 20 pages are in the PDF price and each started block of 10 more is an extra event."
          },
          "pdfPassword": {
            "title": "PDF password",
            "type": "string",
            "description": "Password for protected PDFs. Tried on every PDF in the run that asks for one; PDFs without a password ignore it. A wrong password returns a free error row. Stored encrypted and never written to the output."
          },
          "ocr": {
            "title": "OCR for scanned pages",
            "enum": [
              "off",
              "auto",
              "force"
            ],
            "type": "string",
            "description": "Scanned PDFs are images and have no text to copy. Off (default): scanned pages come back empty. Auto: OCR reads only the pages without a text layer and charges the 'OCR page' event only for those. Force: OCR every page, for PDFs whose text layer is broken or garbled. Pages with normal text are never sent to OCR in Auto.",
            "default": "off"
          },
          "ocrLanguage": {
            "title": "OCR language",
            "enum": [
              "eng",
              "deu",
              "fra",
              "spa",
              "por",
              "ita",
              "nld",
              "pol",
              "swe",
              "rus",
              "ukr",
              "tur",
              "ara",
              "hin",
              "jpn",
              "kor",
              "chi_sim",
              "chi_tra",
              "vie",
              "ind"
            ],
            "type": "string",
            "description": "Language of the scanned text, which helps OCR read accents and non-Latin scripts (default English). Through the API you can join two with a plus sign, for example eng+deu, for documents that mix languages. Ignored when OCR is off.",
            "default": "eng"
          },
          "ocrMaxPagesPerPdf": {
            "title": "Maximum OCR pages per PDF",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "OCR stops after this many scanned pages of each PDF (1 to 5,000, default 50); the row carries a warning with how many scanned pages were left unread. Caps your OCR cost on long scanned files. Pages with a normal text layer do not count.",
            "default": 50
          },
          "maxPdfs": {
            "title": "Maximum PDFs",
            "minimum": 1,
            "type": "integer",
            "description": "Read at most this many PDFs in the run, across links, upload and key-value store (for example 100). Leave empty for all. Useful to test a large list or a store before reading everything."
          },
          "maxPdfSizeMb": {
            "title": "Skip PDFs larger than (MB)",
            "minimum": 1,
            "maximum": 300,
            "type": "integer",
            "description": "PDFs larger than this many megabytes (1 to 300, default 100) are not downloaded: they get a free FILE_TOO_LARGE row. Raise it for large scanned books; lower it to skip heavy files.",
            "default": 100
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Not needed for most files: downloads go straight to the server, and a blocked download is retried once through Apify datacenter proxy. Turn the proxy on here only to send every download through it, for example for a site that blocks cloud servers. Off by default."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}