> This page is for Document AI.

> Sarvam Voice Agents (Samvaad) is a voice AI agent platform for Indian languages: build, test and deploy AI calling agents on your own phone numbers, from ₹3 a minute. Start here: https://docs.sarvam.ai/voice-agents/why-voice-agents.
> For clean Markdown of any page, append `.md` to the page URL.
> For a complete documentation index, see https://docs.sarvam.ai/llms.txt. For a section index, append `/llms.txt` to any section URL (for example https://docs.sarvam.ai/voice-agents/llms.txt).
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server.

# Extract fields

> Pull the fields you name into structured JSON, with a confidence score and source location for every value. Build the schema yourself, from a template, or with AI.

**Extract** pulls the fields you name out of a document and returns them as structured JSON. Examples include an invoice number, a PAN, a statement period, or every row of a transaction table. Each value comes with a **confidence score**, and you can see where on the page it came from.

You describe the fields in a **schema**. You can write it yourself, start from one of 40+ templates, or have AI draft it from your documents.

## Step 1: Add your document

Click **Extract** under **Products** in the sidebar. Drag and drop your files, click **Upload documents**, or pick a demo document (**GSTR-3B.pdf** or **Bank statement.pdf**) under **Try a demo doc**.

![Extract page with an upload area on the left that accepts PDF, JPEG, PNG, TIFF, or ZIP, up to 10 files or 30 pages in total, and a Schema panel on the right with Form and JSON toggles, Templates, Generate using AI, an empty field row, Add field, and an optional Instructions box.](/_fern-files/_img/5dcaddb5a1582a6c61446324e513f36fa8a8a2aa1a950790c6eee57756df1f9a.webp)

> **Note**
>
> Accepted formats: **PDF, JPEG, PNG, TIFF, ZIP**. Each run takes up to **10 files or 30 pages in total**. For more, use the [Extract API](/api/api-guides-tutorials/document-intelligence/how-to/extract).

> **Tip**
>
> A demo document comes with a matching schema. If you've already built a schema, the app asks before replacing it.

## Step 2: Build the schema

The **Schema** panel lists the fields to extract. Each field has three parts:

* **Field name.** What the field is called in the output, for example *Invoice number*.
* **Type.** `string`, `number`, `integer`, `boolean`, `date`, `enum`, or `array of objects`.
* **Description** (optional). A hint about where or how to find the value, for example *The invoice number, near the top*.

You can fill the schema in three ways:

#### Start from a template

Click **Templates** to open **Extraction templates**. Search by document or field name, then click a template to load its fields. Everything stays editable.

![Extraction templates dialog with a search box, a Saved configurations list, and a Start from scratch button.](/_fern-files/_img/cb1a63620d432f9934c2fa7715a956b31523b9cfa8d33788f814c27b560ca7a4.webp)

The dialog lists your **Saved configurations** first, then templates grouped by workflow:

| Group                           | Templates                                                                                                                                                                      |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Loan and insurance underwriting | Bank statement, Salary slip, Form 16, ITR acknowledgement, PAN card, Aadhaar, Credit bureau report, Property valuation report, Land deed                                       |
| Accounts payable                | Vendor invoice, GST return (GSTR-3B), Purchase order, Goods receipt note, Delivery challan, Credit / debit note, Cancelled cheque, TDS declaration                             |
| Purchase order lifecycle        | Purchase requisition, Vendor quotation, Order acknowledgement, Packing list                                                                                                    |
| Claims processing               | Claim form, Medical bill, Discharge summary, Surveyor / repair estimate, FIR / incident report, Death certificate                                                              |
| Trade finance                   | Letter of credit, Bill of lading, Commercial invoice, Certificate of origin, Bill of exchange, Inspection certificate                                                          |
| Cheques processing              | Cheque (CTS image), Deposit / pay-in slip, Dishonour / return memo                                                                                                             |
| More templates                  | Insurance claim form, Credit card statement, KYC document, Resume screener, Invoice screener, Background verification, Court appeal, GST registration form, Historic land deed |

Click **Start from scratch** to close the dialog with an empty schema.

#### Generate using AI

