The text in an image, as a plain answer: a PNG, JPEG or WebP (an https URL on a public host, base64, or a multipart file part `original`) is fitted to an acuity (long edge 1568 by default, never upscaled) and read by tesseract; the answer is the text, its word, line and character counts, the engine's name and version, the language, and the image by sha256, width, height and bytes — never the pixels, and nothing is stored. Deterministic given the engine version that rides every answer. A fetch that fails, a non-image or a language the host lacks is a 400, never charged. For OCR as evidence — a signed record that a compression kept the text — use certify with probe=ocr.
curl 'https://api.s2ar.dev/v1/extract_text?image_url=https%3A%2F%2Fs2ar.dev%2Fexamples%2Fmedia%2Finvoice.png'
curl -X POST https://api.s2ar.dev/v1/extract_text \
-H 'content-type: application/json' \
-d '{"image_url": "https://s2ar.dev/examples/media/invoice.png"}'
With a key: add -H 'Authorization: Bearer $S2AR_KEY'. Over x402, while sales are open: the same call at https://api.s2ar.dev/x402/v1/extract_text; unpaid, it answers 402 with the accepts[] to sign, then send the payment as PAYMENT-SIGNATURE (or X-PAYMENT). Sales are paused since 2026-10-16, and the mirror answers 410. From an agent: the MCP tool extract_text at https://api.s2ar.dev/mcp.
| parameter | type | required | what |
|---|---|---|---|
image_url | string | an https URL of a PNG, JPEG or WebP up to 4 MB on a public host (no redirects) | |
image_b64 | string | the image bytes as base64, instead of a URL | |
lang | string | a tesseract language the host has (default eng; GET /v1/extract_text/languages) | |
acuity | integer | the long edge the image is fitted to before OCR (default 1568, at most 2560) |
{
"ok": true,
"text": "INVOICE\nNo. 2026-0142\nTotal due $1,284.00",
"words": 7,
"lines": 3,
"chars": 39,
"engine": {
"name": "tesseract",
"version": "5.3.0",
"lang": "eng",
"acuity": 1568
},
"image": {
"sha256": "…",
"w": 1200,
"h": 1600,
"bytes": 184320,
"fitted": [
1176,
1568
]
},
"charged_usd": 0.02,
"receipt": {
"evidence_hash": "sha256:94abfed2…",
"cost_usd": 0.02,
"what": "extract",
"determinism": "replayable",
"witnesses": [
"tesseract"
],
"issued_at": "2026-10-10T00:00:00Z",
"refund_rule": "failed calls are never charged",
"charter": "https://api.s2ar.dev/charter"
}
}
Every paid answer carries its receipt; a record's sha256 re-verifies free at /v1/verify/{sha256}. A call that fails is never charged.
extract the text: the call, its answer and its record, re-derived.
The errors are the same on every route.