Logo ExelensiaExelensia/Docs
Getting Started
  • Introduction
API Reference
  • Schemas
  • Templates
  • Upload
  • Process
  • Files
  • Results
  • Exports

Schemas

Schemas define the structure of data you want to extract from your documents. Each schema contains a set of field definitions that tell the extraction engine what to look for. Once created, a schema can be reused across multiple documents.

Endpoints

GET /v1/schemas

Returns a paginated list of extraction schemas belonging to your team.

Query Parameters

ParameterTypeRequiredDefaultDescription
pagenumberNo1Page number (min: 1)
limitnumberNo20Items per page (min: 1, max: 100)
sort_bystringNo—Field to sort by (e.g. createdAt)
sort_orderstringNodescSort direction: asc or desc
searchstringNo—Filter by schema name
created_afterstringNo—ISO 8601 date — return schemas created after this date
created_beforestringNo—ISO 8601 date — return schemas created before this date
fieldsstringNo—Comma-separated list of fields to return
includestringNo—Related resources to include

Request

Bash
curl -H "x-api-key: your_api_key_here" \
  "https://api.exelensia.com/v1/schemas?page=1&limit=20"

Response

JSON
{
  "data": [
    {
      "id": "019760a0-0001-7000-8000-000000000001",
      "name": "Invoice Schema",
      "description": "Extract invoice number, date, total, and line items",
      "schema": {
        "fields": [
          { "key": "invoice_number", "type": "string", "label": "Invoice Number" },
          { "key": "date", "type": "date", "label": "Invoice Date" },
          { "key": "total", "type": "number", "label": "Total Amount" },
          { "key": "vendor_name", "type": "string", "label": "Vendor Name" }
        ]
      },
      "createdAt": "2024-01-15T10:30:00.000Z",
      "updatedAt": "2024-01-15T10:30:00.000Z"
    }
  ],
  "meta": {
    "page": 1,
    "limit": 20,
    "total": 1,
    "totalPages": 1
  }
}

Status Codes

StatusDescription
200Success
401Missing or invalid authentication

GET /v1/schemas/:id

Returns a single schema by ID.

Path Parameters

ParameterTypeRequiredDescription
idstringYesSchema UUID

Request

Bash
curl -H "x-api-key: your_api_key_here" \
  "https://api.exelensia.com/v1/schemas/019760a0-0001-7000-8000-000000000001"

Response

JSON
{
  "id": "019760a0-0001-7000-8000-000000000001",
  "name": "Invoice Schema",
  "description": "Extract invoice number, date, total, and line items",
  "schema": {
    "fields": [
      { "key": "invoice_number", "type": "string", "label": "Invoice Number" },
      { "key": "date", "type": "date", "label": "Invoice Date" },
      { "key": "total", "type": "number", "label": "Total Amount" },
      { "key": "vendor_name", "type": "string", "label": "Vendor Name" }
    ]
  },
  "createdAt": "2024-01-15T10:30:00.000Z",
  "updatedAt": "2024-01-15T10:30:00.000Z"
}

Status Codes

StatusDescription
200Success
401Missing or invalid authentication
404Schema not found

POST /v1/schemas

Creates a new extraction schema.

Request Body

FieldTypeRequiredDescription
namestringYesHuman-readable schema name
descriptionstringNoOptional description
schemaobjectYesSchema definition object containing field definitions
Bash
curl -X POST \
  -H "x-api-key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Contract Schema",
    "description": "Extract key contract fields",
    "schema": {
      "fields": [
        { "key": "party_a", "type": "string", "label": "First Party" },
        { "key": "party_b", "type": "string", "label": "Second Party" },
        { "key": "effective_date", "type": "date", "label": "Effective Date" },
        { "key": "value", "type": "number", "label": "Contract Value" }
      ]
    }
  }' \
  "https://api.exelensia.com/v1/schemas"

Response

JSON
{
  "id": "019760a0-0002-7000-8000-000000000002",
  "name": "Contract Schema",
  "description": "Extract key contract fields",
  "schema": {
    "fields": [
      { "key": "party_a", "type": "string", "label": "First Party" },
      { "key": "party_b", "type": "string", "label": "Second Party" },
      { "key": "effective_date", "type": "date", "label": "Effective Date" },
      { "key": "value", "type": "number", "label": "Contract Value" }
    ]
  },
  "createdAt": "2024-01-16T08:00:00.000Z",
  "updatedAt": "2024-01-16T08:00:00.000Z"
}

Status Codes

StatusDescription
201Schema created
400Invalid request body
401Missing or invalid authentication

DELETE /v1/schemas/:id

Deletes a schema by ID.

Path Parameters

ParameterTypeRequiredDescription
idstringYesSchema UUID

Request

Bash
curl -X DELETE \
  -H "x-api-key: your_api_key_here" \
  "https://api.exelensia.com/v1/schemas/019760a0-0001-7000-8000-000000000001"

Response

JSON
{
  "message": "Schema deleted successfully"
}

Status Codes

StatusDescription
200Schema deleted
401Missing or invalid authentication
404Schema not found

On this page

  • Endpoints
  • GET /v1/schemas
  • GET /v1/schemas/:id
  • POST /v1/schemas
  • DELETE /v1/schemas/:id