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

# Delete Record

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

Delete one record. It leaves search results, browse totals and Get Records within about a second. To delete several, use Update Records with `delete`.

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

## 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
- `record_id` (string, required)

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

### 202

accepted

- `job_id` (string, optional) — the write job this change belongs to (GET /v1/jobs/\{job\_id}); writes to one index with one key within 250 ms share a job
- `live_updates` (enum, optional) — Live updates apply only on the region that accepted them.
  - Allowed values: `single_region`
- `regions_applied` (list of string, optional) — The region where this update applies, within about a second (GET .../updates shows when).
- `regions_pending` (list of string, optional) — Regions without this update until the index's next build is published and restored there.
- `replicates_on_next_build` (boolean, optional) — True when builds are published to every region: the next build started after this update carries it everywhere (one accepted while a build runs waits for the build after).
- `index` (string, optional)
- `seq` (integer, optional)
- `accepted_at` (double, optional)
- `updated` (integer, optional)
- `deleted` (integer, optional)
- `served` (boolean, optional) — true when this change applies to the served index within about a second; false when the index has no served build yet, or any record in waiting_for_build
- `not_found` (list of string, optional) — ids (in records or delete) that the index doesn't have, skipped rather than refused (the first 100). updated and deleted count only the records changed. Delete Record lists its id here when the index doesn't have it.
- `not_found_count` (integer, optional) — how many ids were skipped, past the first 100 too
- `readded` (list of string, optional) — ids (the first 100) whose update named a text or children field: merged into the stored record and added again, searchable when that add is
- `readded_count` (integer, optional)
- `waiting_for_build` (list of string, optional) — ids (the first 100) of records that are added but not yet built: this change reaches them with their build, not within a second
- `waiting_for_build_count` (integer, optional) — how many records are in waiting_for_build, past the first 100 too
- `stale_until_build` (list of string, optional) — fields updated for filters, facets and sort at once, whose words keyword search matches only after the next build
- `stale_features_until_build` (list of enum, optional) — what still reflects the data before this update until the next build: typeahead, spelling and search_evidence (the no-typed-word answer) keep a deleted record's words and do not learn a changed value's words; hit_display: values shown on hits from the record's mapped roles (rating, price, title...). Filters, sort, facets, hit.fields and GET change at once
  - Allowed values: `typeahead`, `spelling`, `search_evidence`, `hit_display`

## Examples

**Response**

```json
{
  "live_updates": "single_region",
  "regions_applied": [
    "us-east-1"
  ],
  "regions_pending": [
    "us-west-1",
    "us-east-2"
  ],
  "replicates_on_next_build": true,
  "index": "products",
  "seq": 1844,
  "accepted_at": 1759095402.117,
  "updated": 0,
  "deleted": 1,
  "served": true
}
```

**SDK Code**

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

BASE_URL = "https://acme.captain.dev"
API_KEY = "your_write_key"
INDEX = "products"
RECORD_ID = "sku-10482"

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

response = requests.delete(
    f"{BASE_URL}/v1/indexes/{INDEX}/records/{RECORD_ID}",
    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 recordId = "sku-10482";

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

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