OCR an Image

PythonTools
POST api.upapi.io/image-ocr.post

Read the text in an image, by URL or as an inline base64 upload. Returns the full text plus every detected line with its confidence score and pixel bounding box. Runs locally on PP-OCR/ONNX — no cloud vision API, no per-image fee.

ocrimagetextrecognitionvisiondocument
AuthAPI key
Cost4 units
Timeout25s
Cache86400s

Request schema

FieldTypeDescription
url
Public URL of the image to read (e.g. https://example.com/receipt.png). Provide this OR file, not both.· default: null
file
The image itself, base64-encoded (no data: URI prefix). Max 3.7 MB decoded — base64 inflates by 4/3 and the API request body is capped at 5 MB. Supply url instead for anything larger. Expected media type image/*.· default: null
languages
Scripts present in the image (e.g. en). Supported: ch, en — one bundled model covers Latin and Chinese. Omit for the default.· default: null

Response schema

FieldTypeDescription
textreq
stringAll recognised text, one detected line per row
widthreq
integerImage width in pixels
blocksreq
arrayEach detected line with its confidence and box
heightreq
integerImage height in pixels
truncatedreq
booleanTrue when more than 5000 text blocks were detected and cut

Try it

Try it

Public URL of the image to read (e.g. https://example.com/receipt.png). Provide this OR file, not both.

The image itself, base64-encoded (no data: URI prefix). Max 3.7 MB decoded — base64 inflates by 4/3 and the API request body is capped at 5 MB. Supply url instead for anything larger. Expected media type image/*.

Drop a file here, or click to browseimage/* · up to 3.7 MB

Sent inline as base64, so the request body cap applies — files up to 3.7 MB.

Scripts present in the image (e.g. en). Supported: ch, en — one bundled model covers Latin and Chinese. Omit for the default.

Run this endpoint live

Jump in as a guest — no signup — and run image-ocr.post with your own inputs. Create a free account anytime to get your own API key.

Sign in

Code examples

curl -X POST https://api.upapi.io/image-ocr.post \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: YOUR_API_KEY' \
  -d '{ "url": "https://example.com/receipt.png" }'

Developer tools

OpenAPI specImport the spec or collection into Postman, Insomnia, or any codegen tool.