Read one scanned page (OCR)
const url = 'https://vpat-parse.larry-c6c.workers.dev/api/v1/vpat-ocr-page';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'image/jpeg'}, body: 'binary'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://vpat-parse.larry-c6c.workers.dev/api/v1/vpat-ocr-page \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: image/jpeg' \ --data binaryFor PDFs with no text layer. Send one rendered page image; the page is
read with Amazon Textract (DetectDocumentText, synchronous, no
retention under the AWS AI-services opt-out) and returned as plain text
with table rows kept on one line. Same authentication, per-key rate
limit and AI opt-out checks as /api/v1/vpat-parse. Each page is
billed to the cost ledger. Send the text of every page to
/api/v1/vpat-parse as text.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Responses
Section titled “ Responses ”Page read. text is empty when the page has no recognizable text.
object
object
Examplegenerated
{ "data": { "text": "example" }, "error": "example", "meta": "example"}Empty body (MISSING_FIELD).
object
object
object
Stable machine-readable error code.
Optional diagnostic detail. For source-fetch failures it carries
the status and Content-Type the source answered with, e.g.
sourceStatus=404; contentType=text/html.
object
Example
{ "data": null, "error": { "code": "METHOD_NOT_ALLOWED" }, "meta": null}Missing, invalid or revoked API key (UNAUTHORIZED).
object
object
object
Stable machine-readable error code.
Optional diagnostic detail. For source-fetch failures it carries
the status and Content-Type the source answered with, e.g.
sourceStatus=404; contentType=text/html.
object
Example
{ "data": null, "error": { "code": "METHOD_NOT_ALLOWED" }, "meta": null}The attributed user or their organization has turned off AI services.
object
object
object
Stable machine-readable error code.
Optional diagnostic detail. For source-fetch failures it carries
the status and Content-Type the source answered with, e.g.
sourceStatus=404; contentType=text/html.
object
Example
{ "data": null, "error": { "code": "METHOD_NOT_ALLOWED" }, "meta": null}Image over 4 MB (SOURCE_TOO_LARGE).
object
object
object
Stable machine-readable error code.
Optional diagnostic detail. For source-fetch failures it carries
the status and Content-Type the source answered with, e.g.
sourceStatus=404; contentType=text/html.
object
Example
{ "data": null, "error": { "code": "METHOD_NOT_ALLOWED" }, "meta": null}Content-Type is not image/jpeg or image/png (UNSUPPORTED_MEDIA_TYPE).
object
object
object
Stable machine-readable error code.
Optional diagnostic detail. For source-fetch failures it carries
the status and Content-Type the source answered with, e.g.
sourceStatus=404; contentType=text/html.
object
Example
{ "data": null, "error": { "code": "METHOD_NOT_ALLOWED" }, "meta": null}Per-user OCR budget exceeded (RATE_LIMITED): 120 pages per minute
or 300 pages per UTC day. This route does not use the key’s parse
rate limit. Retry-After gives the wait in seconds.
object
object
object
Stable machine-readable error code.
Optional diagnostic detail. For source-fetch failures it carries
the status and Content-Type the source answered with, e.g.
sourceStatus=404; contentType=text/html.
object
Example
{ "data": null, "error": { "code": "METHOD_NOT_ALLOWED" }, "meta": null}AWS credentials are not configured (CONFIG_ERROR).
object
object
object
Stable machine-readable error code.
Optional diagnostic detail. For source-fetch failures it carries
the status and Content-Type the source answered with, e.g.
sourceStatus=404; contentType=text/html.
object
Example
{ "data": null, "error": { "code": "METHOD_NOT_ALLOWED" }, "meta": null}Textract failed or returned an invalid response (UPSTREAM_ERROR).
object
object
object
Stable machine-readable error code.
Optional diagnostic detail. For source-fetch failures it carries
the status and Content-Type the source answered with, e.g.
sourceStatus=404; contentType=text/html.
object
Example
{ "data": null, "error": { "code": "METHOD_NOT_ALLOWED" }, "meta": null}