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

# List drives

> List your team's drives, newest first, and filter them by name or status.

List your team's [drives](https://docs.baseten.co/drives/overview.md) to find one by name or to check
which ones failed. [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.

## List drives

Drives are listed newest first. The SDKs fetch further pages as you iterate.

**To list your team's drives**:

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

> [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:
>     for drive in client.drives.list():
>         print(drive.name, drive.status, drive.region)
> ```

> [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)
>     }
>     for drive, err := range management.Drives().List(ctx, client.DriveListOptions{}) {
>         if err != nil {
>             log.Fatal(err)
>         }
>         fmt.Println(drive.Name, drive.Status, drive.Region)
>     }
> }
> ```

> [tab] API
>
> Run the following command to [list your drives](https://docs.baseten.co/reference/management-api/drives/list-drives.md):
>
> ```bash theme={"system"}
> curl --url "https://api.baseten.co/v1/drives/instances?limit=100" \
>   --header "Authorization: Bearer $SANDBOX_TOKEN"
> ```
>
> The response holds up to `limit` drives in `items`, from 1 to 100 with a
> default of 20. While `pagination.has_more` is `true`, request the next
> page by adding `cursor` with the value of `pagination.cursor`. Keep the
> other query parameters the same.

> [tab] CLI
>
> Run the following command:
>
> ```bash theme={"system"}
> baseten drive list
> ```
>
> The command prints up to 1,000 drives. Pass `--limit 0` to print all of
> them. To print only the names, add `--jq '.items[].name'`.

## Filter drives

Filter by a search over drive names, by status, or by both. The status values
are `DEPLOYING`, `DEPLOYED`, `FAILED`, and `DELETING`, and you can pass more
than one.

**To list drives with `notes` in their name that failed**:

> [tab] TypeScript
>
> Run the following code with the same client:
>
> ```typescript theme={"system"}
> for await (const drive of client.drives.list({ query: "notes", statuses: ["FAILED"] })) {
>   console.log(drive.name, drive.status);
> }
> ```

> [tab] Python
>
> Run the following code with the same client:
>
> ```python theme={"system"}
> for drive in client.drives.list(query="notes", statuses=["FAILED"]):
>     print(drive.name, drive.status)
> ```

> [tab] Go
>
> Run the following code with the same client:
>
> ```go theme={"system"}
> opts := client.DriveListOptions{
>     Query:    "notes",
>     Statuses: []client.DriveStatus{client.DriveStatusFailed},
> }
> for drive, err := range management.Drives().List(ctx, opts) {
>     if err != nil {
>         log.Fatal(err)
>     }
>     fmt.Println(drive.Name, drive.Status)
> }
> ```

> [tab] API
>
> Run the following command:
>
> ```bash theme={"system"}
> curl --url "https://api.baseten.co/v1/drives/instances?q=notes&status=FAILED" \
>   --header "Authorization: Bearer $SANDBOX_TOKEN"
> ```
>
> To match more than one status, repeat `status`, such as `status=FAILED&status=DEPLOYING`.

> [tab] CLI
>
> Run the following command:
>
> ```bash theme={"system"}
> baseten drive list --query notes --status failed
> ```
>
> The CLI takes lowercase status values. Repeat `--status` to match more than one.

## Next steps

> [card] [Get a drive](https://docs.baseten.co/drives/get-drives.md)
>
> Check one drive's status, region, and labels.

> [card] [Delete a drive](https://docs.baseten.co/drives/delete-drives.md)
>
> Permanently remove a drive and its files.
