# Delete Task

Permanently delete a specific task from a squid

This endpoint deletes a task from its squid using its hash ID, so later runs no longer process it. The results it brought in earlier runs stay downloadable, by run and by squid.

## Headers

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

## Path Parameters

<ParamField path="task_hash" type="string" required>
  The unique identifier (hash) of the task to delete. Example: `c5e29d2aba8b77cdc56391e7405302de`
</ParamField>

## Response Field Explanations

<ResponseField name="id" type="string">
  The deleted task's identifier. Example: `"c5e29d2aba8b77cdc56391e7405302de"`
</ResponseField>

<ResponseField name="object" type="string">
  Always "task". Example: `"task"`
</ResponseField>

<ResponseField name="deleted" type="boolean">
  Confirmation of deletion (true on success). Example: `true`
</ResponseField>

<Warning>
  A deleted task cannot be restored. Its results from earlier runs are kept. Deleting is refused while a run of the squid is in progress (`RunInProgress`).
</Warning>

<Tip>
  Use Get Task first to verify you're deleting the correct task.
</Tip>

<Note>
  A run processes every task of the squid. To run only new inputs, delete the done tasks first: their results stay downloadable.
</Note>

<Tip>
  To remove all tasks from a squid, use the Empty Squid endpoint instead of deleting tasks one by one.
</Tip>

## Code Examples

<CodeGroup>
```bash cURL
curl -X DELETE "https://api.lobstr.io/v1/tasks/c5e29d2aba8b77cdc56391e7405302de" \
  -H "Authorization: Token YOUR_API_KEY"
```

```python Python
import requests

task_hash = "c5e29d2aba8b77cdc56391e7405302de"
url = f"https://api.lobstr.io/v1/tasks/{task_hash}"
headers = {
    "Authorization": "Token YOUR_API_KEY"
}

response = requests.delete(url, headers=headers)
result = response.json()

if result['deleted']:
    print(f"Task {result['id']} deleted successfully")
else:
    print("Failed to delete task")
```
</CodeGroup>

## Response

```json 200
{
  "id": "c5e29d2aba8b77cdc56391e7405302de",
  "object": "task",
  "deleted": true
}
```

```json 404
{
  "errors": {
    "message": "The specified task does not exist.",
    "type": "HTTPNotFound",
    "code": 404
  }
}
```
