Text extraction API: Extract text from PDFs and scans

Turn PDFs, scans, and Office files into clean text. Headings, lists, and tables come through as structure, not a jumble of lines, and understand mode keeps complex columns in reading order. Ready to index, search, or hand to an LLM or agent, and free to try with 5,000 credits each month.


Used by Lufthansa, Disney, Autodesk, UBS, Dropbox, IBM
Lufthansa
Disney
Autodesk
UBS
Dropbox
IBM

Try it live

See the extracted text on a sample document

Pick a sample document and compare the rendered and raw Markdown with the original page. To run it on your own PDF, open Parse Studio (a temporary workspace needs no signup). The playground processes the first 10 pages by default.


Beyond copy and paste

Why PDF text extraction is harder than it looks

A PDF stores text as positioned fragments, not as a story. Basic extractors read those fragments in storage order, and that’s where pipelines break:

Columns run together

Two-column pages turn into interleaved sentences. Nutrient’s understand mode returns reading order.

Tables flatten

Rows and cells collapse into one line of numbers. Nutrient keeps tables as structure, returned as HTML tables in the Markdown.

Headers and footers repeat

Page furniture shows up in every chunk. In spatial output, each paragraph carries a role — such as title, section header, caption, or footer — so a pipeline can filter page furniture out.

Text hides in images

Scanned pages and photos have no text layer. Nutrient’s OCR modes read them, in more than 100 languages.

Text in the order people read it

In understand mode, multicolumn layouts and tables come back in reading order, not in whatever order the PDF happens to store them.

Scans aren’t a special case

Structure, understand, and agentic modes run OCR on image-based pages in more than 100 languages, so a scanned contract and a digital report come back in the same shape.

Pay for the depth you need

One credit per page in text mode for born-digital PDFs. Step up to OCR modes only for the scans and complex layouts that need them.

Auditable output

Text your RAG pipeline and agents can trust

In spatial output, Nutrient returns every element with a confidence score, its bounds, and its page. Your retrieval, agents, and reviewers can check any value against the source page.

Three steps

How to extract text from a PDF

Every extraction is a single call to the Data Extraction API parse endpoint.

Get an API key

Create a free account for a key. In text mode, the free plan’s 5,000 monthly credits cover up to 5,000 born-digital pages.


Post the PDF to the parse endpoint

Use text mode for born-digital PDFs, or structure or understand mode for scans, with Markdown as the output format.


Read the text

The whole document comes back as one string in output.markdown, ready to save or send to the next step.

Try it out

This example extracts the text from a PDF with the Data Extraction API. The text comes back in output.markdown; the JavaScript, Java, C#, and PHP samples write it to result.md. The Python sample prints it, and the shell samples print the full JSON response.


  1. Save a PDF as document.pdf. Then run the sample from the same folder.
curl -X POST https://api.nutrient.io/extraction/parse \
-H "Authorization: Bearer your_api_key_goes_here" \
-F "file=@document.pdf" \
-F 'instructions={"mode":"text","output":{"format":"markdown"}}'

Example output

What the extracted text looks like

The text comes back in output.markdown as one string, with headings, lists, and tables kept as structure rather than flattened into one block.

Response
{
"status": 200,
"requestId": "GNw3M_7TfNWolS8ABHbx",
"output": {
"markdown": "# ACME Bank Credit Card Limit Application\n\n\n<table>\n <tr>\n <th>Limit Increase</th>\n <th>Limit Decrease</th>\n </tr>\n <tr>\n <td>Limit/Month Requested €</td>\n <td>Term Requested</td>\n </tr>\n <tr>\n <td>15,000.00</td>\n <td>18 months</td>\n </tr>\n</table>\n\n\n## Application Agreement\n\n\nEach Signer has read and agrees to all applicable provisions\r\non the reverse side of this Application (whether or not that\r\nreverse side is faxed back to ACME Bank), including the\r\ngranting of a security interest in deposit accounts, and\r\nunderstands that this Application may be approved or\r\ndenied. ACME Bank is authorized to obtain credit records\r\nand other credit and employment information about the\n\n\n<table>\n <tr>\n <th>Officer</th>\n <td>449-09-0000</td>\n <td>05/10/1989</td>\n </tr>\n <tr>\n <th>First Name<br/>Joanna R.</th>\n <td>Email</td>\n <td>Credit Card №</td>\n </tr>\n <tr>\n <th>Last Name<br/>Simonitti</th>\n <td>jo.simonitti89@gmail.com</td>\n <td>5500 0000 0000 0004</td>\n </tr>\n <tr>\n <th>Phone Address</th>\n <td>City</td>\n <td>ZIP Code</td>\n </tr>\n <tr>\n <th>+1 214 291 4003 313 Stone Avenue</th>\n <td>New York City, NY</td>\n <td>10001</td>\n </tr>\n <tr>\n <th>Vehicle ownership VIN number</th>\n <td>Gross Annual Income €</td>\n <td>Net Worth €</td>\n </tr>\n <tr>\n <th>Yes, Ford Sedan JN8AZ1MU4CW113789</th>\n <td>328,000.00</td>\n <td>3,029,028.00</td>\n </tr>\n</table>\n\n\nSigners personally (now and in the future), including from\r\nstate and federal tax authorities, for deciding whether to\r\napprove the requested limit.\n\n\n## Applicant Information\n\n\n## Terms and Conditions\n\n\nSignature of Applicant\n\n\nSocial Security Number\n\n\nAs reported on last Tax Return\n\n\nDate of Birth\n\n\nExcluding business assets\n\n\nBy signing below, Signer agrees to be personally responsible for any credit\r\ngranted pursuant to this Application. For ACME Bank Cash Flow Manager and ACME\r\nBank Guaranteed Cash Flow Manager Lines of Credit, this Application constitutes\r\nGuaranty under which the individual signing is a Guarantor, and individually\r\nguarantees the payment of all present and future obligations of the Business to\r\nACME Bank in accordance with the provisions on the reverse side and the Terms and\r\nConditions and Letter Agreement governing such Line of Credit.\n\n\nDate of Signature\n\n\nPage 1/1\n\n\nhttps://www.pspdfkit.com"
},
"metrics": {
"pagesProcessed": 1,
"processingTimeMs": 304
},
"usage": {
"data_extraction_credits": {
"cost": 1.0,
"remainingCredits": 504999.0
}
},
"configuration": {
"apiVersion": "2026-05-25",
"engine": {},
"mode": "text",
"outputFormat": "markdown"
}
}

