curl -X POST https://api.okrapdf.com/v1/documents/doc-abc123/structured-output \
-H "Authorization: Bearer $OKRA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Extract invoice fields.",
"schema": {
"type": "object",
"properties": {
"vendor": { "type": "string" },
"total": { "type": "number" }
},
"required": ["vendor", "total"]
}
}'
AI
Structured Output
Extract JSON from a document using a JSON Schema.
POST
/
v1
/
documents
/
{id}
/
structured-output
curl -X POST https://api.okrapdf.com/v1/documents/doc-abc123/structured-output \
-H "Authorization: Bearer $OKRA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Extract invoice fields.",
"schema": {
"type": "object",
"properties": {
"vendor": { "type": "string" },
"total": { "type": "number" }
},
"required": ["vendor", "total"]
}
}'
Overview
Extracts data from a processed document and validates the result against a JSON Schema.string
required
Document ID.
string
required
Natural-language extraction instruction.
object
required
JSON Schema for the desired output.
curl -X POST https://api.okrapdf.com/v1/documents/doc-abc123/structured-output \
-H "Authorization: Bearer $OKRA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Extract invoice fields.",
"schema": {
"type": "object",
"properties": {
"vendor": { "type": "string" },
"total": { "type": "number" }
},
"required": ["vendor", "total"]
}
}'