> ## Documentation Index
> Fetch the complete documentation index at: https://docs.baseten.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete runs and checkpoints

> Permanently delete a Loops run or checkpoint with the REST API, including how Baseten handles checkpoints that are still in use.

Deleting a run removes the run and its saved checkpoints, except checkpoints that another resource still uses. Deactivate a run instead when you want to end it but keep its checkpoints. The Baseten CLI doesn't delete runs or checkpoints; use the REST API.

Deletion is permanent. Before you start, set `BASETEN_API_KEY` to a [workspace API key](https://docs.baseten.co/organization/api-keys.md).

## Delete a run

Deleting an active run deactivates it first. Baseten keeps checkpoints that another resource still uses, such as a deployment, and lists them in the response. They stay usable until that use stops. To keep a copy of other checkpoints, download them with [`download_checkpoint()`](https://docs.baseten.co/reference/sdk/loops/training-client) before you delete the run.

**To delete a run and its checkpoints**:

Replace `<run_id>` with the run ID from [`TrainingClient.run_id`](https://docs.baseten.co/reference/sdk/loops/training-client) or [list your runs](https://docs.baseten.co/reference/cli/baseten/loops.md#list), then send a request to [Delete a run](https://docs.baseten.co/reference/loops-api/runs/delete-a-run.md):

```bash theme={"system"}
curl --request DELETE \
  --url "https://api.baseten.co/v1/loops/runs/<run_id>" \
  --header "Authorization: Bearer $BASETEN_API_KEY"
```

The response returns the deleted run ID and a `kept_checkpoints` array. Check the array for any checkpoints Baseten kept because they're still in use.

## Delete a checkpoint

Delete a checkpoint when you no longer need to load, sample, or deploy it. You can't delete a checkpoint that something still uses. The error names the use. Remove that use and retry:

* **A deployment:** [Delete the deployment](https://docs.baseten.co/loops/deploy-checkpoints.md#delete-the-deployment).
* **An unfinished LoRA merge:** Wait for the merge to finish.
* **A sampler:** [Deactivate the sampler](https://docs.baseten.co/reference/loops-api/samplers/deactivate-a-sampler.md).
* **A run:** [Deactivate the run](https://docs.baseten.co/loops/deactivate-a-run.md).

**To delete a checkpoint**:

Replace `<checkpoint_id>` with the name you saved the checkpoint under, then send a request to [Delete a checkpoint](https://docs.baseten.co/reference/loops-api/checkpoints/delete-a-checkpoint.md):

```bash theme={"system"}
curl --request DELETE \
  --url "https://api.baseten.co/v1/loops/checkpoints/<checkpoint_id>" \
  --header "Authorization: Bearer $BASETEN_API_KEY"
```

The response returns the deleted checkpoint's `id`, `run_id`, `checkpoint_id`, and `path`. After deletion, the checkpoint disappears from listings and you can't load, sample, or deploy it. Deleting an already-deleted checkpoint returns the same response.

## Related

* [Deactivate a run](https://docs.baseten.co/loops/deactivate-a-run.md): End a run but keep its checkpoints.
* [Deploy checkpoints](https://docs.baseten.co/loops/deploy-checkpoints.md): Deploy or download saved weights.
* [Delete a run reference](https://docs.baseten.co/reference/loops-api/runs/delete-a-run.md): Request and response fields.
* [Delete a checkpoint reference](https://docs.baseten.co/reference/loops-api/checkpoints/delete-a-checkpoint.md): Request and response fields.
