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

# Count Searches

GET https://acme.captain.dev/v1/indexes/{index}/analytics/searches/count

Count searches in a period, in total and per day.

Reference: https://docs.captain.dev/reference/product-search/analytics/count-searches

## Authentication

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

## Request

### Path parameters

- `index` (string, required) — index name

### Query parameters

- `start_date` (string, optional) — first day, UTC, inclusive (YYYY-MM-DD). Default: 6 days before end_date (a 7-day window)
- `end_date` (string, optional) — last day, UTC, inclusive (YYYY-MM-DD). Default: today. At most 366 days from start_date
- `start_time` (string, optional) — an exact start instead of start_date: unix seconds, or ISO 8601 in UTC (2026-10-10T10:00:00Z). start_date and end_date in the reply are then the UTC days the window touches
- `end_time` (string, optional) — an exact end (exclusive): unix seconds or ISO 8601 with Z. Default: now; never later than now. Must be after start_time

## Response

### 200

report

- `start_date` (string, required)
- `end_date` (string, required)
- `count` (integer, required)
- `dates` (list of V1IndexesIndexAnalyticsSearchesCountGetResponsesContentApplicationJsonSchemaDatesItems, required) — every day of the window, oldest first
- `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`
- `counted_through` (double, optional, nullable) — the time (unix seconds) of the last record counted, when partial

## Types

### V1IndexesIndexAnalyticsSearchesCountGetResponsesContentApplicationJsonSchemaDatesItems

- `date` (string, required)
- `count` (integer, required)

## Examples

**Response**

```json
{
  "start_date": "2026-09-22",
  "end_date": "2026-09-28",
  "count": 9604,
  "dates": [
    {
      "date": "2026-09-22",
      "count": 1302
    },
    {
      "date": "2026-09-23",
      "count": 1288
    },
    {
      "date": "2026-09-24",
      "count": 1411
    },
    {
      "date": "2026-09-25",
      "count": 1397
    },
    {
      "date": "2026-09-26",
      "count": 1356
    },
    {
      "date": "2026-09-27",
      "count": 1420
    },
    {
      "date": "2026-09-28",
      "count": 1430
    }
  ]
}
```

**SDK Code**

```python Python REST
import json
import requests

BASE_URL = "https://acme.captain.dev"
API_KEY = "your_search_key"
INDEX = "products"

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

response = requests.get(
    f"{BASE_URL}/v1/indexes/{INDEX}/analytics/searches/count",
    headers=headers,
    params={"start_date": "2026-09-22", "end_date": "2026-09-28"},
    timeout=30.0,
)

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

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

const params = new URLSearchParams({ start_date: "2026-09-22", end_date: "2026-09-28" });

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

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