Skip to content

Read one scanned page (OCR)

POST
/api/v1/vpat-ocr-page
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 binary

For 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.

string format: binary

Page read. text is empty when the page has no recognizable text.

Media typeapplication/json
object
data
object
text
string
error
nullable
meta
nullable
Examplegenerated
{
"data": {
"text": "example"
},
"error": "example",
"meta": "example"
}

Empty body (MISSING_FIELD).

Media typeapplication/json
object
data
required
object
error
required
object
code
required

Stable machine-readable error code.

string
Allowed values: METHOD_NOT_ALLOWED UNAUTHORIZED RATE_LIMITED AUTH_UNAVAILABLE INVALID_JSON MISSING_FIELD URL_NOT_ALLOWED SOURCE_AUTH_REQUIRED SOURCE_FETCH_FAILED UNSUPPORTED_MEDIA_TYPE SOURCE_TOO_LARGE ZERO_RETENTION_UNAVAILABLE CONFIG_ERROR UPSTREAM_ERROR NO_CRITERIA_FOUND NO_TEXT_LAYER INTERNAL_ERROR AI_DISABLED_BY_USER AI_DISABLED_BY_TENANT AI_GUARD_CHECK_FAILED
message
required
string
details

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.

string
meta
required
object
Example
{
"data": null,
"error": {
"code": "METHOD_NOT_ALLOWED"
},
"meta": null
}

Missing, invalid or revoked API key (UNAUTHORIZED).

Media typeapplication/json
object
data
required
object
error
required
object
code
required

Stable machine-readable error code.

string
Allowed values: METHOD_NOT_ALLOWED UNAUTHORIZED RATE_LIMITED AUTH_UNAVAILABLE INVALID_JSON MISSING_FIELD URL_NOT_ALLOWED SOURCE_AUTH_REQUIRED SOURCE_FETCH_FAILED UNSUPPORTED_MEDIA_TYPE SOURCE_TOO_LARGE ZERO_RETENTION_UNAVAILABLE CONFIG_ERROR UPSTREAM_ERROR NO_CRITERIA_FOUND NO_TEXT_LAYER INTERNAL_ERROR AI_DISABLED_BY_USER AI_DISABLED_BY_TENANT AI_GUARD_CHECK_FAILED
message
required
string
details

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.

string
meta
required
object
Example
{
"data": null,
"error": {
"code": "METHOD_NOT_ALLOWED"
},
"meta": null
}

The attributed user or their organization has turned off AI services.

Media typeapplication/json
object
data
required
object
error
required
object
code
required

Stable machine-readable error code.

string
Allowed values: METHOD_NOT_ALLOWED UNAUTHORIZED RATE_LIMITED AUTH_UNAVAILABLE INVALID_JSON MISSING_FIELD URL_NOT_ALLOWED SOURCE_AUTH_REQUIRED SOURCE_FETCH_FAILED UNSUPPORTED_MEDIA_TYPE SOURCE_TOO_LARGE ZERO_RETENTION_UNAVAILABLE CONFIG_ERROR UPSTREAM_ERROR NO_CRITERIA_FOUND NO_TEXT_LAYER INTERNAL_ERROR AI_DISABLED_BY_USER AI_DISABLED_BY_TENANT AI_GUARD_CHECK_FAILED
message
required
string
details

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.

string
meta
required
object
Example
{
"data": null,
"error": {
"code": "METHOD_NOT_ALLOWED"
},
"meta": null
}

Image over 4 MB (SOURCE_TOO_LARGE).

Media typeapplication/json
object
data
required
object
error
required
object
code
required

Stable machine-readable error code.

string
Allowed values: METHOD_NOT_ALLOWED UNAUTHORIZED RATE_LIMITED AUTH_UNAVAILABLE INVALID_JSON MISSING_FIELD URL_NOT_ALLOWED SOURCE_AUTH_REQUIRED SOURCE_FETCH_FAILED UNSUPPORTED_MEDIA_TYPE SOURCE_TOO_LARGE ZERO_RETENTION_UNAVAILABLE CONFIG_ERROR UPSTREAM_ERROR NO_CRITERIA_FOUND NO_TEXT_LAYER INTERNAL_ERROR AI_DISABLED_BY_USER AI_DISABLED_BY_TENANT AI_GUARD_CHECK_FAILED
message
required
string
details

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.

