Vision and Documents
These synchronous endpoints accept a public URL, base64/data-URL input, or a
finalized account-scoped file_id. Use one input method per request. To submit a
local file without publishing it, first use the Primex temporary Files API.
OCR
POST /v1/ocr · Primex-native
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | No | Offering ID to route to (discover IDs via GET /v1/models for this service_type). |
image | string | No | Base64 string or data URL of the image. Provide exactly one input source. |
url | string | No | Public URL of the input to fetch. Provide exactly one input source. |
file_id | string | No | A finalized Files API file_id (see /endpoints/files). Provide exactly one input source. |
Billed per processed page.
POST /v1/ocr extracts text and reports usage.pages.
{
"model": "YOUR_LIVE_OCR_MODEL",
"url": "https://example.com/document.png"
}
The response includes text, pages, and usage.pages. OCR is billed per
processed page.
Use upload purpose OCR_INPUT when supplying file_id.
Structured document analysis
POST /v1/documents/analyze · Primex-native
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | No | Offering ID to route to (discover IDs via GET /v1/models for this service_type). |
document | string | No | Base64 string or data URL of the document. Provide exactly one input source. |
url | string | No | Public URL of the input to fetch. Provide exactly one input source. |
file_id | string | No | A finalized Files API file_id (see /endpoints/files). Provide exactly one input source. |
Billed per processed page.
POST /v1/documents/analyze returns document content plus typed fields, tables,
and key-value pairs when supported by the selected document model.
{
"model": "YOUR_LIVE_DOCUMENT_MODEL",
"url": "https://example.com/invoice.pdf"
}
Use document instead of url for base64 or a data URL. Billing is per processed
page.
Use upload purpose DOCUMENT_INPUT when supplying file_id.
Image analysis
POST /v1/vision/analyze · Primex-native
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | No | Offering ID to route to (discover IDs via GET /v1/models for this service_type). |
image | string | No | Base64 string or data URL of the image. Provide exactly one input source. |
url | string | No | Public URL of the input to fetch. Provide exactly one input source. |
file_id | string | No | A finalized Files API file_id (see /endpoints/files). Provide exactly one input source. |
features | string | string[] | No | Analysis features to run (array or comma-separated), e.g. caption, read, tags, objects. Each selected feature is a billable transaction. |
Billed per selected feature (transaction).
POST /v1/vision/analyze can return captions, OCR text, tags, objects, people,
and smart crops. Features may be an array or comma-separated string.
{
"model": "YOUR_LIVE_VISION_MODEL",
"url": "https://example.com/photo.jpg",
"features": ["caption", "read", "tags", "objects"]
}
One analysis call is one billable image, regardless of how many requested features are returned. Check Models and Live Catalogue for available models and customer pricing.
Use upload purpose VISION_INPUT when supplying file_id.