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

# Query Collection

> Run a natural-language query across all documents in a collection.

## Overview

Queries all documents in a collection using natural language. Supports optional streaming for real-time responses.

## Request

<ParamField path="id" type="string" required>
  Collection ID (`col-...`) or collection name.
</ParamField>

<ParamField body="query" type="string" required>
  Natural-language question to ask across the collection.
</ParamField>

<ParamField body="stream" type="boolean">
  When `true`, returns a streaming SSE response. Default `false`.
</ParamField>

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

### Response (200)

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