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

# Algolia Clear Objects

POST https://acme.captain.dev/1/indexes/{index}/clear

Delete every object and keep the index, with a Captain write key.

Reference: https://docs.captain.dev/reference/product-search/algolia-compatibility/algolia-clear-objects

## Authentication

- `x-algolia-api-key` header (required) — A Captain key, as Algolia clients send it: a search key for queries, a write key for writes.
- `x-algolia-application-id` header (required) — Any value; the hostname selects the tenant.

## Request

### Path parameters

- `index` (string, required)

## Response

### 200

cleared

## Examples

**Response**

```json
{
  "updatedAt": "2026-10-02T19:31:00.004Z",
  "taskID": 12
}
```

**SDK Code**

```python Python REST
import json
import requests

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

headers = {
    "x-algolia-api-key": API_KEY,
    "x-algolia-application-id": "acme",
}

response = requests.post(
    f"{BASE_URL}/1/indexes/{INDEX}/clear",
    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-staging";

const response = await fetch(`${BASE_URL}/1/indexes/${index}/clear`, {
  method: "POST",
  headers: {
    "x-algolia-api-key": API_KEY,
    "x-algolia-application-id": "acme",
  },
});

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