{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF Text Extractor — Markdown, Per-Page Text, Tables, OCR & RAG",
    "description": "Turn any PDF (URL or upload) into clean data: full text, LLM-ready Markdown, per-page text, tables, RAG chunks, metadata and a READY_FOR_RAG / NEEDS_OCR verdict. OCR for scanned pages in 7 languages, page ranges, header/footer removal, passwords, change detection. $0.05 per PDF; failures free.",
    "version": "0.1",
    "x-build-id": "kkjSUsZLWYWc4t5Ap"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/nexgenwatch~pdf-text-intake-auditor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-nexgenwatch-pdf-text-intake-auditor",
        "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/nexgenwatch~pdf-text-intake-auditor/runs": {
      "post": {
        "operationId": "runs-sync-nexgenwatch-pdf-text-intake-auditor",
        "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/nexgenwatch~pdf-text-intake-auditor/run-sync": {
      "post": {
        "operationId": "run-sync-nexgenwatch-pdf-text-intake-auditor",
        "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 URLs",
            "type": "array",
            "description": "Direct links to PDF files (redirects followed). Downloaded through a public-host and robots.txt check. Also accepted as `pdfUrls`, `startUrls` ({url}) or one `pdfUrl`.",
            "items": {
              "type": "string"
            }
          },
          "files": {
            "title": "PDF files (base64 or key-value-store keys)",
            "type": "array",
            "description": "Locally-supplied PDFs — each item is a base64 data string (optionally a data: URL) or a key naming an entry in the run's key-value store. Per file: text-layer presence, page count, encryption, scan likelihood, per-page text density, document metadata, SHA-256, warnings, and a READY_FOR_RAG / NEEDS_OCR / REJECT verdict. A completed verdict bills; an unreadable/oversized/rejected file is delivered unbilled. Untrusted-file guards: size + page caps, decompression-bomb guard, no macro/JS execution.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "password": {
            "title": "PDF password",
            "type": "string",
            "description": "Password for protected PDFs; tried on every document that needs one. Leave empty for normal PDFs."
          },
          "pageRange": {
            "title": "Page range",
            "type": "string",
            "description": "Extract only these pages, e.g. `1-5, 8, 12-` (`12-` = page 12 to the end). Empty = all pages (up to Max pages)."
          },
          "includeFullText": {
            "title": "Include full text",
            "type": "boolean",
            "description": "The complete plain text of the document in `text`.",
            "default": true
          },
          "includeMarkdown": {
            "title": "Include Markdown",
            "type": "boolean",
            "description": "A Markdown rendition in `markdown`: headings (from font size), bullets and paragraphs rebuilt from the layout — LLM/RAG ready.",
            "default": true
          },
          "includePerPageText": {
            "title": "Include per-page text",
            "type": "boolean",
            "description": "A `pages` array with the text of each page. Turn off to keep rows small for long PDFs.",
            "default": true
          },
          "extractTables": {
            "title": "Extract tables",
            "type": "boolean",
            "description": "Detect tables on each page and return them as rows of cells in `tables`. Slower on complex layouts.",
            "default": false
          },
          "ocrScannedPages": {
            "title": "OCR scanned pages",
            "type": "boolean",
            "description": "When a page has no usable text layer (scanned / image-only), render it and run Tesseract OCR to recover the text. Slower; the row says how many pages were OCR'd.",
            "default": false
          },
          "ocrLanguage": {
            "title": "OCR language",
            "enum": [
              "eng",
              "deu",
              "fra",
              "spa",
              "por",
              "ita",
              "nld",
              "eng+deu",
              "eng+fra",
              "eng+spa"
            ],
            "type": "string",
            "description": "Language of the scanned pages for OCR.",
            "default": "eng"
          },
          "ocrMaxPagesPerPdf": {
            "title": "Max OCR pages per PDF",
            "minimum": 1,
            "maximum": 300,
            "type": "integer",
            "description": "Upper bound on pages sent to OCR within one PDF; the row is flagged `ocr_capped` when reached.",
            "default": 20
          },
          "removeHeaderFooter": {
            "title": "Remove repeated headers/footers",
            "type": "boolean",
            "description": "Drop lines that repeat on 30% or more of the pages (running titles, company names).",
            "default": false
          },
          "removePageNumbers": {
            "title": "Remove page-number lines",
            "type": "boolean",
            "description": "Drop lines that are only a page number (`42`, `Page 3 of 10`, `- 5 -`).",
            "default": false
          },
          "ragChunks": {
            "title": "RAG chunks",
            "type": "boolean",
            "description": "Also split the text into overlapping chunks (`chunks`) at paragraph/sentence boundaries, ready for embedding.",
            "default": false
          },
          "chunkSize": {
            "title": "Chunk size (characters)",
            "minimum": 200,
            "maximum": 20000,
            "type": "integer",
            "description": "Target characters per chunk (about 500 tokens at 4 chars/token).",
            "default": 2000
          },
          "chunkOverlap": {
            "title": "Chunk overlap (characters)",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Characters shared between consecutive chunks.",
            "default": 200
          },
          "changeDetection": {
            "title": "Change detection",
            "type": "boolean",
            "description": "Hash each PDF's text and compare with the previous run (stored in a named key-value store). Rows get `changed: true/false` (null on first sight).",
            "default": false
          },
          "changedOnly": {
            "title": "Deliver changed PDFs only",
            "type": "boolean",
            "description": "With change detection on, skip (and do not bill) PDFs whose text did not change since the last run.",
            "default": false
          },
          "maxBytes": {
            "title": "Max file bytes",
            "minimum": 1024,
            "maximum": 104857600,
            "type": "integer",
            "description": "Reject files larger than this (decompression-bomb guard).",
            "default": 26214400
          },
          "maxPages": {
            "title": "Max pages inspected",
            "minimum": 1,
            "maximum": 3000,
            "type": "integer",
            "description": "Cap pages walked for density.",
            "default": 300
          },
          "timeoutPerPdfSecs": {
            "title": "Download timeout per PDF (seconds)",
            "minimum": 10,
            "maximum": 300,
            "type": "integer",
            "description": "Raise for very large files or slow hosts.",
            "default": 60
          },
          "userAgent": {
            "title": "User agent",
            "type": "string",
            "description": "Override the transparent crawler UA."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}