{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Text & Markdown Extractor for LLM & RAG",
    "description": "PDF to text and Markdown for LLMs and RAG: headings, lists, metadata, page ranges and ready chunks with page numbers. Input PDF URLs, arXiv/landing pages, web pages that link to PDFs, uploads, base64 or a key-value store. Password PDFs supported. Text layer only (no OCR).",
    "version": "0.1",
    "x-build-id": "c6glhbbHc7oINEHjG"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/adamplaenitz~pdf-text-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-adamplaenitz-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/adamplaenitz~pdf-text-extractor/runs": {
      "post": {
        "operationId": "runs-sync-adamplaenitz-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/adamplaenitz~pdf-text-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-adamplaenitz-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": {
          "pdfUrls": {
            "title": "PDF URLs",
            "type": "array",
            "description": "Links to PDF files, one per line (e.g. https://arxiv.org/pdf/2310.06825v1). Landing pages such as an arXiv abstract or a journal article page also work: their main PDF is followed automatically. Duplicates are removed; files that cannot be downloaded or are not PDFs produce a free error row. The two example documents (NIST CSF 2.0 and the Mistral 7B paper, 41 pages) are used when you start without changes; they are skipped automatically if you only give uploads, base64 files, a key-value store or web pages.",
            "default": [
              "https://nvlpubs.nist.gov/nistpubs/CSWP/NIST.CSWP.29.pdf",
              "https://arxiv.org/pdf/2310.06825v1"
            ],
            "items": {
              "type": "string"
            }
          },
          "webPageUrls": {
            "title": "Web pages with PDF links",
            "type": "array",
            "description": "Optional. Web pages that link to PDF files (e.g. a reports, publications or downloads page), one per line. Every listed page is read once and the PDFs it links to are processed like PDF URLs (no crawling of further pages). Pages that cannot be read or contain no PDF links produce a free row.",
            "items": {
              "type": "string"
            }
          },
          "maxPdfsPerWebPage": {
            "title": "Maximum PDFs per web page",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "At most this many PDF links are taken from each web page above (in page order).",
            "default": 20
          },
          "uploadedFiles": {
            "title": "Upload PDF files",
            "type": "array",
            "description": "Optional. Upload PDF files from your computer; they are stored in Apify storage and read from there. You can also paste Apify key-value store record URLs here."
          },
          "base64Pdfs": {
            "title": "Base64 PDFs (API)",
            "type": "array",
            "description": "Optional, mainly for API calls and automations (n8n, Make, Zapier): PDFs as base64 strings (a data:application/pdf;base64, prefix is allowed) or objects {\"fileName\": \"invoice.pdf\", \"data\": \"<base64>\"}. Keep the whole input below a few MB; for bigger files use URLs or a key-value store."
          },
          "keyValueStore": {
            "title": "Key-value store with PDFs",
            "type": "string",
            "description": "Optional. Select one of your Apify key-value stores that contains PDF files. All its records are processed (records that are not PDFs get a free error row), or only the record keys listed below."
          },
          "recordKeys": {
            "title": "Record keys",
            "type": "array",
            "description": "Optional. Only these records of the selected key-value store, one key per line (e.g. annual-report-2024). Empty = all records (up to 10,000).",
            "items": {
              "type": "string"
            }
          },
          "pdfPassword": {
            "title": "PDF password",
            "type": "string",
            "description": "Optional. Password for protected PDFs that cannot be opened without one; it is tried on every protected file of the run. PDFs that only restrict printing or copying need no password. Stored encrypted by Apify."
          },
          "followLandingPages": {
            "title": "Follow landing pages to their PDF",
            "type": "boolean",
            "description": "If a PDF URL returns a web page instead of a PDF, follow the PDF that the page declares (citation_pdf_url meta tag as on arXiv and journal sites, an embedded PDF viewer, or the only PDF link on the page).",
            "default": true
          },
          "outputFormat": {
            "title": "Output",
            "enum": [
              "both",
              "markdown",
              "text"
            ],
            "type": "string",
            "description": "Markdown: headings (detected from font size and font), paragraphs and lists – best for LLMs and chunking. Text: plain text with paragraphs separated by blank lines. Both: both fields.",
            "default": "both"
          },
          "pageRows": {
            "title": "One row per page",
            "type": "boolean",
            "description": "Additionally store one dataset row per extracted page (itemType \"page\", with page number, text and/or Markdown) – handy for citations with page numbers. No extra cost: pages are charged once either way.",
            "default": false
          },
          "pageRange": {
            "title": "Page range",
            "type": "string",
            "description": "Optional. Pages to extract, 1-based, e.g. \"1-5, 8, 10-\" (open end = up to the last page). Empty = all pages. Only extracted pages are charged – e.g. \"1-3\" reads just the first pages of long reports at a fraction of the cost."
          },
          "maxPagesPerDocument": {
            "title": "Maximum pages per document",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Safety limit: at most this many of the selected pages are extracted per document (the rest is skipped and not charged; the row gets a warning).",
            "default": 1000
          },
          "removeHeadersFooters": {
            "title": "Remove running headers and footers",
            "type": "boolean",
            "description": "Remove lines at the top or bottom of pages that repeat on at least half of the pages (running titles, footers) and lone page numbers – less noise for embeddings.",
            "default": true
          },
          "chunkSize": {
            "title": "Chunk size (characters)",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Optional. If set (e.g. 2000), the Markdown (or the text in text-only mode) is also split into chunks of at most this many characters, preferably at paragraph, line or sentence boundaries. Each chunk carries its first and last page number and the nearest heading. 0 = no chunking.",
            "default": 0
          },
          "chunkOverlap": {
            "title": "Chunk overlap (characters)",
            "minimum": 0,
            "maximum": 50000,
            "type": "integer",
            "description": "How many characters consecutive chunks share (at most half the chunk size). Only used when a chunk size is set.",
            "default": 200
          },
          "maxFileSizeMb": {
            "title": "Maximum file size (MB)",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Larger files are aborted during the download and reported as a free error row. For files above 100 MB give the run more memory (e.g. 4 GB).",
            "default": 50
          },
          "maxConcurrency": {
            "title": "Parallel documents",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many PDFs are downloaded and parsed at the same time (1–10). Requests to the same host are additionally spaced by 0.5 seconds.",
            "default": 3
          },
          "requestTimeoutSecs": {
            "title": "Download timeout (seconds)",
            "minimum": 5,
            "maximum": 300,
            "type": "integer",
            "description": "A download is aborted if the server sends no data for this many seconds (free error row).",
            "default": 60
          },
          "respectRobotsTxt": {
            "title": "Respect robots.txt",
            "type": "boolean",
            "description": "Skip URLs that the robots.txt of the site disallows for crawlers (free error row). Switch off only for sites you own or may access.",
            "default": true
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. Only needed if a server blocks downloads from cloud servers.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}