# PDF to Text API

> 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.

**Endpoint:** `POST https://api.apiverve.com/v1/pdftotext`  
**Category:** Documents  
**Cost:** 10 credits per call  
**Canonical page:** https://apiverve.com/marketplace/pdftotext

## Overview

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.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl -X POST "https://api.apiverve.com/v1/pdftotext" \
  -H "x-api-key: YOUR_API_KEY" \
  -F "pdf=@document.pdf"
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `pdf` | string | No | The PDF file to read (up to 10 MB), or a public PDF URL. GitHub, Google Drive and Dropbox share links are turned into their direct download, and a missing https:// is added |

## Response fields

- `text` — string · The extracted text, pages separated by a blank line
- `pageCount` — number · Total pages in the PDF
- `pagesExtracted` — number · Pages read (at most 100)
- `truncated` — boolean · True when the PDF has more pages than were read
- `hasText` — boolean · False when no text layer was found, as in a scanned PDF
- `wordCount` — number · Words in the extracted text
- `characterCount` — number · Characters in the extracted text
  - `pages.0.page` — number · Page number · (premium)
  - `pages.0.text` — string · Text of the page · (premium)
  - `pages.0.wordCount` — number · Words on the page · (premium)
- `metadata` — object · Document information from the PDF · (premium)
  - `metadata.title` — string · Document title, or null · (premium)
  - `metadata.author` — string · Author, or null · (premium)
  - `metadata.subject` — object · Subject, or null · (premium)
  - `metadata.creator` — string · Application that created the original document, or null · (premium)
  - `metadata.producer` — string · Application that produced the PDF, or null · (premium)
  - `metadata.creationDate` — string · Creation date (ISO 8601), or null · (premium)
  - `metadata.modificationDate` — string · Last modification date (ISO 8601), or null · (premium)
  - `metadata.pdfVersion` — string · PDF format version, such as 1.7 · (premium)

## Sample response

```json
{
  "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"
    }
  }
}
```

## Use cases

- **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.

## More

- Full reference: https://docs.apiverve.com/ref/pdftotext
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
