Skip to main content

Templates

Templates are what turn NetraOCR from a text scanner into a structured-data engine. A template describes the fields you want pulled from a document; the NetraOCRx engine returns JSON keyed exactly to those fields.

Anatomy of a template

A template is a set of fields, each with:

  • a name (the JSON key you'll get back, e.g. invoice_number),
  • a description (helps the engine find the right value — e.g. "the invoice's unique number"), and
  • optional sub-fields for repeating or nested structures (e.g. line_items with description, quantity, unit_price, amount).

Creating a template

Open Templates → New in the console. You have three quick-start paths:

1. Build it manually

Add fields one at a time, giving each a name and description. Add sub-fields for line items and nested data.

2. Generate with AI

Describe the document in plain language (or provide a sample), and NetraOCR generates a starting template you can refine. There's also generate from image, which builds a template from a sample document image.

3. Import from CSV

Upload a CSV whose header row becomes your field names. The importer reads the header and first data row, sanitizes names into valid field keys, and fills descriptions with example values from the first row.

Output options

Beyond fields, a template controls how results come back:

  • PDF output mode — how multi-page documents are structured in the result.
  • Translate result — optionally translate extracted values into a supported language (numbers, dates, and IDs are preserved). Available languages are controlled server-side.

Global vs. user templates

TypeReferenced bySource
GlobalIDs like gl1Built-in, ready to use
UserNumeric IDs (1, 2, …)Templates you create

Every OCR upload must select one of these templates. In the console, choose it from the upload picker; over the API, pass the template's ID as template_id.

Using a template

Once saved, a template is available everywhere you upload and must be selected for OCR:

  • Console: select it in the upload dialog.
  • API: pass its ID as template_id on POST /ocr/upload or any upload endpoint.

To manage templates programmatically, see the Templates API.