# Delete an archived project, its crews, mirror and files.

> Only an archived project with no crew planning, running or paused (`409 not_archived`, `409 crews_live`; `409 crews_busy` when an ended crew is held as `DELETE /crews/{id}` would be), each `details` entry with its `code` and `next`.
> https://koi.dog/docs/api/projects/delete-project/

`DELETE /api/v1/projects/{id}` · Scopes: `config`, `approve`

`GET /deletions/check?kind=project&id=` answers the same without deleting. Deletes each of its crews as `DELETE /crews/{id}` does, its automations, the server's git mirror and its saved copy, and its files. Its timeline events and cost records stay. Nothing on GitHub is touched. Answers what was removed; deleting it again answers the same record with `alreadyDeleted: true`; an id that never existed is `404`. Destructive, so a key needs `approve` as well as `config`. The timeline records the key ID, action and outcome.

## Path parameters.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | The project's id. |

## Headers.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | `string` | no | Retry the same request with the same key. [Retry rules](https://koi.dog/docs/api/#retries). |

## Response.

200 OK · JSON object

## Request.

```sh
curl -X DELETE "https://api.koi.dog/api/v1/projects/$ID" \
    -H "Authorization: Bearer $KOIDOG_API_KEY"
```

```js
const res = await fetch(`https://api.koi.dog/api/v1/projects/${process.env.ID}`, {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${process.env.KOIDOG_API_KEY}`,
  },
});
console.log(await res.json());
```

```python
import os

import requests

r = requests.delete(
    f"https://api.koi.dog/api/v1/projects/{os.environ['ID']}",
    headers={
        "Authorization": f"Bearer {os.environ['KOIDOG_API_KEY']}",
    },
)
r.raise_for_status()
print(r.json())
```

## Response example.

```json
{
  "kind": "crew",
  "id": "string",
  "name": "string",
  "projectId": "string",
  "crewId": "string",
  "deletedAt": "string",
  "deletedBy": "string",
  "trigger": "request",
  "removed": {
    "crews": 0,
    "tasks": 0,
    "agents": 0,
    "runs": 0,
    "logLines": 0,
    "artifacts": 0,
    …
  },
  "kept": [],
  "alreadyDeleted": false,
  …
}
```
