---
search:
  tags:
    - OCR
    - POST
seo:
  description: >-
    Reads the PDF's own text layer first (method: text). If there is none,
    renders the pages and… Reference for the POST /v1/ocr endpoint in the
    Webfold API.
sidebar:
  label: Extract text from a PDF, with OCR for scans
  badge: POST
title: Extract text from a PDF, with OCR for scans
type: openapi-operation
---
Reads the PDF's own text layer first (`method: text`). If there is none, renders the pages and recognises them with Tesseract (`method: ocr`). Up to 25 MiB decoded. Concurrent OCR jobs are capped per instance and extra requests get `503`; retry shortly. Metered as `ocr.pdf`.

`POST /v1/ocr`

**Request body** (`application/json`, required)

- `content_base64` (string, required) — The PDF, base64. Up to 25 MiB decoded.
- `languages` (string) — Tesseract language codes.
- `max_pages` (integer)
- `timeout_secs` (integer)

Request body example:

```json
{
  "content_base64": "string",
  "languages": "eng+deu",
  "max_pages": 20,
  "timeout_secs": 120
}
```

**Responses**

- `200` — The PDF as Markdown
- `400` — Bad request
- `401` — Missing or invalid bearer token
- `403` — Billing or plan entitlement blocked the request
- `502` — Upstream service (arXiv, YouTube, web page) failed
- `503` — The backing service is not configured or is busy

Response example, 200:

```json
{
  "method": "text",
  "bytes": 0,
  "characters": 0,
  "markdown": "string"
}
```
