Overview
Document templates allow you to define reusable configurations for document processing. Templates include extraction schemas, fraud detection settings, and other processing parameters that can be applied to multiple documents. Templates are particularly useful when you process similar documents repeatedly, as they eliminate the need to specify configuration for each document individually.Benefits of Using Templates
- Consistency: Ensure all documents of the same type are processed with identical settings
- Efficiency: Avoid repeating configuration in every document creation request
- Maintainability: Update template settings once to affect all future documents using that template
- Organization: Group related processing configurations together
Creating a Template
1
Define the extraction schema
Create a JSON Schema that defines the structure of data you want to extract from documents. The schema must follow our Schema rules.
2
Configure extraction and fraud detection
Set up your extraction and fraud detection preferences:
3
Create the template via API
Use the Create Document Template endpoint to create your template:The response includes the template ID which you’ll use when creating documents.
Listing Templates
Retrieve all available templates using the List Document Templates endpoint:Filtering Options
- Active templates only:
?filter[is_active]=true - Published templates:
?filter[status]=published - Pagination: Use
page[size]to control results per page (default: 15, max: 100)
Example Response
Retrieving a Template
Get detailed information about a specific template using the Get Document Template endpoint:Updating a Template
Modify an existing template using the Update Document Template endpoint:Using Templates with Documents
When creating a document, reference a template by providing thedocument_template_id:
Best Practices
Template Organization
Template Organization
- Use descriptive names that clearly indicate the document type (e.g., “Invoice Processing”, “Contract Analysis”)
- Include detailed descriptions explaining when to use each template
Schema Design
Schema Design
- Start with essential fields and expand as needed
- Use
descriptionfields to provide context for extraction - Remember that fields must be nullable:
"type": ["string", "null"]
Error Handling
Error Handling
- Test templates with sample documents before using in production
- Monitor template usage to identify which templates need updates