Document AI API overview
Sarvam’s Document AI API turns scanned and digital documents into structured, machine-readable data. It is powered by Sarvam Vision 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.
Before you start
Install the SDK
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:
- Submit with
parse(),extract(),split(), orclassify(). One call creates the job and returns ajob_id. - Poll
get_status()until the job finishes. - Fetch the output with
get_results()orget_download_url().
Job states, the status response, and error handling are covered in Jobs & Errors.
Your first call
This example parses one PDF end to end. Save any PDF as sample-document.pdf next to the script, or change the file name. No PDF handy? Use any document you have, find a sample invoice or form online, or ask an AI assistant to create one and save it as a PDF.
Each how-to page below has the same flow with every option, plus a cURL version.
Combine operations
The operations are designed to chain.
Document AI supersedes the earlier Document Digitization API. The namespace is doc_ai, and each operation is a single call.
Moving from the legacy Document Digitization API
The legacy API (client.document_intelligence, /doc-digitization/job/v1) is deprecated. To move to Document AI:
Next steps
- Jobs & Errors: states, polling, status response, and error codes.
- Languages, Formats & Limits: supported languages, input formats, page and file-size limits, and per-plan rate limits.
- Sarvam Vision: the model behind Document AI.
- API Reference: every parameter and option.
- Document AI app: upload and process documents without writing code.