Skip to navigation

Document Intelligence Overview

View as Markdown

Sarvam’s Document AI API turns scanned and digital documents into structured, machine-readable data. It is powered by Sarvam Vision 2.1 and supports 23 languages (22 Indian + English), so a Hindi invoice and an English contract go through the same API.

Pick an operation

Four operations share one job model. Pick based on what you need out the other end.

ParseExtractSplitClassify
You provideA documentA document + a schema (or config_id)A document (+ a split method)A document (+ categories, optional)
Fetch output withget_download_url()get_results()get_results()get_results()
EndpointPOST /doc-ai/v1/job/parsePOST /doc-ai/v1/job/extractPOST /doc-ai/v1/job/splitPOST /doc-ai/v1/job/classify

Before you start

1

Get an API key

Create one on the Sarvam dashboard and export it as SARVAM_API_KEY.

export SARVAM_API_KEY="YOUR_SARVAM_API_KEY"
2

Install the SDK

pip install -U sarvamai

Prefer plain HTTP? Every how-to also has a cURL version. See the Quickstart for the full setup.

How a job works

Every operation follows the same three steps:

  1. Submit with parse(), extract(), split(), or classify(). One call creates the job and returns a job_id.
  2. Poll get_status() until the job finishes.
  3. Fetch the output with get_results() or get_download_url().

Job states, the status response, and error handling are covered in Jobs & Errors.

Combine operations

The operations are designed to chain.

GoalChain
Process a scanned bundleSplit the file, then classify each child document by its document_ref
Route by document typeClassify, then extract with the schema (or config_id) that matches the type
Index a document archiveParse to Markdown, then chunk and embed the output
Capture the same fields at scaleSave a schema as a config_id and reuse it across extract calls

Document AI supersedes the earlier Document Digitization API. The namespace is doc_ai, and each operation is a single call.

Next steps