NewAPIVerve Academy: free courses and certifications anyone can verify.Explore the Academy →

PDF to Text API

POST

Pull the text out of any PDF, with page and word counts.

PDF to Text extracts the text layer of a PDF, uploaded or fetched from a URL, and returns it as plain text with the page, word and character counts. Paid plans add the text of each page separately and the document metadata, such as title, author and creation date.

Try it — live request, no key required

Request
POSTapi.apiverve.com/v1/pdftotext
pdf
Click or drag a file to upload.pdf · max 400KB for live testing
Verification
Format

No key required to try it. Get a key to use it in your app.

Example
{
  "status": "ok",
  "error": null,
  "data": {
    "text": "Table Of Content\nChapter 1 .......................................................... 2\nParagraph 1.1 ...................................................... 3\npage 1 / 3\n\nChapter 1\npage 2 / 3\n\nParagraph 1.1\nPowered by TCPDF (www.tcpdf.org)\npage 3 / 3",
    "pageCount": 3,
    "pagesExtracted": 3,
    "truncated": false,
    "hasText": true,
    "wordCount": 31,
    "characterCount": 250,
    "pages": [
      {
        "page": 1,
        "text": "Table Of Content\nChapter 1 .......................................................... 2\nParagraph 1.1 ...................................................... 3\npage 1 / 3",
        "wordCount": 15
      },
      {
        "page": 2,
        "text": "Chapter 1\npage 2 / 3",
        "wordCount": 6
      },
      {
        "page": 3,
        "text": "Paragraph 1.1\nPowered by TCPDF (www.tcpdf.org)\npage 3 / 3",
        "wordCount": 10
      }
    ],
    "metadata": {
      "title": "Basic API Test",
      "author": "Brendan Dahl",
      "subject": null,
      "creator": "pdf.js",
      "producer": "TCPDF 5.9.133 (http://www.tcpdf.org)",
      "creationDate": "2012-04-10T21:30:26.000Z",
      "modificationDate": "2012-04-10T21:30:26.000Z",
      "pdfVersion": "1.7"
    }
  }
}

About the PDF to Text API

A PDF to text API for pulling the text out of a PDF without running a parser yourself. Upload a file up to 10 MB or send a public PDF URL, and get the content back as plain text, pages separated by a blank line, with the page count, word count and character count. It fits search indexing, feeding documents into an AI or retrieval pipeline, invoice and contract processing, and quick checks of what a PDF actually contains.

Up to 100 pages are read per call; longer documents report their full page count and are flagged as truncated. Scanned PDFs have no text layer and are flagged as having no text, because no OCR is performed. That also makes the API a cheap way to sort scanned documents from digital ones before sending only the scans to OCR.

The Free plan returns the combined text and the counts. Paid plans add the text of each page separately with its own word count, so you can cite or chunk by page, and the PDF metadata: title, author, subject, creating and producing applications, creation and modification dates and PDF version.

How it works

Extraction runs on unpdf, a serverless build of Mozilla's pdf.js. For each page the text items are joined in the order pdf.js reports them: an item that ends a line adds a line break, and otherwise a space is added unless the item already ends in whitespace. Runs of spaces are collapsed, spaces before a line break are removed and the page text is trimmed. This is the content order stored in the file, which for most documents is reading order but can interleave columns in some layouts.

Send the file as a multipart upload or base64 in pdf, or a public URL in pdf or url. A link without a scheme gets https:// added, GitHub /blob/ links, Google Drive /file/d/ links and Dropbox ?dl=0 links are rewritten to their direct-download form, and a URL that returns a web page instead of a PDF gets a 400 saying so. The file must carry a %PDF- header in its first kilobyte. Files over 10 MB return 413, a password-protected PDF returns 400 asking for the password to be removed, and a file pdf.js cannot open returns 400.

Only the first 100 pages are read. pageCount is the full count from the file, pagesExtracted the number read, and truncated is true when they differ. text joins the pages with a blank line and is trimmed; characterCount is its length and wordCount sums each page's count of whitespace-separated tokens. hasText is false when the joined text is empty, which is what a scanned PDF with no text layer produces.

On paid plans pages holds {page, text, wordCount} for each page read, and metadata comes from the PDF's information dictionary, with null for any missing entry. PDF dates such as D:20240115103000+01'00' are converted to ISO 8601 in UTC, and pdfVersion is the format version, such as 1.7. On the Free plan pages and metadata are null.

What people use it for

Search Indexing
Index the text of uploaded PDFs so users can search inside documents, not just their titles.
AI and RAG Pipelines
Feed PDF text, page by page, into embeddings or a language model for question answering over documents.
Document Intake
Read invoices, statements and forms as text for downstream parsing and validation.
Content Moderation
Check the text of uploaded PDFs against your policies before they are published.

Ways to call it

One endpoint, many ways in — REST with JSON, XML, YAML and CSV, plus GraphQL and an MCP interface for AI agents.

JSON
Default REST response
XML
Markup format
YAML
Human-readable
CSV
Tabular export
Beta
GraphQL
Query language
New
MCP
For AI agents

Other ways to use PDF to Text

Same data, same APIVerve account, same credit balance — one key works on all of them.

Questions.

Common questions about the PDF to Text API.

Read the docs →
How many PDFs does the Starter plan cover?
Starter covers 20,000 PDF extractions each month. At 10 credits per request, that works out to $1.50 per 1,000 PDFs, or about $0.0015 per PDF. The Free plan includes 20 extractions per month for testing.
What does the Free plan return?
The Free plan returns the full extracted text, the page count, the pages read, the truncated and hasText flags and the word and character counts. Paid plans add pages, the text and word count of each page, and metadata such as the title, author, producer and creation date.
How large a PDF can I send?
Up to 10 MB per PDF, uploaded or by URL, with 400 KB uploads on the Free plan. The first 100 pages are read; for longer documents pageCount gives the full length and truncated is true.
Does it work on scanned PDFs?
No OCR is performed. A scanned PDF has no text layer, so it returns hasText false and empty text. Use the Image to Text API on the page images for scanned documents.
How is the text extracted?
With Mozilla's pdf.js, the engine behind Firefox's PDF viewer, which reads the text in content order and keeps line breaks. Pages are separated by a blank line in text.

Ready to build with PDF to Text? Start with 200 free credits — one key unlocks all 406+ APIs.

Explore the catalog

406+ APIs on the same key and the same response shape.

Browse all APIs