Skip to main content
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

id
string
required
Collection ID (col-...) or collection name.
query
string
required
Natural-language question to ask across the collection.
stream
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
    }
  ]
}