string
meta
required
object
Example
{
"data": null,
"error": {
"code": "METHOD_NOT_ALLOWED"
},
"meta": null
}

Content-Type is not image/jpeg or image/png (UNSUPPORTED_MEDIA_TYPE).

Media typeapplication/json
object
data
required
object
error
required
object
code
required

Stable machine-readable error code.

string
Allowed values: METHOD_NOT_ALLOWED UNAUTHORIZED RATE_LIMITED AUTH_UNAVAILABLE INVALID_JSON MISSING_FIELD URL_NOT_ALLOWED SOURCE_AUTH_REQUIRED SOURCE_FETCH_FAILED UNSUPPORTED_MEDIA_TYPE SOURCE_TOO_LARGE ZERO_RETENTION_UNAVAILABLE CONFIG_ERROR UPSTREAM_ERROR NO_CRITERIA_FOUND NO_TEXT_LAYER INTERNAL_ERROR AI_DISABLED_BY_USER AI_DISABLED_BY_TENANT AI_GUARD_CHECK_FAILED
message
required
string
details

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.

string
meta
required
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.

Media typeapplication/json
object
data
required
object
error
required
object
code
required

Stable machine-readable error code.

string
Allowed values: METHOD_NOT_ALLOWED UNAUTHORIZED RATE_LIMITED AUTH_UNAVAILABLE INVALID_JSON MISSING_FIELD URL_NOT_ALLOWED SOURCE_AUTH_REQUIRED SOURCE_FETCH_FAILED UNSUPPORTED_MEDIA_TYPE SOURCE_TOO_LARGE ZERO_RETENTION_UNAVAILABLE CONFIG_ERROR UPSTREAM_ERROR NO_CRITERIA_FOUND NO_TEXT_LAYER INTERNAL_ERROR AI_DISABLED_BY_USER AI_DISABLED_BY_TENANT AI_GUARD_CHECK_FAILED
message
required
string
details

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.

string
meta
required
object
Example
{
"data": null,
"error": {
"code": "METHOD_NOT_ALLOWED"
},
"meta": null
}

AWS credentials are not configured (CONFIG_ERROR).

Media typeapplication/json
object
data
required
object
error
required
object
code
required

Stable machine-readable error code.

string
Allowed values: METHOD_NOT_ALLOWED UNAUTHORIZED RATE_LIMITED AUTH_UNAVAILABLE INVALID_JSON MISSING_FIELD URL_NOT_ALLOWED SOURCE_AUTH_REQUIRED SOURCE_FETCH_FAILED UNSUPPORTED_MEDIA_TYPE SOURCE_TOO_LARGE ZERO_RETENTION_UNAVAILABLE CONFIG_ERROR UPSTREAM_ERROR NO_CRITERIA_FOUND NO_TEXT_LAYER INTERNAL_ERROR AI_DISABLED_BY_USER AI_DISABLED_BY_TENANT AI_GUARD_CHECK_FAILED
message
required
string
details

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.

string
meta
required
object
Example
{
"data": null,
"error": {
"code": "METHOD_NOT_ALLOWED"
},
"meta": null
}

Textract failed or returned an invalid response (UPSTREAM_ERROR).

Media typeapplication/json
object
data
required
object
error
required
object
code
required

Stable machine-readable error code.

string
Allowed values: METHOD_NOT_ALLOWED UNAUTHORIZED RATE_LIMITED AUTH_UNAVAILABLE INVALID_JSON MISSING_FIELD URL_NOT_ALLOWED SOURCE_AUTH_REQUIRED SOURCE_FETCH_FAILED UNSUPPORTED_MEDIA_TYPE SOURCE_TOO_LARGE ZERO_RETENTION_UNAVAILABLE CONFIG_ERROR UPSTREAM_ERROR NO_CRITERIA_FOUND NO_TEXT_LAYER INTERNAL_ERROR AI_DISABLED_BY_USER AI_DISABLED_BY_TENANT AI_GUARD_CHECK_FAILED
message
required
string
details

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.

string
meta
required
object
Example
{
"data": null,
"error": {
"code": "METHOD_NOT_ALLOWED"
},
"meta": null
}