Field Types
Fields define what information should be extracted from your documents. Defining fields and their data types properly is crucial for accuracy. The clearer the description of what you are trying to extract, the better.Basic Data Types
| Type | Description | Example Value |
|---|---|---|
string | Text values | "INV-001" |
integer | Whole numbers | 42 |
float | Decimal numbers | 1250.99 |
date | Date values (YYYY-MM-DD) | "2024-03-15" |
datetime | Date and time values | "2024-03-15T10:30:00Z" |
boolean | True/false values | true |
list | Array of values | ["item1", "item2"] |
object | Nested object structure | See below |
enum | Set of predefined choices | See below |
multi_select | Multiple choices from predefined options | See below |
UI to API Type Mapping
If you’re familiar with the anyformat UI, here’s how the field type names map to API types:| UI Name | API Type |
|---|---|
| Text | string |
| Decimal number | float |
| Integer number | integer |
| Date | date |
| Date & time | datetime |
| Yes / No | boolean |
| Select | enum |
| Multiselect | multi_select |
| Object (Subtable) | object |
Field Definition
Each field requires these properties:- name: Unique identifier for the field (use snake_case)
- description: Clear explanation of what to extract (helps AI accuracy)
- data_type: One of the types listed above
Object Fields
Useobject type to extract structured data with multiple nested properties. Object fields require a nested_fields array:
Complex Object Example
For documents like insurance policies with multiple coverage types:Enum Fields
Useenum type when the extracted value should be one of a predefined set of options. Enum fields require an enum_options array:
null.
Enum Best Practices
- Provide clear descriptions for each option to help the AI match correctly
- Keep options distinct - avoid overlapping definitions
- Use meaningful names that reflect the actual document terminology
Multi-Select Fields
Usemulti_select type when the extracted value can be multiple options from a predefined set. Like enum, it requires an enum_options array, but returns an array of matched values instead of a single value:
Multi-Select vs Enum
| Feature | enum | multi_select |
|---|---|---|
| Selection | Single value | Multiple values |
| Return type | string or null | array of strings |
| Use case | Mutually exclusive options | Non-exclusive categories |
Multi-Select Response Example
Complete Workflow Example
Here’s a complete workflow definition with various field types:Tips for Better Results
- Be specific in descriptions - “The invoice number, usually starting with INV-” is better than “Invoice number”
- Use appropriate types - Use
floatfor amounts,datefor dates, notstring - Keep field names consistent - Use snake_case naming convention
- Describe the location when helpful - “Total amount shown at the bottom right of the invoice”
