> For a complete page index of the Captain API documentation, fetch https://docs.captain.dev/llms.txt?excludeSpec=true

# List Latency Collections

GET https://api.captain.dev/v2/queries/latency/collections

The collections that ran queries in the window, most active first.

For organizations with more collections than the metrics response returns
series for, so a picker can search the rest without asking for every
series at once.

Reference: https://docs.captain.dev/reference/queries/latency/collections

## Request

### Query parameters

- `from` (string, optional, nullable)
- `to` (string, optional, nullable)
- `search` (string, optional, nullable) — Case-insensitive substring match on the collection name.
- `limit` (integer, optional, default: 25)
- `offset` (integer, optional, default: 0)
- `collection` (string, optional, nullable)
- `api_version` (string, optional, nullable)
- `rerank` (string, optional, nullable)
- `search_mode` (string, optional, nullable)
- `has_filter` (string, optional, nullable)

## Response

### 200

Successful Response

- `has_more` (boolean, required)
- `limit` (integer, required)
- `offset` (integer, required)
- `total` (integer, required) — Distinct collections matching the window and filters.
- `collections` (list of LatencyCollectionFacetV2, optional)

## Errors

### 400 Bad Request Error

Missing or invalid window, filter value, or bin count.

- `code` (string, required) — Stable error code, for example `invalid_time_range`.
- `message` (string, required) — What went wrong.
- `path` (string, required) — The request path.

### 401 Unauthorized Error

Missing or invalid API key.

- `error` (string, required) — Error kind. `HTTP_ERROR` for errors raised by the route.
- `message` (string, required) — What went wrong.
- `path` (string, required) — The request path.
- `status_code` (integer, optional) — The HTTP status code.

### 403 Forbidden Error

The API key does not have query permission.

- `error` (string, required) — Error kind. `HTTP_ERROR` for errors raised by the route.
- `message` (string, required) — What went wrong.
- `path` (string, required) — The request path.
- `status_code` (integer, optional) — The HTTP status code.

### 422 Unprocessable Entity Error

Validation Error

- `error` (string, required) — `VALIDATION_ERROR`.
- `message` (string, required)
- `details` (list of V2QueriesLatencyCollectionsGetResponsesContentApplicationJsonSchemaDetailsItems, required) — One entry per invalid field, with `type`, `loc` and `msg`.
- `path` (string, required)

### 503 Service Unavailable Error

Analytics are unavailable; no metrics were computed.

- `error` (string, required) — Error kind. `HTTP_ERROR` for errors raised by the route.
- `message` (string, required) — What went wrong.
- `path` (string, required) — The request path.
- `status_code` (integer, optional) — The HTTP status code.

## Types

### LatencyCollectionFacetV2

- `collection_name` (string, required)
- `query_count` (integer, required)

### V2QueriesLatencyCollectionsGetResponsesContentApplicationJsonSchemaDetailsItems

## Examples

**Response**

```json
{
  "has_more": true,
  "limit": 3,
  "offset": 0,
  "total": 12,
  "collections": [
    {
      "collection_name": "customer_forms",
      "query_count": 1902
    },
    {
      "collection_name": "policy_library",
      "query_count": 512
    },
    {
      "collection_name": "onboarding_docs",
      "query_count": 197
    }
  ]
}
```

**SDK Code**

```python Python
import requests

BASE_URL = "https://api.captain.dev"
API_KEY = "your_api_key"

response = requests.get(
    f"{BASE_URL}/v2/queries/latency/collections",
    headers={"Authorization": f"Bearer {API_KEY}"},
    params={
        "from": "2026-09-01",
        "to": "2026-09-08",
        "limit": 3,
    },
    timeout=30.0
)

if response.status_code == 200:
    data = response.json()
    for c in data["collections"]:
        print(f"{c['collection_name']:24s} {c['query_count']:6d} queries")
    if data["has_more"]:
        print(f"Showing {len(data['collections'])} of {data['total']}; "
              f"raise offset to {data['offset'] + data['limit']} for the next page")
else:
    print(f"Error: {response.status_code}")
```

```typescript TypeScript
const BASE_URL = "https://api.captain.dev";
const API_KEY = "your_api_key";

type Facets = {
    collections: { collection_name: string; query_count: number }[];
    total: number;
    limit: number;
    offset: number;
    has_more: boolean;
};

const query = new URLSearchParams({
    from: "2026-09-01",
    to: "2026-09-08",
    limit: "3"
});

const response = await fetch(
    `${BASE_URL}/v2/queries/latency/collections?${query}`,
    { headers: { Authorization: `Bearer ${API_KEY}` } }
);

if (response.ok) {
    const data: Facets = await response.json();
    for (const c of data.collections) {
        console.log(`${c.collection_name}  ${c.query_count} queries`);
    }
    if (data.has_more) {
        console.log(
            `Showing ${data.collections.length} of ${data.total}; ` +
            `raise offset to ${data.offset + data.limit} for the next page`
        );
    }
} else {
    console.error(`Error: ${response.status}`);
}
```