How to Create Extraction Templates in an ERP: Teach the System What Each Document Holds
For accounts, operations and back-office teams who read the same kinds of documents every day: tell the system what to capture, and decide when a person must check it.
If you are learning how to create extraction templates, you have probably seen AI read a document well once and then miss the field you needed most on the next. The fix is not a better guess. It is a clear definition of what each type of document should yield.
Without that definition, a purchase invoice gives you whatever the reader thinks is important. The e-way bill number is sometimes captured and sometimes not, dates arrive in three formats, and nobody knows which low-confidence fields should stop for a person.
This guide explains what a template contains, follows an illustrative set-up at a Surat textile trader, and shows how Apragya's document processing app uses templates.
How to create extraction templates, step by step
An extraction template tells a document reader what a particular type of document should contain. It lists the fields, their data types and which are required, and it can carry hints that help the system recognise the type, such as words that usually appear on it.
The second half of a template is trust. Every extracted value comes with a confidence score. A threshold decides when a value is accepted and when a person confirms it. Set stricter thresholds on fields where a mistake is costly, such as GSTIN, invoice total or bank account.
Finally, attach checks. Tax plus taxable value should equal the total; dates should not be in the future. Checks catch confident readings that are still wrong.
- Choose one document type and gather a few recent samples.
- List the header and line fields you need, with types.
- Mark which fields are required.
- Add classification hints and an example extraction.
- Set a global confidence threshold and stricter field thresholds.
- Attach validation rules for totals and dates.
- Review accuracy after a few weeks and adjust.
What reading documents without a template costs
Missing fields
The one field your process needs is captured on some documents only.
Inconsistent output
The same field arrives under different names and formats.
Everything reviewed
With no thresholds, every document goes to a person to be safe.
Unchecked figures
Totals are taken on trust because no rule compares them.
An example: a Surat textile trader's purchase invoices
Take an illustrative fabric trader in Surat receiving about 600 purchase invoices a month from mills and job workers. The accounts team needed the same fields from every one, and wanted a person to check only the uncertain ones.
The template the team settled on
Template: purchase invoice
The type this template applies to.
Plus taxable value, tax and total.
Captured for every line item.
Words that mark this document type.
Below this, the document goes to review.
Higher thresholds where errors cost most.
In the first month, most invoices passed straight through. The ones that stopped were mainly faded scans and handwritten job work bills, where the GSTIN or total fell below its stricter threshold. The team reviewed those, and the template's accuracy figure gave them a way to track improvement.
How to build a document extraction schema in Apragya
Step 1 of 6
Name the document type
One template per type, such as purchase invoice or delivery challan.
- Name the document type: One template per type, such as purchase invoice or delivery challan.
- List the fields: Each field has a name, a type and whether it is required.
- Or discover them: Paste a sample document's text and AI proposes a schema to edit.
- Add hints and examples: Keywords that identify the type, and example extractions to guide reading.
- Set thresholds: A global confidence level, with stricter ones for costly fields.
- Attach checks: Validation rules that compare fields, such as tax against total.
An OCR template for invoices, compared with a schema template
Older OCR tools use position templates: draw boxes on one supplier's layout and hope it never changes. A schema template describes what the document means, not where things sit, so one template can serve many suppliers. Thresholds then decide which readings a person should confirm.
Template approaches, compared with Apragya
| Feature | Position-based OCR template | Apragya extraction template |
|---|---|---|
| Defined by | Boxes on one layout | Fields a document type should hold |
| New supplier layout | A new template | Usually the same template |
| Uncertain values | Taken as read | Sent to review below the threshold |
| Figure checks | Separate step | Rules attached to the template |
| Performance | Not measured | Documents processed and average accuracy |
Checked against public information on 16 September 2026.
What sets Apragya's invoice data extraction template apart
AI discovery
A starting schema from one sample, for a person to refine.
Human review
Low-confidence fields stop for an operator.
Versioned
Each template carries a version and can be switched off.
Measured
Usage and average accuracy recorded on the template.
PII masking
Sensitive values can be masked in what people see.
Metered use
AI Credits for reading are counted per company.
Templates guide document extraction, work with validation rules, and their effect shows in the analytics described in how to create IDP analytics. See the extraction templates feature.
Creating your first template
- Pick the document type you receive most often.
- Write down the fields your process actually uses.
- Start from an AI-discovered schema, then trim it.
- Set a global threshold and stricter ones for tax and totals.
- Watch the review queue for two weeks and adjust.
A short template with the right required fields beats a long one that captures everything.
What it costs to start
Creating extraction templates, answered
Do we need a template for every supplier?
Can documents be read without a template?
What does the confidence threshold do?
Does a template check whether the figures add up?
What does it cost to start?
Define what your documents should yield
Create one template for your busiest document type and let review focus on the uncertain fields.