{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Text Extractor: Pages, Metadata & RAG Chunks",
    "description": "Extract text from PDF files by URL: full text, per-page text, metadata and RAG-ready chunks, with scanned-page detection. Pay only for PDFs that succeed. Export CSV/JSON or connect n8n, Make, Zapier and LangChain.",
    "version": "1.0",
    "x-build-id": "flYcQqEwxQ8jNV8eR"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ravensource~pdf-text-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ravensource-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/ravensource~pdf-text-extractor/runs": {
      "post": {
        "operationId": "runs-sync-ravensource-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/ravensource~pdf-text-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-ravensource-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",
        "required": [
          "pdfUrls"
        ],
        "properties": {
          "pdfUrls": {
            "title": "PDF URLs",
            "type": "array",
            "description": "Direct http(s) links to PDF files, one entry per PDF, for example [{\"url\": \"https://example.com/report.pdf\"}]. Link to the file itself, not to a viewer page. Redirects are followed (up to 5). Each PDF that is extracted successfully is charged once; every other URL is reported with a status and is free. Apify key-value store record URLs (https://api.apify.com/v2/key-value-stores/<storeId>/records/<key>) work too, including records in your own private stores. To pass many URLs, link or upload a text file with one URL per line. Limits: 20,000 URLs per run; duplicate URLs are processed once; private or internal addresses, URLs with user:password@, and ports other than 80, 443, 8080 and 8443 are refused.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "maxFileSizeMb": {
            "title": "Maximum file size",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Largest PDF to download, in megabytes. A bigger file gets status TOO_LARGE and is free: the size is checked from the Content-Length header before downloading and enforced again while downloading. The default of 50 MB is tested with the default 256 MB of memory. Larger files are allowed up to 200 MB, but disk space is twice the run memory, so at 256 MB they are processed one at a time; start the run with more memory for batches of large files.",
            "default": 50
          },
          "maxPages": {
            "title": "Maximum pages per PDF",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum number of pages extracted from one PDF (counted after the page range, if one is set). PDFs with more pages are handled according to \"If a PDF has more pages\". Default 500. A higher limit costs the same per PDF but produces larger output and takes longer; very long or dense PDFs may need a run with more memory.",
            "default": 500
          },
          "pageLimitBehavior": {
            "title": "If a PDF has more pages",
            "enum": [
              "truncate",
              "skip"
            ],
            "type": "string",
            "description": "\"truncate\" (default) extracts the first maxPages pages, sets truncated to true and counts as a success (charged). \"skip\" extracts nothing from longer PDFs and reports status TOO_MANY_PAGES (free).",
            "default": "truncate"
          },
          "pageRange": {
            "title": "Page range",
            "type": "string",
            "description": "Optional. Extract only these pages from every PDF, for example \"1-5,8,12-\" (pages 1 to 5, page 8, and page 12 to the end). Pages are numbered from 1 by their position in the file. Leave empty to extract all pages. A PDF with none of these pages gets status NO_PAGES_IN_RANGE (free).",
            "default": ""
          },
          "includePageTexts": {
            "title": "Include per-page text",
            "type": "boolean",
            "description": "Add a pages array to each item: [{pageNumber, text, charCount, likelyScanned}], so text can be cited by page and scanned pages are visible. Turn off to roughly halve the item size when only the full text or the chunks are needed. No effect on price.",
            "default": true
          },
          "chunkSize": {
            "title": "Chunk size (0 = no chunks)",
            "minimum": 0,
            "maximum": 20000,
            "type": "integer",
            "description": "Maximum characters per chunk for RAG and embeddings. 0 (default) turns chunking off. When set (100 to 20000; typical 1000 to 8000, about 250 to 2000 tokens), each item gets a chunks array [{chunkIndex, text, charCount, pageStart, pageEnd}]. Chunks end at word boundaries and remember the pages they cover. No extra charge.",
            "default": 0
          },
          "chunkOverlap": {
            "title": "Chunk overlap",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Characters repeated from the end of one chunk at the start of the next, so sentences cut by a chunk boundary stay searchable. Used only when chunk size is above 0. Default 200; values above half the chunk size are reduced to half.",
            "default": 200
          },
          "password": {
            "title": "PDF password",
            "type": "string",
            "description": "Optional password for encrypted PDFs. It is tried on every PDF in the run that needs one and is stored encrypted. Leave empty for ordinary PDFs. An encrypted PDF without the right password gets status ENCRYPTED (free)."
          },
          "maxConcurrency": {
            "title": "PDFs in parallel",
            "minimum": 1,
            "maximum": 16,
            "type": "integer",
            "description": "How many PDFs are downloaded and extracted at the same time. The default of 2 suits the default 256 MB of memory. The Actor lowers this number by itself when the run's memory cannot hold that many (about 64 MB per PDF on top of about 110 MB for the Actor), so to go faster raise the run memory too, for example 8 with 1024 MB. With 1 the dataset rows are in input order.",
            "default": 2
          },
          "requestTimeoutSecs": {
            "title": "Download timeout",
            "minimum": 5,
            "maximum": 600,
            "type": "integer",
            "description": "Time limit for downloading one PDF, including redirects and up to two retries of temporary errors. When it expires the PDF gets status DOWNLOAD_FAILED (free). Default 60; raise it for large files on slow hosts.",
            "default": 60
          },
          "perDocumentTimeoutSecs": {
            "title": "Extraction timeout",
            "minimum": 10,
            "maximum": 1800,
            "type": "integer",
            "description": "Time limit for extracting the text of one PDF after it was downloaded. When it expires the extraction is stopped and the PDF gets status TIMEOUT (free). Default 120. CPU share follows run memory, so thousands of pages at 256 MB may need a higher limit or more memory.",
            "default": 120
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Optional proxy for the downloads. Default: no proxy (direct download), which is fastest and works for most public PDFs. Use Apify Proxy or your own proxy URLs only when a host refuses direct requests. The target URL is checked against the private-address rules either way.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}