> ## 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 a checkpoint

> Permanently delete a Loops checkpoint with the Python SDK or the REST API, and clear the uses that block deletion.

Delete a checkpoint when you no longer need to load, sample, or deploy it. To keep the run and its other checkpoints, delete checkpoints one at a time. To remove a run and every checkpoint that nothing else uses, [delete the run](https://docs.baseten.co/loops/delete-a-run.md) instead. The Baseten CLI doesn't delete checkpoints; use the Python SDK or the REST API.

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/loops/deactivate-a-sampler.md).
* **A run:** [Deactivate the run](https://docs.baseten.co/loops/deactivate-a-run.md).

> [!WARNING]
>
> Deleting a checkpoint is permanent. Afterward, you can't load, sample, or deploy it. To keep a copy, [download its files](https://docs.baseten.co/loops/download-checkpoints.md) first.

The Python SDK and the `curl` examples authenticate with `BASETEN_API_KEY`. Export your [API key](https://docs.baseten.co/organization/api-keys.md) first:

```sh theme={"system"}
export BASETEN_API_KEY="YOUR_API_KEY"
```

> [tab] Python SDK
>
> **To delete a checkpoint**:
>
> Call [`delete_checkpoint_from_path()`](https://docs.baseten.co/reference/sdk/loops/service-client) on a [`ServiceClient`](https://docs.baseten.co/reference/sdk/loops/service-client), replacing `<checkpoint_path>` with the checkpoint's `bt://` path, such as the `path` that [`save_state()`](https://docs.baseten.co/reference/sdk/loops/training-client) or [`save_weights_for_sampler()`](https://docs.baseten.co/reference/sdk/loops/training-client) returned:
>
> ```python theme={"system"}
> from baseten.loops import ServiceClient
>
> deleted = ServiceClient().delete_checkpoint_from_path("<checkpoint_path>")
> print(deleted.id, deleted.path)
> ```
>
> The result reports the deleted checkpoint's `id` and `path`. Listing the run's checkpoints afterward no longer includes it.
>
> To delete the checkpoint by the name you saved it under, pass that name and the run's ID to [`delete_checkpoint()`](https://docs.baseten.co/reference/sdk/loops/service-client):
>
> ```python theme={"system"}
> deleted = ServiceClient().delete_checkpoint("<checkpoint_name>", run_id="<run_id>")
> ```

> [tab] REST API
>
> **To delete a checkpoint**:
>
> Replace `<checkpoint_id>` with the checkpoint's `id` from [List checkpoints](https://docs.baseten.co/loops/save-checkpoints.md#list-checkpoints), not the name you saved it 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_name`, and `path`. After deletion, the checkpoint disappears from listings. Deleting an already-deleted checkpoint returns the same response.

## Next steps

* [Set a checkpoint expiry](https://docs.baseten.co/loops/checkpoint-expiry.md): Have Baseten delete checkpoints for you after a set time.
* [Delete a run](https://docs.baseten.co/loops/delete-a-run.md): Remove a run and the checkpoints that nothing else uses.
