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

# Get Usage

GET https://acme.captain.dev/v1/usage

Records held and searched, per index and in total, over the last `days` days.

Reference: https://docs.captain.dev/reference/product-search/indexes/get-usage

## Authentication

- `Authorization` header (bearer token, required) — A write key, issued by Captain. Server side only. Sent as Authorization: Bearer \<key>.

## Request

### Query parameters

- `days` (integer, optional, default: 30)

## Response

### 200

usage

- `days` (integer, optional)
- `start_date` (string, optional)
- `end_date` (string, optional)
- `indexes` (list of IndexUsage, optional)
- `total` (IndexUsage, optional)
- `partial` (boolean, optional) — true when the search log was too large to read whole within one request's budget: the numbers cover what was counted
- `partial_reason` (enum, optional) — row_budget: more searches than one request holds (500,000); time_budget: more than about 3.5 seconds of reading; counting (usage): days still being counted
  - Allowed values: `row_budget`, `time_budget`, `counting`

## Types

### IndexUsage

- `index` (string, optional)
- `indexes` (integer, optional) — total only
- `records` (integer, optional) — records held now
- `searchable_records` (integer, optional) — records in the build search serves
- `accepted_records` (integer, optional) — records added since the index was created, replacements included
- `accepted_bytes` (integer, optional) — bytes of those records, as sent
- `searches` (integer, optional) — searches in the window, a search's keystrokes counted once
- `search_requests` (integer, optional) — every search request in the window
- `events` (integer, optional) — click, conversion and view events in the window
- `partial` (boolean, optional) — true while some of this index's days are still being counted

## Examples

**Response**

```json
{
  "days": 30,
  "start_date": "2026-09-03",
  "end_date": "2026-10-02",
  "indexes": [
    {
      "index": "products",
      "records": 12840,
      "searchable_records": 12840,
      "accepted_records": 25920,
      "accepted_bytes": 41873022,
      "searches": 18211,
      "search_requests": 64120,
      "events": 2307,
      "partial": false
    }
  ],
  "total": {
    "indexes": 1,
    "records": 12840,
    "searchable_records": 12840,
    "accepted_records": 25920,
    "accepted_bytes": 41873022,
    "searches": 18211,
    "search_requests": 64120,
    "events": 2307
  },
  "partial": false
}
```

**SDK Code**

```python Python REST
import json
import requests

BASE_URL = "https://acme.captain.dev"
API_KEY = "your_write_key"

headers = {
    "Authorization": f"Bearer {API_KEY}",
}

response = requests.get(
    f"{BASE_URL}/v1/usage",
    headers=headers,
    params={"days": 30},
    timeout=30.0,
)

print(json.dumps(response.json(), indent=2))
```

```typescript TypeScript REST
const BASE_URL = "https://acme.captain.dev";
const API_KEY = "your_write_key";

const params = new URLSearchParams({ days: "30" });

const response = await fetch(`${BASE_URL}/v1/usage?${params}`, {
  method: "GET",
  headers: {
    Authorization: `Bearer ${API_KEY}`,
  },
});

const result = await response.json();
console.log(JSON.stringify(result, null, 2));
```