> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lobstr.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Retry Run Task

> Retry a single failed or skipped task within a completed run

Retry a single task from a completed run without restarting the entire run. The task is reset to `pending` and the run relaunches to process it. Only one retry can be queued at a time per squid — no other run may be active.

## Headers

<ParamField header="Authorization" type="string" required>
  Your API authentication token. Value: `Token YOUR_API_KEY`
</ParamField>

## Path Parameters

<ParamField path="run_hash" type="string" required>
  Hash ID of the completed run. Retrieve this from the [List Runs](/docs/list-runs) endpoint.
</ParamField>

<ParamField path="task_hash" type="string" required>
  Hash ID of the task to retry. Retrieve this from the [Get Run Tasks](/docs/get-run-tasks) endpoint (`data[].user_task`).
</ParamField>

## Constraints

* The run must be **completed** (`is_done: true`). Retrying while the run is still active returns `RunInProgress`.
* No other run may be **active** for the same squid. If one is, `ClusterBusy` is returned.
* The run must not have already reached its **`max_unique_results_per_run` cap** — if it has, retrying won't scrape anything new and `RunCapReached` is returned. Launch a new run instead.
* A **5-minute cooldown** applies between retries of the same task. Retrying too soon returns `RetryCooldown`.

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.lobstr.io/v1/runs/RUN_HASH/tasks/TASK_HASH/retry" \
    -H "Authorization: Token YOUR_API_KEY"
  ```

  ```python Python theme={null}
  import requests

  API_KEY = "YOUR_API_KEY"
  BASE_URL = "https://api.lobstr.io/v1"
  headers = {"Authorization": f"Token {API_KEY}"}

  run_hash = "RUN_HASH"
  task_hash = "TASK_HASH"

  response = requests.post(f"{BASE_URL}/runs/{run_hash}/tasks/{task_hash}/retry", headers=headers)
  data = response.json()
  print(f"Task status: {data['status']}")
  ```
</CodeGroup>

## Response

```json 200 theme={null}
{
  "id": "RUNTASK_HASH",
  "status": "pending",
  "is_done": false,
  "has_errors": null,
  "errors": null,
  "done_reason": null,
  "ended_at": null,
  "params": {
    "url": "https://example.com/listing/123"
  }
}
```

## Error Responses

```json 400 RunInProgress theme={null}
{
  "error": "RunInProgress",
  "message": "Cannot retry a task while the run is still active."
}
```

```json 400 ClusterBusy theme={null}
{
  "error": "ClusterBusy",
  "message": "Another run is currently active for this squid."
}
```

```json 400 RunCapReached theme={null}
{
  "error": "RunCapReached",
  "message": "This run already reached its max unique results limit (200); retrying won't scrape anything new. Launch a new run instead."
}
```

```json 400 RetryCooldown theme={null}
{
  "error": "RetryCooldown",
  "message": "This task was retried too recently, please wait a few minutes."
}
```
