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

# Algolia Get Task

GET https://acme.captain.dev/1/indexes/{index}/task/{taskID}

`published` once search has applied the write with that `taskID`. Algolia clients' waitTask calls it.

Reference: https://docs.captain.dev/reference/product-search/algolia-compatibility/algolia-get-task

## 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)
- `taskID` (integer, required)

## Response

### 200

status

- `status` (enum, optional)
  - Allowed values: `published`, `notPublished`
- `pendingTask` (boolean, optional)

## Examples

**Response**

```json
{
  "status": "published",
  "pendingTask": false
}
```

**SDK Code**

```python Python REST
import json
import requests

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

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

response = requests.get(
    f"{BASE_URL}/1/indexes/{INDEX}/task/{TASK_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 taskID = "1857";

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

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