Click **Generate using AI**, then write an **Extraction prompt** describing what you want. You can also pick a suggestion: **Extract everything**, **Invoice**, **Bank statement**, **Purchase order**, or **ID card**. Click **Generate fields**.

Sarvam reads your prompt and the documents on the left, then fills in the schema. You review the fields before anything runs.

```text
Extract the statement period, opening and closing balance, and every transaction with its date, description, amount, and whether it is a debit or credit.
```

#### Write it yourself

Type a field name, pick a type, and add a description. Click **+ Add field** for more fields, drag the handle on the left of a row to reorder, and click **×** to remove one.

Switch from **Form** to **JSON** to edit the schema as raw JSON instead. This is handy for pasting a schema from a spec or from your code.

### Lists, tables, and fixed values

* **Tables and repeating items.** Use the **array of objects** type for anything that repeats, such as transactions, line items, or family members. Click **+ Add column** inside the field to define what each row contains.
* **Fixed sets of values.** Use **enum** and list the allowed values (for example `debit` and `credit`). The output will always be one of them.

![Extract page with a credit card statement on the left and the Schema panel on the right listing fields such as Account holder, Account number, IFSC, Statement period, Bank name, Branch name, Customer ID, Opening balance, and Closing balance, each with a type dropdown.](/_fern-files/_img/4349ceaf894da769a2e2a246eb69e9d74b37cd615c93c4ce5b32fd791e8b3721.webp)

### Instructions

Use the optional **Instructions** box for anything that applies to the whole document, for example *Amounts are in INR. Return dates as DD/MM/YYYY.*

## Step 3: Run the extraction

Click **Run extract on N documents**. The credits the run will use are shown under the button. While it runs, the **Output** tab shows progress, for example *Processing · 2 of 3 pages done*. Large documents can take a few minutes. You can leave the page and reopen the run from **History**.

## Step 4: Review the results

When the run is **Done**, the **Output** tab lists every field with its value. Switch between **Results** and **JSON** at the top right, or go back to **Setup** to change the schema and **Run again**.

![Extract results for a credit card statement: the source document on the left with boxes around extracted values; on the right, the Output tab lists fields such as Account number, Statement period, Bank name, Opening balance, and Closing balance with 100% confidence badges, and Not found on the document for missing fields.](/_fern-files/_img/1e4a1bd22ac5027a04e502300f8473229f8ca47b9e77486ee3ce2b682cd40c20.webp)

* **Confidence.** A percentage badge on every value. Low scores flag what to check first.
* **Source location.** Extracted values are boxed on the source document, so you can check each value against the page.
* **Not found.** Fields that aren't in the document show *Not found on the document* instead of a guessed value.
* **Tables.** Array fields render as a table, with a row count such as *20 rows · spans pages*. A dashed line marks where a table continues onto the next page.
* **Editable.** All values are editable. Click any value to correct it before you download.

## Step 5: Download or reuse

* **Download** saves the result as a **JSON** file. It includes the extracted values (`result`), a confidence score and source location for every field (`annotations`), and page counts (`usage`).
* **Save config** saves the schema and instructions under a name so you can reuse them. See [Save and reuse Configs](/doc-ai/how-to/save-and-reuse-configs).
* **View API code** gives you cURL, Python, or JavaScript that runs this exact schema through the [Extract API](/api/api-guides-tutorials/document-intelligence/how-to/extract).

## Improve accuracy

#### Write clear descriptions

*"Total"* is vague. *"Numeric total at the bottom of the invoice, after taxes, in INR"* is not. The description is the main hint the model uses to find a field.

#### Use the right types

Use `number` for amounts and `date` for dates, so you get values you can compute with. Use `enum` when only a few values are valid, and `array of objects` for anything that repeats.

#### Normalise values in Instructions

Amounts like ₹ 1,24,500 can come back with symbols and separators. Add *"Return amounts as plain numbers without currency symbols or commas"* to **Instructions**.

#### Split bundles first

If one PDF holds several different documents, [Split](/doc-ai/how-to/split-a-document-bundle) it first and run a matching schema on each part.

#### Start from a clean scan

Blurry or skewed scans hurt accuracy more than any schema change. Rescan at 300 DPI and straighten the page before uploading if you can.

Next: [Classify documents](/doc-ai/how-to/classify-documents).