Skip to main content
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

X-API-Key
string
header
required

API key for authentication

Body

description
string
required

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

schema
object

Generated JSON schema for document extraction