# DELETE /v2/crawl/{job_id}

> Cancel a crawl. Pages already read stay.

DELETE `/v2/crawl/{job_id}`

**Authentication:** your key as a [bearer token](https://darkcrawl.dev/docs/api-reference/authentication/).

## Path parameters

| Field    | Type     | Required | Default |
| -------- | -------- | -------- | ------- |
| `job_id` | `string` | Required |         |

## Request

**curl**

```bash
curl -X DELETE https://api.darkcrawl.dev/v2/crawl/JOB_ID \
  -H "Authorization: Bearer $DARKCRAWL_API_KEY"
```

**Python**

```python
import os
import requests

resp = requests.delete(
    "https://api.darkcrawl.dev/v2/crawl/JOB_ID",
    headers={"Authorization": "Bearer " + os.environ["DARKCRAWL_API_KEY"]},
    timeout=330,
)
print(resp.json())
```

**Node**

```javascript
const resp = await fetch("https://api.darkcrawl.dev/v2/crawl/JOB_ID", {
  method: "DELETE",
  headers: {
    Authorization: "Bearer " + process.env.DARKCRAWL_API_KEY,
  },
  signal: AbortSignal.timeout(330000),
});
console.log(await resp.json());
```

## Response

Status `200`.

```json
{
  "status": "cancelled"
}
```

## Notes

- The reply is `{"status": "cancelled"}`, with no `success` key. A cancel settles the job's pages: the ones it read are charged and the rest are released.
- An unknown id answers `404` with `{"error": "Job not found"}`, and a job that has finished answers `409` with `{"error": "Crawl is already completed"}`. Neither body has a `code`.
