Classify
AI taxonomy classification to categorize documents automatically.
The Classify module determines the category or class of a document out of a custom taxonomy list you define. It reads the document content and maps it to the most relevant class, enabling automated sorting and routing of incoming files.
┌─────────────────┐ ┌──────────────────────┐ ┌─────────────────┐
│ Incoming File │ ────► │ Taxonomy Engine │ ────► │ documentType: │
│ (e.g. Scanned │ │ [Invoice, Contract] │ │ "contract" │
│ legal form) │ └──────────────────────┘ └─────────────────┘
└─────────────────┘- Dynamic Taxonomy: Define your own categories using an enum-driven JSON Schema.
- Semantic Reasoning: The AI understands the context and intent, correctly classifying files even without specific keyword matches.
- Confidence Driven: Combine with custom instructions to handle "other" or "unknown" categories when a file doesn't fit the taxonomy.
🏗️ Configuration
The Classify module is defined within the classificationConfig block. It uses a JSON Schema to define the classification target (typically an enum).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
jsonSchema | object | Yes | A JSON Schema defining the taxonomy field (e.g., using enum). |
llmId | UUID | No | Reference to a pre-saved LLM configuration ID. |
llmConfig | object | No | Inline LLM configuration overrides. |
🛠️ Classification Operations
Classification is typically performed as part of a stateless process run. For a detailed technical reference of every field and parameter, see the API Process Reference.
Execute a Classification Run
To categorize documents, submit a process request to your workspace with a classificationConfig.
curl -X POST "https://api.axelered.com/v1/w/{workspace_id}/process" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"config": {
"classificationConfig": {
"jsonSchema": {
"type": "object",
"properties": {
"documentType": {
"type": "string",
"enum": ["invoice", "contract", "other"]
}
},
"required": ["documentType"]
}
}
},
"files": [
{
"url": "https://example.com/legal_form.pdf"
}
]
}'The classification result will be available via the classificationUrl returned in the task documents list once the run reaches a completed state.
Read & List Classifications
To retrieve classification results for your documents, use the following endpoints:
- List Classifications: Retrieve all classification results for a complete run.
- Read Document Classification: Directly access the classification result for a specific document.