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

# Collections

> Query across a collection of documents from the CLI.

A **collection** groups documents so you can ask one question across all of them. From the CLI you **list** collections and **query** them. Collections themselves are created and managed in the [web app](/web/overview) or via the [Collections API](/api-reference/collections/create-collection) — there is no `okra collections create`.

## Commands

```bash theme={null}
okra collections list                          # list your collections
okra collections query <name-or-id> "<question>"  # ask one question across the collection
```

<Tip>
  `collections` accepts either a **collection name** or a **collection ID** (`col-...`). The CLI tries ID lookup first, then falls back to name.
</Tip>

## List collections

```bash theme={null}
okra collections list
okra collections list --json
```

## Query a collection

`okra collections query` fans the same question out across every document in the collection and returns the combined result.

```bash theme={null}
okra collections query earnings "What changed quarter over quarter?"

# Write the result to a file (CSV / JSON inferred from extension)
okra collections query earnings "What changed quarter over quarter?" -o earnings.csv
```

| Flag              | Description                                                          |
| ----------------- | -------------------------------------------------------------------- |
| `--schema <file>` | **Experimental.** JSON Schema file for structured fan-out extraction |

```bash theme={null}
# Experimental structured fan-out
okra collections query earnings "Extract revenue and net income" --schema ./schema.json
```

## Creating and publishing collections

Creating a collection, adding or removing documents, and publishing a collection to a public URL are not CLI operations:

* **Create / manage** — use the [web app](/web/overview) or `POST /v1/collections` (see [Create a collection](/api-reference/collections/create-collection)).
* **Publish** — publishing to a public URL asserts that you own or are licensed to publish the content, so it is a deliberate, gated action in the web app, not a one-line CLI flag.

<Info>
  Public collection pages live at `okrapdf.com/c/<slug>`. They are part of the free, read-only public tier — see the [web overview](/web/overview) for how the surfaces relate.
</Info>
