> ## 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 drive

> Permanently delete a drive and every file on it.

Delete a [drive](https://docs.baseten.co/drives/overview.md) when no sandbox needs its files anymore.
[Set up your SDK or the CLI](https://docs.baseten.co/drives/create-drives.md#set-up) before running these
examples.

> [!NOTE]
>
> Drives are in pre-release in the Baseten CLI (`baseten drive` and `baseten sandbox drive`) and in the Python, TypeScript, and Go SDKs (`baseten`, `@basetenlabs/client`, `@basetenlabs/sandbox`, and `baseten-go`). Commands, methods, and responses can change. The [Management API drive operations](https://docs.baseten.co/reference/management-api/overview.md#drives) are experimental.

## Delete a drive

> [!WARNING]
>
> Deleting a drive permanently deletes every file on it, for every sandbox that
> uses it. You can't undo it.

Before you delete a drive, [unmount it](https://docs.baseten.co/drives/unmount-drives.md) from every
sandbox that has it mounted. Deletion continues after the call returns, and
the drive's status is `DELETING` until it's gone.

**To delete the drive named `shared-notes`**:

> [tab] TypeScript
>
> Run the following code:
>
> ```typescript theme={"system"}
> import { ManagementClient } from "@basetenlabs/client";
>
> const client = new ManagementClient({ apiKey: process.env.BASETEN_API_KEY! });
> const drive = await client.drives.delete({ name: "shared-notes" });
> console.log(drive.status);
> ```

> [tab] Python
>
> Run the following code:
>
> ```python theme={"system"}
> import os
>
> from baseten.client import ManagementClient
>
> with ManagementClient(api_key=os.environ["BASETEN_API_KEY"]) as client:
>     drive = client.drives.delete(name="shared-notes")
>     print(drive.status)
> ```

> [tab] Go
>
> Run the following code:
>
> ```go theme={"system"}
> package main
>
> import (
>     "context"
>     "fmt"
>     "log"
>     "os"
>
>     "github.com/basetenlabs/baseten-go/client"
> )
>
> func main() {
>     ctx := context.Background()
>     management, err := client.NewManagementClient(client.ManagementClientOptions{
>         APIKey: os.Getenv("BASETEN_API_KEY"),
>     })
>     if err != nil {
>         log.Fatal(err)
>     }
>     drive, err := management.Drives().Delete(ctx, client.DriveDeleteOptions{Name: "shared-notes"})
>     if err != nil {
>         log.Fatal(err)
>     }
>     fmt.Println(drive.Status)
> }
> ```

> [tab] API
>
> Run the following command to [delete the drive](https://docs.baseten.co/reference/management-api/drives/delete-a-drive.md):
>
> ```bash theme={"system"}
> curl --request DELETE \
>   --url https://api.baseten.co/v1/drives/instances/shared-notes \
>   --header "Authorization: Bearer $SANDBOX_TOKEN"
> ```
>
> The request returns HTTP `202` with the drive's record, whose `status` is
> `DELETING`.

> [tab] CLI
>
> Run the following command and confirm when prompted:
>
> ```bash theme={"system"}
> baseten drive delete --name shared-notes
> ```
>
> Pass `--yes` to skip the prompt when scripting.

The SDK examples print `DELETING`. To confirm the drive is gone,
[list your drives](https://docs.baseten.co/drives/list-drives.md).

## Next steps

> [card] [List drives](https://docs.baseten.co/drives/list-drives.md)
>
> Check which drives your team still has.

> [card] [Create a drive](https://docs.baseten.co/drives/create-drives.md)
>
> Create a new drive.
