Skip to navigation

Extract structured data

Fills a JSON Schema from the text. Supports strings, numbers, booleans, enums, string arrays and nested objects. Arrays of objects are accepted and returned empty. Missing values are null. On an image the vision model fills the schema itself, arrays of objects included; the schema may ask for at most 5 fields (image_schema_too_large), because a generative pass over a photo is for a handful of values, not a page.

Send text for one result, texts for a batch wrapped as { results: [...] }, or image (one image, at most 5 MB decoded, optionally with text; never with texts). The response carries x-input-chars (input characters) and x-input-tokens (input tokens billed for this call) headers. Each item of texts (and each of statements or questions) counts as one request against the requests-per-minute limit.

Authentication

AuthorizationBearer

A milliseconds API key, test_sk-{namespace}-{entropy} or prod_sk-{namespace}-{entropy}. Every /v1 route requires it.

Request

This endpoint expects an object.
schemamap from strings to anyRequired
JSON Schema of the object to extract. Strings, numbers, booleans, enums, arrays of strings and nested objects. Arrays of objects are accepted and returned empty.
textstringOptional1-20000 characters
The text to decide about.
textslist of stringsOptional

Batch form: one result per text.

imagestringOptional>=1 character

One image: a data:image/(jpeg|png|webp);base64, URL, or bare base64 of a JPEG, PNG or WebP. 5 MB decoded at most. URLs are never fetched. May travel with text (extra context), never with texts.

detailenumOptional

Image resolution: low 512 px, medium 768 px (default), high 1024 px longest edge. Higher sees more and bills more.

Allowed values:

Response

Result, or { results } for a batch

ExtractResultobject
OR
object

Errors

400
Bad Request Error
502
Bad Gateway Error