Generate Schema
curl --request POST \
--url https://{base_url}/autoschema \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"description": "Extract invoice number, date, vendor name, and line items as an array"
}
'{
"schema": {
"properties": {
"currency": {
"description": "Currency code used in the invoice (e.g., USD, EUR).",
"type": "string"
},
"customer_address": {
"description": "Address of the customer or recipient.",
"type": "string"
},
"customer_name": {
"description": "Name of the customer or recipient of the invoice.",
"type": "string"
},
"discount": {
"description": "Total discount applied to the invoice.",
"type": "number"
},
"due_date": {
"description": "Date by which the invoice should be paid, in YYYY-MM-DD format.",
"type": "string"
},
"invoice_date": {
"description": "Date when the invoice was issued, in YYYY-MM-DD format.",
"type": "string"
},
"invoice_number": {
"description": "Unique identifier assigned to the invoice.",
"type": "string"
},
"line_items": {
"description": "List of items or services billed in the invoice.",
"items": {
"properties": {
"description": {
"description": "Description of the item or service.",
"type": "string"
},
"quantity": {
"description": "Quantity of the item or service.",
"type": "number"
},
"total": {
"description": "Total price for this line item.",
"type": "number"
},
"unit_price": {
"description": "Price per unit of the item or service.",
"type": "number"
}
},
"required": [
"description",
"quantity",
"unit_price",
"total"
],
"type": "object"
},
"type": "array"
},
"subtotal": {
"description": "Subtotal amount before taxes and discounts.",
"type": "number"
},
"tax": {
"description": "Total tax amount applied to the invoice.",
"type": "number"
},
"total_amount": {
"description": "Total amount due for the invoice after taxes and discounts.",
"type": "number"
},
"vendor_address": {
"description": "Address of the vendor or supplier.",
"type": "string"
},
"vendor_name": {
"description": "Name of the vendor or supplier issuing the invoice.",
"type": "string"
}
},
"required": [
"invoice_number",
"invoice_date",
"vendor_name",
"customer_name",
"line_items",
"subtotal",
"tax",
"total_amount",
"currency"
],
"type": "object"
}
}Document Processing
Generate Schema
Generate a JSON schema from a natural language description.
Supports two modes:
- JSON mode: Send description only (without sample document)
- Multipart mode: Send description with sample document file for better schema generation
When a sample document is provided, the system uses direct vision extraction on the first 3 pages (or all pages if the document has fewer than 3 pages). This extracted content is used as additional context to generate a more accurate schema that matches your document structure.
POST
/
autoschema
Generate Schema
curl --request POST \
--url https://{base_url}/autoschema \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"description": "Extract invoice number, date, vendor name, and line items as an array"
}
'{
"schema": {
"properties": {
"currency": {
"description": "Currency code used in the invoice (e.g., USD, EUR).",
"type": "string"
},
"customer_address": {
"description": "Address of the customer or recipient.",
"type": "string"
},
"customer_name": {
"description": "Name of the customer or recipient of the invoice.",
"type": "string"
},
"discount": {
"description": "Total discount applied to the invoice.",
"type": "number"
},
"due_date": {
"description": "Date by which the invoice should be paid, in YYYY-MM-DD format.",
"type": "string"
},
"invoice_date": {
"description": "Date when the invoice was issued, in YYYY-MM-DD format.",
"type": "string"
},
"invoice_number": {
"description": "Unique identifier assigned to the invoice.",
"type": "string"
},
"line_items": {
"description": "List of items or services billed in the invoice.",
"items": {
"properties": {
"description": {
"description": "Description of the item or service.",
"type": "string"
},
"quantity": {
"description": "Quantity of the item or service.",
"type": "number"
},
"total": {
"description": "Total price for this line item.",
"type": "number"
},
"unit_price": {
"description": "Price per unit of the item or service.",
"type": "number"
}
},
"required": [
"description",
"quantity",
"unit_price",
"total"
],
"type": "object"
},
"type": "array"
},
"subtotal": {
"description": "Subtotal amount before taxes and discounts.",
"type": "number"
},
"tax": {
"description": "Total tax amount applied to the invoice.",
"type": "number"
},
"total_amount": {
"description": "Total amount due for the invoice after taxes and discounts.",
"type": "number"
},
"vendor_address": {
"description": "Address of the vendor or supplier.",
"type": "string"
},
"vendor_name": {
"description": "Name of the vendor or supplier issuing the invoice.",
"type": "string"
}
},
"required": [
"invoice_number",
"invoice_date",
"vendor_name",
"customer_name",
"line_items",
"subtotal",
"tax",
"total_amount",
"currency"
],
"type": "object"
}
}Authorizations
API key for authentication
Body
application/jsonmultipart/form-data
Plain language description of required fields and structure
Example:
"Extract invoice number, date, vendor name, and line items as an array"
Response
Generated JSON schema
Generated JSON schema for document extraction
Was this page helpful?
⌘I