curl -X POST "https://api.clevrscan.com/api/templates" \
-H "X-API-Key: <api_key>" \
-F "file=@invoice.pdf" \
-F "name=General" \
-F "description=Invoice" \
-F "extractFields=[\"Company Name\",\"Company Address\",\"Bill To\",\"Ship To\",\"Invoice Number\",\"Invoice Date\",\"P.O. Number\",\"Due Date\",\"Invoice Total\",\"Quantity\",\"Description\",\"Unit Price\",\"Amount\",\"Subtotal\",\"GST\",\"Terms & Conditions\",\"Payment Due Date\",\"Bank Name\",\"Account Number\",\"Routing Number\"]" \
-F "instructions="
{
"message": "Template created successfully",
"template_id": 396
}
Template Endpoints
Create Template
Uploads a new document template definition with fields and processing instructions. Returns the created template metadata.
POST
/
api
/
templates
curl -X POST "https://api.clevrscan.com/api/templates" \
-H "X-API-Key: <api_key>" \
-F "file=@invoice.pdf" \
-F "name=General" \
-F "description=Invoice" \
-F "extractFields=[\"Company Name\",\"Company Address\",\"Bill To\",\"Ship To\",\"Invoice Number\",\"Invoice Date\",\"P.O. Number\",\"Due Date\",\"Invoice Total\",\"Quantity\",\"Description\",\"Unit Price\",\"Amount\",\"Subtotal\",\"GST\",\"Terms & Conditions\",\"Payment Due Date\",\"Bank Name\",\"Account Number\",\"Routing Number\"]" \
-F "instructions="
{
"message": "Template created successfully",
"template_id": 396
}
Request Format
Option 1:Multipart Form DataPOST /api/templates
Content-Type: multipart/form-data
X-API-Key: <api_key>
file: <binary file>
name: <template name>
description: <template description>
extractFields: ["field1", "field2", ...]
instructions: <optional custom instructions>
Parameters
| Parameter | Type | Required | Location | Description |
|---|---|---|---|---|
| file | File | Yes | Body | Document file (sample PDF/image) used to define the template |
| name | String | Yes | Body | Template name (e.g., "General") |
| description | String | Yes | Body | Short description of the template (e.g., "Invoice") |
| extractFields | String[] | Yes | Body | List of fields to extract (e.g., company name, invoice total, due date, …) |
| instructions | String | No | Body | Additional processing instructions (custom rules or extraction logic) |
| api_key | String | Yes | Header | API key |
extractFields must be passed as a JSON array string.
curl -X POST "https://api.clevrscan.com/api/templates" \
-H "X-API-Key: <api_key>" \
-F "file=@invoice.pdf" \
-F "name=General" \
-F "description=Invoice" \
-F "extractFields=[\"Company Name\",\"Company Address\",\"Bill To\",\"Ship To\",\"Invoice Number\",\"Invoice Date\",\"P.O. Number\",\"Due Date\",\"Invoice Total\",\"Quantity\",\"Description\",\"Unit Price\",\"Amount\",\"Subtotal\",\"GST\",\"Terms & Conditions\",\"Payment Due Date\",\"Bank Name\",\"Account Number\",\"Routing Number\"]" \
-F "instructions="
{
"message": "Template created successfully",
"template_id": 396
}
⌘I