# Clean-up state: retention, the last sweeps, what they removed and the bytes freed.

> https://koi.dog/docs/api/costs-and-settings/get-cleanup/

`GET /api/v1/cleanup` · Scope: `read`

## Response.

200 OK · JSON object

## Request.

```sh
curl https://api.koi.dog/api/v1/cleanup \
    -H "Authorization: Bearer $KOIDOG_API_KEY"
```

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

```python
import os

import requests

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

## Response example.

```json
{
  "retention": {
    "workspacesDays": 0,
    "artifactsDays": 0,
    "endedCrewsDays": 0
  },
  "active": false,
  "sweepEveryMinutes": 0,
  "nextSweepAt": "string",
  "lastSweep": {
  },
  "recent": [],
  "totals": {
    "crewsDeleted": 0,
    "projectsDeleted": 0,
    "artifactsDeleted": 0,
    "workspacesRemoved": 0,
    "bytesFreed": 0
  }
}
```
