> ## Documentation Index
> Fetch the complete documentation index at: https://docs.okrapdf.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Structured Output

> Extract JSON from a document using a JSON Schema.

## 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.

```bash theme={null}
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"]
    }
  }'
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.