curl -X POST https://api.okrapdf.com/v1/collections/col-40da068481cf4f248853507cba6be611/query \
-H "Authorization: Bearer okra_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "What was total revenue in Q4?"}'
Collections
Query Collection
Run a natural-language query across all documents in a collection.
POST
/
v1
/
collections
/
{id}
/
query
curl -X POST https://api.okrapdf.com/v1/collections/col-40da068481cf4f248853507cba6be611/query \
-H "Authorization: Bearer okra_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "What was total revenue in Q4?"}'
Overview
Queries all documents in a collection using natural language. Supports optional streaming for real-time responses.Request
string
required
Collection ID (
col-...) or collection name.string
required
Natural-language question to ask across the collection.
boolean
When
true, returns a streaming SSE response. Default false.curl -X POST https://api.okrapdf.com/v1/collections/col-40da068481cf4f248853507cba6be611/query \
-H "Authorization: Bearer okra_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "What was total revenue in Q4?"}'
Response (200)
{
"answer": "Total revenue in Q4 was $4.2B, a 12% increase year-over-year.",
"sources": [
{
"doc_id": "doc-abc123",
"file_name": "10k.pdf",
"page": 15
}
]
}