PDF OCR API for text and searchable PDFs
Send a scanned PDF, get plain text or a searchable PDF back. One REST API, 100+ languages, files up to 1 GiB.
PDF to text API
One endpoint family on an asynchronous 5-step REST pipeline. Need the PDF itself searchable? See the searchable PDF API.
Document OCR API
/v1/documents
Designed for scanned books, contracts, receipts, invoices, and multi-lingual records delivered as PDF files or images. Preserves logical reading order and columns.
format=text) and dual-layer searchable PDF with invisible text layer overlay (format=pdf).Bank Statement API
/v1/bank-statements
Send a bank statement PDF or scan and get the transactions back as JSON, CSV, Excel (XLSX), QuickBooks QBO, QuickBooks CSV, QFX and OFX, with a balance check on every account. Create the statement, upload the file, then poll until it is completed: that response carries the download links.
Same statement pages as the website. 50 free statement pages, then Bank Statement Packs from $4.99 for 100 pages.
Multilingual
Multilingual PDF OCR API: right-to-left and CJK searchable PDFs
The API reads 100+ languages and detects the language itself, so one endpoint handles a Hebrew contract, an Urdu book and a Japanese scan. The hard part of a multilingual searchable PDF is the invisible text layer: it has to copy and search correctly in a PDF viewer, not just contain the right characters.
- Right-to-left text (Arabic, Persian, Urdu, Hebrew) is drawn in the visual order viewers expect, and Arabic-script digits copy out in the right order.
- Chinese, Japanese and Korean text uses CJK fonts in the layer, so it copies out as text, not empty boxes.
- Columns read in order. On pages with columns, including right-to-left newspapers, the text layer keeps each column together, so selecting down one column jumps into the next far less often.
One limit: Chrome's built-in PDF viewer can scramble Latin words and brackets inside a right-to-left line, as it does on born-digital Arabic and Hebrew PDFs. macOS Preview copies those lines correctly.
Language pages: Arabic, Urdu, Persian, Hebrew, Chinese, Japanese, Korean.
| Test page | Before | Now |
|---|---|---|
| Persian newspaper, three right-to-left columns | 78 | 32 |
| Hebrew newspaper, two right-to-left columns | 38 | 7 |
| All 24 test pages (newspapers, forms, tables, Persian, Hebrew, Urdu, vertical Chinese) | 675 | 96 |
API Quickstart
Python SDK, Node.js and cURL examples for the Document OCR endpoints. More on the Python SDK.
# Install first: pip install fastocr-sdk
from fastocr_sdk import FastOCR
# Reads the key from the FASTOCR_API_KEY environment variable.
with FastOCR() as client:
text = client.extract_text("scan.pdf")
print(text)// Node.js 18+, no dependencies. Save as quickstart.mjs and run: node quickstart.mjs
import { readFile, writeFile } from 'node:fs/promises';
import { randomUUID } from 'node:crypto';
const BASE = 'https://api.fastocr.org';
const auth = { Authorization: `Bearer ${process.env.FASTOCR_API_KEY}` };
async function api(path, init = {}) {
const response = await fetch(BASE + path, { ...init, headers: { ...auth, ...init.headers } });
const body = await response.json();
if (!response.ok) throw new Error(`${response.status} ${body.error?.code ?? body.message}`);
return body;
}
const pdf = await readFile('scan.pdf');
// 1. Create a document
const created = await api('/v1/documents', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Idempotency-Key': randomUUID() },
body: JSON.stringify({ filename: 'scan.pdf', size_bytes: pdf.length }),
});
// 2. Upload the file to the presigned URL
const upload = await fetch(created.upload_url, {
method: 'PUT',
headers: { 'Content-Type': 'application/pdf' },
body: pdf,
});
if (!upload.ok) throw new Error(`Upload failed: ${upload.status}`);
// 3. Start processing
await api(`/v1/documents/${created.id}/start`, { method: 'POST' });
// 4. Poll until the status is completed, partial, or failed
let document;
do {
await new Promise((resolve) => setTimeout(resolve, 2000));
document = await api(`/v1/documents/${created.id}`);
} while (!['completed', 'partial', 'failed'].includes(document.status));
if (document.status === 'failed') throw new Error(document.error.code);
// 5. Get the download link, then download the text
const output = await api(`/v1/documents/${created.id}/output?format=text`);
await writeFile('result.txt', await (await fetch(output.url)).text());
console.log(document.status, document.pages_billed);export FASTOCR_API_KEY="your_api_key"
# 1. Create a document
RESPONSE=$(curl -sS --fail-with-body -X POST https://api.fastocr.org/v1/documents \
-H "Authorization: Bearer $FASTOCR_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"filename":"scan.pdf","size_bytes":'$(wc -c < scan.pdf | tr -d ' ')'}')
DOCUMENT_ID=$(echo "$RESPONSE" | jq -r .id)
UPLOAD_URL=$(echo "$RESPONSE" | jq -r .upload_url)
# 2. Upload the file to the presigned URL
curl -sS --fail-with-body -X PUT "$UPLOAD_URL" \
-H "Content-Type: application/pdf" \
--data-binary @scan.pdf
# 3. Start processing
curl -sS --fail-with-body -X POST https://api.fastocr.org/v1/documents/$DOCUMENT_ID/start \
-H "Authorization: Bearer $FASTOCR_API_KEY"
# 4. Poll until the status is completed, partial, or failed
while true; do
BODY=$(curl -sS --fail-with-body https://api.fastocr.org/v1/documents/$DOCUMENT_ID \
-H "Authorization: Bearer $FASTOCR_API_KEY") || exit 1
STATUS=$(echo "$BODY" | jq -r .status)
case "$STATUS" in completed|partial|failed) break;; esac
sleep 2
done
echo "Final status: $STATUS"
# 5. Get the download link, then download the text (a failed document has no output)
RESULT_URL=$(curl -sS --fail-with-body "https://api.fastocr.org/v1/documents/$DOCUMENT_ID/output?format=text" \
-H "Authorization: Bearer $FASTOCR_API_KEY" | jq -r .url)
curl -sS --fail-with-body "$RESULT_URL" -o result.txthttps://api.fastocr.org/v1The 5-Step REST Architecture
To handle large files without browser timeouts or proxy payload caps, the Document OCR API uses an asynchronous workflow.
Create Document
POST to /v1/documents with filename and file size to receive a document ID and presigned S3 URL.
Upload File
PUT file bytes directly to the presigned S3 upload URL. No gateway payload bottlenecks.
Start Processing
POST to /start on your document ID to begin OCR once the upload is complete.
Poll Status
GET the document until its status is completed, partial, or failed.
Download Output
GET /output with your desired format (text or pdf) for a one-hour download link.
Start in three steps
Any signed-in FastOCR account can create an API key and start right away. The Free plan includes 20 free pages per month, shared with PDFs on the website. Paid plans share their Document OCR allowance with the API too.
- 1
Create a key
Sign in and create an API key in the developer console. You accept the API terms with your first key.
- 3
Buy pages when you need more
When you need more document pages, buy a Page Pack on the pricing page.
API Documentation & Specifications
Everything you need to integrate FastOCR into your backend, workflows, and automated ETL pipelines.
API Developer Guide
Authentication, idempotency keys, pagination cursors, limits, and error handling.
Document OCR Reference
Document creation schema, presigned S3 upload, multi-page PDFs, status polling, and text/PDF exports.
OpenAPI 3.0 Specification
Machine-readable JSON schema for Postman, Insomnia, Swagger UI, or automated client SDK generation.
Technical Specifications
| Authentication | Bearer Authorization: Bearer fok_live_... |
| Supported File Formats | PDF, PNG, JPG, JPEG, GIF, WebP and BMP |
| File Size Limits | Up to 1 GiB per PDF; 20 MiB per image (one page) |
| Output Formats | Plain text, Searchable PDF |
| Request Idempotency | Required on create requests via Idempotency-Key header |
| Storage | Files are automatically purged after 30 days. |
| Developer Quota | 20 free pages per month for every account, shared with PDFs on the website. Buy a Page Pack by card on the API keys page. |
| Concurrency | 2 documents at once; 10 with a contract or 10,000+ pages bought. |
Frequently Asked Questions
Is there a PDF to text API?
Yes. Create a document at https://api.fastocr.org/v1/documents, upload the PDF to the returned URL, start it, and download the result with format=text for plain UTF-8 text or format=pdf for a searchable PDF. Scanned and photographed PDFs are read with OCR. The same endpoint also reads images (PNG, JPG, JPEG, GIF, WebP and BMP) as one page each.
Does FastOCR have an API?
Yes, FastOCR provides a developer REST API at https://api.fastocr.org supporting asynchronous document OCR for PDF files and images in 100+ languages. It returns plain text or a searchable PDF.
How do I get access to the FastOCR API?
Any signed-in FastOCR account can create an API key and start right away. Sign in and create an API key in the developer console. You accept the API terms with your first key. Run the quickstart with your key in FASTOCR_API_KEY. When you need more document pages, buy a Page Pack on the pricing page. The Free plan includes 20 free pages per month, shared with PDFs on the website. Paid plans share their Document OCR allowance with the API too.
Is there a free tier for developers?
Yes. The Free plan includes 20 free pages per month, shared with PDFs on the website. Paid plans share their Document OCR allowance with the API too. You buy more pages as Page Packs on the pricing page. Page Packs work on the website too. There is no monthly commitment.
What happens after I use my 20 free monthly pages?
A document that runs out of pages fails with buy_pages. After you buy pages, call /start again on the same document. Buy a Page Pack by card at /developers/keys. Rates are at /pricing.
Can I use the FastOCR API for RAG pipelines and vector database chunking?
Yes. The FastOCR Document OCR API (/v1/documents) extracts raw text and dual-layer searchable PDFs from scanned PDFs across 100+ languages (including Arabic, Urdu Nastaliq, Chinese, Japanese, and Hindi), and from PNG, JPG, JPEG, GIF, WebP and BMP images. Downloading text via format=text returns the raw text for vector embeddings and RAG pipelines, or format=pdf returns a searchable PDF with an invisible text layer overlay.
Can I download both raw text and a searchable PDF from the same document?
Yes. Once a document reaches completed status, you can call the /output endpoint multiple times requesting format=text or format=pdf without reprocessing.
Does the FastOCR API handle bank statements?
Yes. POST /v1/bank-statements, upload the PDF, and poll the statement until it is completed. It returns JSON, CSV, Excel (XLSX), QuickBooks QBO, QuickBooks CSV, QFX and OFX, with a balance check on every account. It uses the same statement pages as the website: the first 50 are free. Details are at /bank-statement-api.
Does the API require webhook endpoints?
No webhooks are required. The API uses a polling model: GET /v1/documents/<id> until the status is completed, partial, or failed.
Ready to integrate FastOCR?
Create a key and run the quickstart. Every account gets 20 free pages a month.