# Delete a generation

> Delete one generation result, exactly as deleting it in the app does.

Canonical page: https://www.rundiffusion.com/docs/api/library/delete
Endpoint: DELETE /api/v2/library/{item_id}
Authorization: OAuth device flow or Personal API Access Token or Company API Access Token

---

Deletes one generation result, by the `id` from
[List generations](/docs/api/library/list). It behaves exactly like deleting
the image in the app.

`DELETE /api/v2/library/{item_id}`

Authorization: OAuth device flow or Personal API Access Token or Company API Access Token

## Who can delete a generation

Your own results, always. On a team, a holder of
**Can manage everyone's generations and boards** (`MANAGE_ALL_GENERATIONS`) can
also delete other members' results on that team, and only there: the permission
never reaches across teams. Anything else answers `404`, never `403`, so an id
cannot be probed for whether it exists.

## Request

**Headers**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Authorization` | string | Yes | Bearer token. This endpoint accepts an OAuth device flow token, a Personal API Access Token, or a Company API Access Token. See [Authentication](/docs/api/authentication). |

**Path parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `item_id` | string | Yes | The item id from the [listing](/docs/api/library/list): run_id and result_id joined by a colon. The first half is a 20-character id, the second a dashed UUID. |

cURL:

```bash
curl -X DELETE https://api2.rundiffusion.com/api/v2/library/$ITEM_ID \
  -H "Authorization: Bearer $RUNDIFFUSION_TOKEN"
```

JavaScript:

```javascript
await fetch(
  `https://api2.rundiffusion.com/api/v2/library/${itemId}`,
  {
    method: 'DELETE',
    headers: { Authorization: `Bearer ${process.env.RUNDIFFUSION_TOKEN}` },
  },
);
```

Python:

```python
requests.delete(
    f"{BASE}/library/{item_id}",
    headers=HEADERS,
)
```

## Response

`204 No Content`. Deleting is acknowledged at the source of record; the listing
and [Get a generation](/docs/api/library/get) read a synced view, so a
just-deleted item can linger there for a short moment before it disappears.

Deleting a result does not touch the tool that produced it, the board it ran
on, or the upload it was made from.

## Errors

**Status codes**

| Name | Type | Description |
| --- | --- | --- |
| `401` | TOKEN_INVALID | Missing or invalid credential. |
| `404` | LIBRARY_ITEM_NOT_FOUND | No such item, not one this credential may delete, or already deleted. All three read the same on purpose. |
| `429` | RATE_LIMITED | Too many requests. Deletes have a tighter budget than reads. See [Rate limits](/docs/api/rate-limits#library). |
