Skip to navigation

Extract Fields

View as Markdown

Creates and starts an extract job from files or pre-uploaded handles. Extract pulls structured fields out of documents according to a schema.

Input: Exactly one of file and upload_ids must be provided.

Schema: exactly one of schema (inline JSON schema) and config_id (saved extraction configuration) is required.

Processing: the job runs asynchronously. Poll GET /doc-ai/v1/job/{job_id}/status until a terminal status (completed, partially_completed, failed, rejected), then fetch output via the results or download-url endpoints.

Extract results include result, plus annotations mirroring the result shape where every leaf has confidence and sources.

Authentication

api-subscription-keystring
API Key authentication via header

Request

This endpoint expects a multipart form with multiple files.
filefilesOptional

Document file(s) to extract from. Repeatable multipart part. Exactly one of file and upload_ids must be provided.

upload_idsstringOptional

Comma-separated upload IDs returned by POST /doc-ai/v1/job/upload. Exactly one of file and upload_ids must be provided.

schemastringOptional

Inline extraction schema as a JSON string. The root must be type: "object" with non-empty properties; every field needs a type and a non-empty description. Supported types: string, number, integer, boolean, object, array (objects need properties, arrays need items); optional enum; maximum nesting depth 4. Exactly one of schema and config_id is required.

config_idstringOptional

Saved extraction configuration ID. Exactly one of schema and config_id is required. To get your config_id, follow the steps listed here.

languagestringOptionalDefaults to en-IN

Language code of the document (BCP-47), e.g. en-IN, hi-IN.

output_formatenumOptionalDefaults to json
Output format of the extraction results.
Allowed values:
classificationstringOptionalDefaults to false

Enable document classification. Boolean sent as text: true or false.

modelstringOptionalDefaults to sarvam-vision-v1
Model to use for extraction.

Response

Created
job_idstring
The unique identifier of the job.
statusstring
Current status of the job.
run_idstring
The unique identifier of the job run.

Errors

400
Bad Request Error
402
Payment Required Error
403
Forbidden Error
413
Content Too Large Error
429
Too Many Requests Error
503
Service Unavailable Error