Skip to main content
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.
id
string
required
Document ID.
prompt
string
required
Natural-language extraction instruction.
schema
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"]
    }
  }'