{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF to Text Extractor - PDF Parser, PDF to Markdown & OCR",
    "description": "Extract text from PDF URLs, uploads or base64 with this PDF extractor: Markdown, tables, OCR in 126 languages, page-cited RAG chunks for LLMs and proxy fallback. Follows article and landing pages to PDFs via citation metadata or arXiv patterns; unresolved HTML has no extraction charge.",
    "version": "1.18",
    "x-build-id": "HsMrItMh9dU0GM8qX"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/gochujang~pdf-text-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-gochujang-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/gochujang~pdf-text-extractor/runs": {
      "post": {
        "operationId": "runs-sync-gochujang-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/gochujang~pdf-text-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-gochujang-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 URLs",
            "type": "array",
            "description": "Public PDF URLs for PDF to text extraction or PDF to Markdown conversion. For a quick one-page test, use https://pdfobject.com/pdf/sample.pdf. Article and landing pages are followed to their PDF using citation_pdf_url, alternate PDF links, then arXiv patterns (one resolution hop plus redirects, including DOI redirects). Unresolved HTML yields an uncharged NOT_A_PDF error row.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "url": {
            "title": "Single PDF URL (shortcut)",
            "type": "string",
            "description": "Single public PDF URL, used when urls is empty; for example https://pdfobject.com/pdf/sample.pdf.",
            "default": ""
          },
          "pdfFile": {
            "title": "Upload a PDF file",
            "type": "string",
            "description": "Upload a PDF from your computer instead of giving a URL. Apify stores the file and passes its URL to the actor; it is processed together with any URLs above."
          },
          "base64Pdfs": {
            "title": "Base64-encoded PDFs",
            "type": "array",
            "description": "List of base64-encoded PDF files to process directly (no download needed). Each item can be a plain base64 string, or an object with 'data' (base64 string) and optional 'filename'. Ideal for programmatic use: encode any PDF file with base64 and pass it here.",
            "default": []
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "markdown",
              "per_page",
              "combined",
              "both",
              "rag_chunks"
            ],
            "type": "string",
            "description": "PDF parser output: markdown gives an LLM-ready PDF to Markdown document (default). per_page returns one record per page; combined returns full text; both returns both; rag_chunks splits text into overlapping chunks with page citations (page_start, page_end, citation_url) and heading_path. Agent (MCP) runs get the markdown in parts of at most 45 KB (part, partCount) plus markdown_preview.",
            "default": "markdown"
          },
          "pageRange": {
            "title": "Page range",
            "type": "string",
            "description": "Pages to extract, for example 1-3,7,10- (10- means page 10 to the end). When set, it replaces startPage, endPage, maxPages, firstNPages and lastNPages. Leave empty to use those fields."
          },
          "maxPages": {
            "title": "Max pages per PDF",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Stop after this many pages per PDF (from startPage). Ignored if endPage is set. Range 1–1000. Default 100.",
            "default": 100
          },
          "enableOcr": {
            "title": "Enable OCR for scanned pages",
            "type": "boolean",
            "description": "When enabled, pages with little or no extractable text (under 50 characters) are reprocessed with Tesseract OCR. Use for scanned PDFs; it increases processing time.",
            "default": false
          },
          "ocrLanguage": {
            "title": "OCR Language",
            "type": "string",
            "description": "Tesseract language code for OCR of scanned pages: any of the 126 tessdata_fast codes, e.g. 'eng' (English, default), 'deu', 'ara', 'rus', 'hin', 'chi_tra'. Combine with '+': 'eng+ara'. eng, deu, fra, spa, kor, jpn and chi_sim are built in; any other pack is downloaded once per run. An unknown code or a failed download gives one free error row and the PDFs are still processed.",
            "default": "eng"
          },
          "extractTables": {
            "title": "Extract tables",
            "type": "boolean",
            "description": "Detect and extract tables per page (as 2D arrays). Disabled by default — enabling this on complex PDFs significantly increases processing time and memory usage.",
            "default": false
          },
          "password": {
            "title": "PDF password",
            "type": "string",
            "description": "Password for password-protected / encrypted PDFs. Applied to all URLs in this run. Leave empty for public PDFs."
          },
          "chunkSize": {
            "title": "RAG chunk size (chars)",
            "minimum": 200,
            "maximum": 10000,
            "type": "integer",
            "description": "Only used when outputFormat=rag_chunks. Target character count per chunk (≈ 500 tokens at 4 chars/token). Default: 2000. Range 200–10000.",
            "default": 2000
          },
          "chunkOverlap": {
            "title": "RAG chunk overlap (chars)",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "Only used when outputFormat=rag_chunks. Characters of overlap between consecutive chunks for context continuity. Default: 200. Range 0–1000.",
            "default": 200
          },
          "removeHeaderFooter": {
            "title": "Remove repeated headers/footers",
            "type": "boolean",
            "description": "Detect and remove text lines that repeat across ≥30% of pages (typical headers/footers like company name, page count, document title). Applied to combined/markdown output.",
            "default": false
          },
          "removePageNumbers": {
            "title": "Remove page number lines",
            "type": "boolean",
            "description": "Strip lines that contain only a page number (e.g. '42', 'Page 3 of 10', '- 5 -'). Applied to all output formats.",
            "default": false
          },
          "skipEmptyPages": {
            "title": "Skip empty pages",
            "type": "boolean",
            "description": "Skip pages with no extractable text. Useful for mixed PDFs where some pages are blank or image-only (combine with enableOcr for best results).",
            "default": false
          },
          "timeoutPerPdfSecs": {
            "title": "Timeout per PDF (seconds)",
            "minimum": 0,
            "maximum": 3600,
            "type": "integer",
            "description": "Give up on a single PDF (download plus extraction) after this many seconds. That PDF gets an error row and the run continues with the others. 0 (default) means no per-PDF limit. Range 0–3600.",
            "default": 0
          },
          "maxConcurrency": {
            "title": "Parallel PDFs",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many PDFs to process at the same time (default 5). It is lowered automatically when that many PDFs of maxPdfMb would not fit in the run's memory. Set 1 to process them one after another, in input order; with higher values output rows from different PDFs may interleave. Range 1–10.",
            "default": 5
          },
          "proxyFallback": {
            "title": "Automatic proxy fallback",
            "type": "boolean",
            "description": "Download directly first; if the host answers HTTP 401/403/407/429 or the connection fails, retry once through Apify Proxy. No extra charge. Ignored when a proxy is set above.",
            "default": true
          },
          "statementLedger": {
            "title": "Bank & card statement ledger (beta)",
            "type": "boolean",
            "description": "Parse bank/credit-card statements into a transaction ledger",
            "default": false
          },
          "chunkStrategy": {
            "title": "RAG chunk strategy",
            "enum": [
              "chars",
              "headings"
            ],
            "type": "string",
            "description": "Only used when outputFormat=rag_chunks. chars (default): sliding window of chunkSize characters with chunkOverlap. headings: chunks never cross a detected H1/H2 heading (sections stay whole, still capped at chunkSize). Every chunk carries page_start, page_end, citation_url (#page=N), heading_path and token_estimate.",
            "default": "chars"
          },
          "startPage": {
            "title": "Start page",
            "minimum": 1,
            "type": "integer",
            "description": "(legacy; prefer pageRange) First page to extract (1-indexed). Default = 1. Minimum 1.",
            "default": 1
          },
          "endPage": {
            "title": "End page",
            "minimum": 1,
            "type": "integer",
            "description": "(legacy) Last page to extract (inclusive). Leave empty to use maxPages. Minimum 1."
          },
          "maxPdfMb": {
            "title": "Max PDF size (MB)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Reject PDFs larger than this size in megabytes (default 100). Parallel PDFs are lowered automatically when this many megabytes per PDF would not fit in the run's memory. Range 1–500.",
            "default": 100
          },
          "removeExcessBlankLines": {
            "title": "Remove excessive blank lines",
            "type": "boolean",
            "description": "Collapse 3 or more consecutive blank lines to a maximum of 2. Reduces whitespace noise in multi-column PDFs.",
            "default": false
          },
          "ocrMaxPagesPerPdf": {
            "title": "Max OCR pages per PDF",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "Stop OCR after this many pages in each PDF to cap processing time. Pages past the cap keep their non-OCR text and the summary row notes the cap (ocr_capped, ocr_pages_skipped). 0 (default) means no cap. Range 0–1000.",
            "default": 0
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional proxy for every PDF download. Usually not needed: with automatic proxy fallback on, a direct download that gets HTTP 401/403/407/429 or a connection failure is retried once through Apify Proxy, at no extra charge. Set a proxy here (residential recommended) only for hosts that block the fallback too.",
            "default": {}
          },
          "urlsText": {
            "title": "PDF URLs (paste, one per line)",
            "type": "string",
            "description": "(legacy) Alternative to the URLs list above — paste multiple PDF URLs, one per line. Merged with 'urls' if both are provided.",
            "default": ""
          },
          "changeDetection": {
            "title": "Change detection (for scheduled monitoring)",
            "type": "boolean",
            "description": "Compute a content hash of each PDF's extracted text and compare it to the previous run (stored in the Actor's Key-Value Store). Every output record gets a 'changed' field (true/false) and 'content_hash'. Ideal for scheduling: run daily/weekly and only act when 'changed': true. On the first run everything is 'changed': true.",
            "default": false
          },
          "webhookUrl": {
            "title": "Webhook URL (notify on change)",
            "type": "string",
            "description": "When changeDetection=true, POST a JSON notification to this URL whenever a PDF's content changes. Payload includes url, content_hash, page_count, word_count, title, and detected_at. Works with Slack, Discord, Make, Zapier, n8n, or any HTTP endpoint. Leave empty to disable.",
            "default": ""
          },
          "changedOnly": {
            "title": "Output changed PDFs only",
            "type": "boolean",
            "description": "Requires changeDetection=true. When enabled, skip all output records (pages, chunks, markdown) for PDFs that have NOT changed since the last run. Only PDFs where changed=true produce output. Makes scheduled runs noise-free — zero records when nothing changed.",
            "default": false
          },
          "autoSummarize": {
            "title": "Auto-summarize document",
            "type": "boolean",
            "description": "When enabled, appends an 'auto_summary' field to the final summary record. Includes: top 10 most frequent meaningful words and the first sentence of each paragraph (naive section detection). Uses Python built-ins — no AI API needed.",
            "default": false
          },
          "userAgent": {
            "title": "User-Agent",
            "type": "string",
            "description": "Custom UA string for the HTTP request.",
            "default": ""
          },
          "extractImages": {
            "title": "Count images per page",
            "type": "boolean",
            "description": "Add image_count field to each page record.",
            "default": false
          },
          "firstNPages": {
            "title": "First N pages only",
            "minimum": 1,
            "type": "integer",
            "description": "(legacy) Extract only the first N pages of the document. Combine with lastNPages to extract a summary (front + back). Leave empty to use startPage/endPage/maxPages."
          },
          "lastNPages": {
            "title": "Last N pages only",
            "minimum": 1,
            "type": "integer",
            "description": "(legacy) Extract only the last N pages of the document. Combine with firstNPages to get a document summary. Leave empty to disable."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}