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

# Delete All Records

DELETE https://acme.captain.dev/v1/indexes/{index}/records

Empty the index and keep it, with its settings, synonyms and rules. Searches stop returning the records within about a second.

Reference: https://docs.captain.dev/reference/product-search/records/delete-all-records

## Authentication

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

## Request

### Path parameters

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

### Headers

- `Idempotency-Key` (string, optional) — Replays within 24 hours return the stored response (header Idempotent-Replayed: true). The same key on a different request answers 422. A concurrent duplicate answers 409. Failed requests do not keep the key.

## Response

### 200

nothing to delete, or nothing served yet

- `index` (string, optional)
- `job_id` (string, optional, nullable) — the write job (GET /v1/jobs/\{job\_id}); null when nothing was deleted
- `seq` (integer, optional) — searchable state reaches this change when applied_seq >= seq
- `matched` (integer, optional)
- `deleted` (integer, optional)
- `dry_run` (boolean, optional)
- `staged_records` (integer, optional) — records the index holds after the delete
- `accepted_at` (double, optional)

### 202

accepted: the served index empties within about a second

- `index` (string, optional)
- `job_id` (string, optional, nullable) — the write job (GET /v1/jobs/\{job\_id}); null when nothing was deleted
- `seq` (integer, optional) — searchable state reaches this change when applied_seq >= seq
- `matched` (integer, optional)
- `deleted` (integer, optional)
- `dry_run` (boolean, optional)
- `staged_records` (integer, optional) — records the index holds after the delete
- `accepted_at` (double, optional)

## Examples

**Response**

```json
{
  "index": "products",
  "job_id": "job_20261002184733_4d5e6f",
  "seq": 1853,
  "matched": 12626,
  "deleted": 12626,
  "staged_records": 0,
  "accepted_at": 1759430853.402
}
```

**SDK Code**

```python Python REST
import json
import requests
import uuid

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

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Idempotency-Key": str(uuid.uuid4()),
}

response = requests.delete(
    f"{BASE_URL}/v1/indexes/{INDEX}/records",
    headers=headers,
    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 index = "products";

const response = await fetch(`${BASE_URL}/v1/indexes/${index}/records`, {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
  },
});

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