Skip to main content

Overview

Templates define which fields to extract and how to extract them from documents processed by the Document Extraction service. When you attach a template to a verification, AnyCheck uses it to structure the output into the exact fields your application needs.

Custom templates

Define your own schema to extract any fields from any document type.

Prebuilt templates

Ready-to-use templates for common Indonesian documents maintained by AnyCheck.

Auto-schema generation

Describe what you want to extract in plain text and the schema is generated automatically.

Reusable across verifications

Create a template once and attach it to any number of Document Extraction verifications.

Template Types

Custom Templates

Custom templates are created and maintained by your organization. You define the schema: the fields to extract, their types, and any special extraction instructions.

Prebuilt Templates

Prebuilt templates are provided and maintained by AnyCheck for common document types (e.g., KTP, NPWP, SIUP). They are read-only and cannot be modified.

Creating a Custom Template

Option 1: Define the schema manually

Specify the fields you want to extract and their types:
The instruction field lets you give the AI model context about where to focus on the document. The config field controls which AI model and parser to use. See Template Configuration below.

Option 2: Use auto-schema generation

Describe in plain text what you want to extract, and AnyCheck generates the schema automatically:
Response:
Review and refine the generated schema, then use it in a POST /templates call.

Using a Template in a Verification

When creating a Document Extraction verification, pass the template ID in the configuration:
The verification output will contain extracted field values keyed by the schema property names you defined.

Finding the Right Template

Use the form endpoint to browse available templates in a dropdown-friendly format (includes both custom and prebuilt):
For full template details (schema, instructions, config):

Managing Custom Templates

Update a template

You can update the name, description, instruction, schema, or config of a custom template. Prebuilt templates cannot be modified.

Delete a template

Only custom templates can be deleted. Deleting a template does not affect existing verifications that used it.

Template Schema Reference

The schema object follows a JSON Schema-like format. Each property supports:
The instruction field at the template level provides context to the AI about the document as a whole (e.g., “this is a two-page document; all amounts are in IDR”). Per-field descriptions guide extraction of individual values.

Template Configuration

The config object in POST /templates controls how extraction is performed. You can use a preset or configure individual settings. The simplest way to control quality vs. speed:

Individual settings

For finer control, configure each setting separately:
When both preset_mode and individual settings are provided, the preset applies first and individual settings override it.

Lifecycle

Start with a small schema (3–5 fields), test accuracy, then expand. Complex schemas with many fields may require more specific per-field descriptions to maintain accuracy.