OCR built in

Extract text from scanned PDFs and images

Scanned PDFs and photos have no text layer, so text mode returns nothing for them. Switch to an OCR mode and the same call reads the page. OCR covers more than 100 languages, detected automatically or set per request with options.language — see the supported languages.

Mode Credits per page OCR Use it for
Text
1
No
Born-digital PDFs with a clean text layer; the fastest, cheapest route
Structure
1.5
Yes
Straightforward scans, with word-level bounds and confidence
Understand
9
Yes
Tables, forms, multicolumn layouts, formulas, and printed handwriting
Agentic
18
Yes
Cursive handwriting, faxes, degraded scans, and low-quality images

Text, structure, or specific fields: One API

Most pipelines start with text and grow from there. The same Data Extraction API returns:

Text

As Markdown, for search indexes, RAG, and LLM prompts.

Structure

As spatial JSON, where every element carries its type, bounds, confidence, and page. See the PDF-to-JSON API.

Specific fields

Mapped to your own JSON Schema through the extract endpoint, each with a citation. See the Data Extraction API.

Kiran Kaza
Head of Mobile Engineering
“Our team can focus on implementing the features specific to the DocuSign business domain while leaving the handling of PDFs to the experts.”
DocuSign

Security is our top priority

SOC 2 Type 2 audited

Nutrient is SOC 2 Type 2 audited annually. See the security documentation and privacy documentation for details on data handling.

HTTPS encryption

All API communication uses HTTPS with TLS encryption. Unencrypted HTTP requests are rejected.

Start free

5,000 free Data Extraction credits every month

Text mode costs 1 credit per page, so the free plan covers up to 5,000 born-digital pages a month.

Start free:

    • 5,000 Data Extraction credits per month
    • No credit card required
    • OCR modes for scans and images

Frequently asked questions

What is a text extraction API?

Nutrient’s text extraction API is a REST endpoint that reads a PDF, scan, or Office file and returns its text as clean Markdown. It’s part of the Data Extraction API, so the same call can also return structure or specific fields when a pipeline needs more than text.

How do I extract text from a PDF programmatically?

Nutrient extracts text in one request. Post the PDF to the Data Extraction API parse endpoint with a mode and Markdown output. Then read the text from output.markdown in the JSON response. This page has samples in shell, Windows shell, Python, JavaScript, Java, C#, and PHP.

How do I extract text from a scanned PDF or an image?

Nutrient reads scanned PDFs and images with OCR: Send the file with structure, understand, or agentic mode instead of text mode. Text mode reads only born-digital PDFs, while the OCR modes cover more than 100 languages.

Can it extract handwritten text from a PDF?

Yes, Nutrient’s understand mode reads printed handwriting, and agentic mode reads cursive and freeform handwriting, including on degraded scans and faxes.

Does it keep the reading order of multicolumn pages?

Yes, Nutrient returns text in reading order in understand mode, so columns and tables don’t run together. Use understand mode for complex multicolumn layouts. Structure mode can miss multicolumn relationships.

Can’t I just send the PDF to ChatGPT or another LLM?

Nutrient is built for when the answer has to be reliable at scale. Nutrient returns the full text of every page, with reading order, confidence, and page context in spatial output, as part of an auditable pipeline.

Can I get plain text instead of Markdown?

Nutrient’s Data Extraction API returns Markdown, which reads as plain text with light formatting for headings, lists, and tables. The whole document comes back as one string in output.markdown.

Is there a free PDF-to-text API?

Yes, Nutrient’s Data Extraction API free plan includes 5,000 credits each month, with no credit card required. Text mode costs 1 credit per page, so that’s up to 5,000 born-digital pages a month. See Data Extraction API pricing.

What file types does it accept?

Nutrient’s Data Extraction API accepts PDFs (digital, scanned, and image-based), images, and Office files, including Word, Excel, and PowerPoint.

Ready to try it?

Create an account to get your Data Extraction API key and start making API calls.