OCR API

Extract text from an image via OCR. $0.02 per request.

What it does

Send a photo, screenshot, or scanned document as an image. Get back the transcribed text, its detected language, and a word count. Handles handwriting-adjacent print, receipts, signs, and scanned pages.

Endpoint

MethodPOST
Path/ocr
Content-Typemultipart/form-data

Fields

fieldrequireddescription
fileyesPNG, JPEG, WEBP, or GIF image, max 8MB

Example

curl -X POST https://ocr-api.pdfextractapi.workers.dev/ocr \
  -F "file=@scan.png"

Example response

{
  "text": "INVOICE #4471\nTotal Due: $128.50\nDue Date: 2026-09-15",
  "language": "en",
  "word_count": 7
}

Errors

Errors return a non-200 status with { "error": { "code": "...", "message": "..." } }. Common codes: missing_input, file_too_large, unsupported_media_type.

Payment

This endpoint is paid per-request via the x402 protocol (HTTP 402 + USDC). Unpaid requests receive a 402 response with payment instructions.

Try it in your browser