# Delete an artifact and its stored file.

> Removes the record and its file from this disk and from the file store (Convex storage in Convex mode).
> https://koi.dog/docs/api/artifacts/delete-artifact/

`DELETE /api/v1/artifacts/{id}` · Scopes: `crews`, `approve`

A branch or pull request link artifact is only a record: the branch and the pull request are not touched. Refused while the run that made it is still going (`409 run_live`, with `next`). Deleting it again answers the same record with `alreadyDeleted: true`. Destructive, so a key needs `approve` as well as `crews`. The timeline records the key ID, action and outcome.

## Path parameters.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | The artifact'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/artifacts/$ID" \
    -H "Authorization: Bearer $KOIDOG_API_KEY"
```

```js
const res = await fetch(`https://api.koi.dog/api/v1/artifacts/${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/artifacts/{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,
  …
}
```
