Skip to main content
POST
/
document
/
{documentId}
/
generate
cURL
curl -X POST https://api.okrapdf.com/document/my-doc/generate \
  -H "Authorization: Bearer okra_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "What is the total revenue?",
    "schema": {
      "type": "object",
      "properties": {
        "total_revenue": {"type": "string"}
      }
    },
    "mode": "sync"
  }'
{
  "data": {},
  "meta": {
    "confidence": 123,
    "model": "<string>",
    "durationMs": 123,
    "citations": [
      {
        "page": 123,
        "text": "<string>"
      }
    ],
    "cached": true
  }
}

Authorizations

Authorization
string
header
required

API key as Bearer token: Authorization: Bearer okra_xxx

Path Parameters

documentId
string
required

Document ID

Body

application/json
schema
object
required

JSON Schema defining the output structure

query
string

Natural language question to guide extraction

prompt
string

Alternative to query (same effect)

mode
enum<string>
default:auto
Available options:
sync,
async,
auto
timeoutMs
integer
default:45000
Required range: x <= 120000

Response

Extraction result

data
object

Extracted data matching the provided schema

meta
object