Skip to content

POST /v1/schemas

POST https://api.deskew.dev/v1/schemas

Stores a schema in the key’s project. Reference it from POST /v1/extract with schema=<name>. Requires extract:write. See the fields and schemas guide for how extraction uses it.

application/json:

Field Type Rules
name string 1–80 characters, [A-Za-z0-9_-] only. Reusing a name creates the next version
json_schema object A JSON Schema with "type": "object" at the top level
Terminal window
curl https://api.deskew.dev/v1/schemas \
-H "Authorization: Bearer $DESKEW_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "receipt-v1",
"json_schema": {
"type": "object",
"properties": {
"merchant": { "type": "string" },
"purchased_at": { "type": "string", "description": "ISO 8601 date-time" },
"total": { "type": "number", "description": "Total paid including tax" },
"currency": { "type": "string" },
"payment_method": { "type": "string", "enum": ["card", "cash", "other"] }
},
"required": ["merchant", "total"]
}
}'

201 Created:

{
"id": "sch_01JE4KH8W9X0Y1Z2A3B4C5D6E7",
"name": "receipt-v1",
"version": 1,
"json_schema": {
"type": "object",
"properties": {
"merchant": { "type": "string" },
"purchased_at": { "type": "string", "description": "ISO 8601 date-time" },
"total": { "type": "number", "description": "Total paid including tax" },
"currency": { "type": "string" },
"payment_method": { "type": "string", "enum": ["card", "cash", "other"] }
},
"required": ["merchant", "total"]
}
}
Status Code When
403 insufficient_scope Key lacks extract:write
422 validation_error name malformed, json_schema missing, or json_schema.type is not object
401 / 429 Authentication, rate limit