Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.fintelite.ai/llms.txt

Use this file to discover all available pages before exploring further.

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.
GET /templates/custom

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.
GET /templates/prebuilt

Creating a Custom Template

Option 1: Define the schema manually

Specify the fields you want to extract and their types:
curl -X POST https://api.anycheck.ai/templates \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Invoice Extraction Template",
    "description": "Extracts key fields from Indonesian tax invoices",
    "instruction": "Focus on the invoice number and tax amounts. Ignore header/footer text.",
    "schema": {
      "invoice_number": { "type": "string", "description": "Invoice number (e.g., 010.001-24.12345678)" },
      "invoice_date": { "type": "string", "description": "Invoice date in YYYY-MM-DD format" },
      "seller_name": { "type": "string", "description": "Seller company name" },
      "buyer_name": { "type": "string", "description": "Buyer company name" },
      "dpp": { "type": "number", "description": "Dasar Pengenaan Pajak (tax base amount)" },
      "ppn": { "type": "number", "description": "PPN amount (11% of DPP)" },
      "total_amount": { "type": "number", "description": "Total invoice amount including tax" }
    },
    "config": {
      "preset_mode": "BALANCED"
    }
  }'
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:
curl -X POST https://api.anycheck.ai/templates/autoschema \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Extract the invoice number, issue date, seller and buyer names, and the total amount including tax from Indonesian tax invoices (Faktur Pajak)",
    "extraction_mode": "ODIN"
  }'
Response:
{
  "schema": {
    "properties": {
      "invoice_number": {
        "type": "string",
        "description": "The unique invoice identifier"
      },
      "issue_date": {
        "type": "string",
        "description": "Invoice issue date in YYYY-MM-DD format"
      },
      "seller_name": {
        "type": "string",
        "description": "Name of the issuing company"
      },
      "buyer_name": {
        "type": "string",
        "description": "Name of the purchasing company"
      },
      "total_amount": {
        "type": "number",
        "description": "Total amount including all taxes"
      }
    },
    "required": ["invoice_number", "issue_date", "seller_name", "total_amount"],
    "type": "object"
  }
}
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:
curl -X POST https://api.anycheck.ai/verifications \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "service_id": "<document-extraction-service-uuid>",
    "folder_id": "<folder-uuid>",
    "configuration": {
      "files": {
        "document_extraction_file": ["/uploads/invoice.pdf"]
      },
      "template_id": "<your-template-uuid>"
    }
  }'
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):
GET /forms/templates?search=invoice&page_size=20
For full template details (schema, instructions, config):
GET /templates/{id}

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.
curl -X PUT https://api.anycheck.ai/templates/{id} \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Invoice Extraction Template v2",
    "schema": {
      "invoice_number": { "type": "string" },
      "issue_date": { "type": "string" },
      "total_amount": { "type": "number" },
      "npwp_seller": { "type": "string", "description": "Seller NPWP number" }
    }
  }'

Delete a template

DELETE /templates/{id}
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:
FieldRequiredDescription
typeYesData type: string, number, boolean, array, object
descriptionRecommendedWhat this field represents; helps guide extraction
requiredNoMark in the root required array if the field must be present
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:
preset_modeSpeedAccuracyCostBest for
FASTFastestGoodLowHigh-volume, simple documents
BALANCEDFastBetterMediumMost use cases
PRECISESlowerBestHighComplex or dense documents
BUDGETFastGoodLowestCost-sensitive workloads
{
  "config": {
    "preset_mode": "BALANCED"
  }
}

Individual settings

For finer control, configure each setting separately:
FieldValuesDefaultDescription
extraction_modeFREYA, FREYA_PRO, ODIN, ODIN_PRO, NEXUS, NEXUS_PROFREYAAI model used for extraction
parser_modeLITE, PLUS, PROLITEDocument parsing quality before AI extraction
use_parsertrue, falsefalseParse document structure before sending to AI
use_chunktrue, falsefalseSplit large documents into chunks (requires use_parser: true)
enable_citationstrue, falsetrueInclude source location in extracted values
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.