curl --request POST \
--url https://extraction-api.nanonets.com/api/v2/classify/sync \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "file://a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"classification_config": {
"categories": [
{
"name": "Invoice",
"description": "Bills and invoices"
},
{
"name": "Receipt",
"description": "Payment receipts"
},
{
"name": "Contract",
"description": "Legal agreements"
}
],
"mode": "document"
}
}
'{
"success": true,
"message": "Document classified successfully",
"status": "completed",
"result": {
"filename": "invoice.pdf",
"total_pages": 3,
"mode": "document",
"document_category": "Invoice",
"confidence": 92.5,
"reasoning": "Page 1: Contains invoice header with vendor details; Page 2: Itemized list of products with pricing"
},
"processing_time": 1.5,
"filename": "invoice.pdf"
}Document Classification
Synchronous Classification
Classify a document into predefined categories synchronously.
Modes:
document— Returns a single best-fit category for the whole document with confidence and reasoning.split— Classifies each page individually and groups pages by category. A page can appear in multiple categories (multi-label).
Provide categories inline via classification_config or reference a saved classify config via config_id.
Tip: You can save and reuse classification settings (categories & mode) by creating a config via Create Config. Pass the returned
config_idinstead of repeatingclassification_configeach time.
POST
/
api
/
v2
/
classify
/
sync
curl --request POST \
--url https://extraction-api.nanonets.com/api/v2/classify/sync \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "file://a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"classification_config": {
"categories": [
{
"name": "Invoice",
"description": "Bills and invoices"
},
{
"name": "Receipt",
"description": "Payment receipts"
},
{
"name": "Contract",
"description": "Legal agreements"
}
],
"mode": "document"
}
}
'{
"success": true,
"message": "Document classified successfully",
"status": "completed",
"result": {
"filename": "invoice.pdf",
"total_pages": 3,
"mode": "document",
"document_category": "Invoice",
"confidence": 92.5,
"reasoning": "Page 1: Contains invoice header with vendor details; Page 2: Itemized list of products with pricing"
},
"processing_time": 1.5,
"filename": "invoice.pdf"
}Authorizations
API key as Bearer token: Authorization: Bearer YOUR_API_KEY
Body
application/json
Response
Classification completed
Available options:
completed, processing, failed Classification result (shape depends on mode)
- Option 1
- Option 2
Show child attributes
Show child attributes
Time in seconds
Size in bytes