---
title: delete-a-drive
product: vercel
url: /docs/rest-api/sandboxes/delete-a-drive
canonical_url: "https://vercel.com/docs/rest-api/sandboxes/delete-a-drive"
last_updated: 2026-10-05
type: reference
prerequisites:
  []
related:
  - /docs/rest-api
summary: Learn about delete-a-drive on Vercel.
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

# Delete a drive

```http
DELETE /v2/sandboxes/drives/{name}
```

Deletes a drive by project and name. Attached drives cannot be deleted. Stop or replace the session currently using the drive before retrying deletion.

## Authentication

**bearerToken**: HTTP bearer

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `name` | string. maxLength: 64; pattern: `^[a-zA-Z0-9_-]+$` | Yes | Name for the drive. Must be unique per project and URL-safe (alphanumeric, hyphens, underscores). |


## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `projectId` | string | No | The project ID or name associated with the drive. Required unless using a Vercel OIDC token scoped to a project. |
| `teamId` | string | No | The Team identifier to perform the request on behalf of. |
| `slug` | string | No | The Team slug to perform the request on behalf of. |


## Example request

### TypeScript

```typescript
const response = await fetch('https://api.vercel.com/v2/sandboxes/drives/name?projectId=string&teamId=string&slug=string', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    'Content-Type': 'application/json',
  },
});

const data = await response.json();
console.log(data);
```

### Next.js

```typescript
'use server';

export async function callEndpoint() {
  const response = await fetch('https://api.vercel.com/v2/sandboxes/drives/name?projectId=string&teamId=string&slug=string', {
    method: 'DELETE',
    headers: {
      'Authorization': `Bearer ${process.env.VERCEL_ACCESS_TOKEN}`,
      'Content-Type': 'application/json',
    },
    next: { revalidate: 3600 }
  });

  if (!response.ok) {
    throw new Error('Request failed');
  }

  return response.json();
}
```

### cURL

```bash
curl -X DELETE 'https://api.vercel.com/v2/sandboxes/drives/name?projectId=string&teamId=string&slug=string' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json'
```

## Example response

```json
{
  "drive": {
    "createdAt": "1750344501629",
    "currentSandboxName": "my-sandbox",
    "currentSessionId": "sbx_123",
    "id": "drive_abc123",
    "maxSizeBytes": "1099511627776",
    "name": "workspace",
    "projectId": "prj_abc123",
    "region": "iad1",
    "updatedAt": "1750344501629",
    "v0": "false"
  }
}
```

## Responses

### 200: No description

Content-Type: `application/json`

```json
{
  "type": "object",
  "required": [
    "drive"
  ],
  "properties": {
    "drive": {
      "type": "object",
      "description": "This object contains information related to a Vercel Sandbox Drive.",
      "required": [
        "createdAt",
        "id",
        "maxSizeBytes",
        "name",
        "projectId",
        "region",
        "updatedAt"
      ],
      "properties": {
        "createdAt": {
          "type": "number",
          "description": "The time when the drive was created, in milliseconds since the epoch."
        },
        "currentSandboxName": {
          "type": "string",
          "description": "Current sandbox name the drive is attached to, if any."
        },
        "currentSessionId": {
          "type": "string",
          "description": "Current session ID the drive is attached to, if any."
        },
        "id": {
          "type": "string",
          "description": "The unique drive ID."
        },
        "maxSizeBytes": {
          "type": "number",
          "description": "The maximum drive size in bytes."
        },
        "name": {
          "type": "string",
          "description": "The unique drive name within the project."
        },
        "projectId": {
          "type": "string",
          "description": "The project that owns the drive."
        },
        "region": {
          "type": "string",
          "description": "The region where the drive is stored."
        },
        "updatedAt": {
          "type": "number",
          "description": "The last time the drive was updated, in milliseconds since the epoch."
        },
        "v0": {
          "type": "boolean",
          "description": "Whether this drive is managed by v0 on the customer's behalf.",
          "enum": [
            false,
            true
          ]
        }
      }
    }
  }
}
```

### 400: One of the provided values in the request query is invalid.

### 401: The request is not authorized.

### 403: You do not have permission to access this resource.

### 404: No description

### 409: No description

### 410: No description

### 429: No description

---

## Related

- [sandboxes endpoints](/docs/rest-api#sandboxes)

- [REST API overview](/docs/rest-api)

- [OpenAPI spec](https://vercel.com/openapi.json) (machine-readable, all endpoints)

---

[View full sitemap](/docs/sitemap)
