Schemas
Schemas define what data to extract from documents. Create a schema once, then use it across many documents.
The schema object
{
"id": "s1a2b3c4-...",
"object": "schema",
"name": "Invoice Schema",
"description": "Extract key invoice fields",
"fields": [
{ "name": "vendor", "type": "string", "description": "Vendor name" },
{ "name": "total", "type": "number", "description": "Invoice total" },
{ "name": "date", "type": "string", "description": "Invoice date" }
],
"created": 1710000000
}Field types
| Type | Description |
|---|---|
string | Free-form text |
number | Numeric value |
boolean | True / false |
date | Date string |
array | List of values |
object | Nested structure |
Create a schema
POST /v1/schemas| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Schema name |
description | string | no | What this schema extracts |
fields | array | no | Array of field definitions |
instructions | string | no | Additional extraction instructions |
curl https://docld.com/api/v1/schemas \
-H "Authorization: Bearer docld_..." \
-H "Content-Type: application/json" \
-d '{
"name": "Invoice Schema",
"fields": [
{"name": "vendor", "type": "string"},
{"name": "total", "type": "number"},
{"name": "date", "type": "string"}
]
}'List schemas
GET /v1/schemascurl https://docld.com/api/v1/schemas \
-H "Authorization: Bearer docld_..."Retrieve a schema
GET /v1/schemas/:idUpdate a schema
POST /v1/schemas/:idSend only the fields you want to change.
curl https://docld.com/api/v1/schemas/s1a2b3c4-... \
-H "Authorization: Bearer docld_..." \
-H "Content-Type: application/json" \
-d '{"name": "Invoice Schema v2"}'Delete a schema
DELETE /v1/schemas/:id{
"id": "s1a2b3c4-...",
"object": "schema",
"deleted": true
}Last updated on