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

# DELETE /v1/capsules/{id} — Destroy a capsule

> DELETE /v1/capsules/{id} — Permanently destroy a capsule and release all resources. Returns 204 No Content. This action is irreversible.

Use this endpoint to permanently destroy a capsule and release all associated VM resources. The capsule's filesystem is deleted and the ID cannot be reused. This works regardless of the capsule's current status — running, paused, or stopped capsules can all be destroyed.

<Warning>
  Destroying a capsule is permanent. All data on the capsule filesystem is lost. There is no confirmation step and no recovery path.
</Warning>

## Endpoint

```http theme={null}
DELETE https://app.wrenn.dev/api/v1/capsules/{id}
```

## Authentication

Pass your API key in the `X-API-Key` header.

```http theme={null}
X-API-Key: wrn_your_key
```

## Path parameters

<ParamField path="id" type="string" required>
  The ID of the capsule to destroy (e.g., `cl-abc123`).
</ParamField>

## Response

Returns `204 No Content` on success. The response body is empty.

If the capsule was running, the VM is terminated immediately before deletion. If the capsule was paused, the snapshot files are removed from disk.

## curl

```bash theme={null}
curl --request DELETE \
  --url https://app.wrenn.dev/api/v1/capsules/cl-abc123 \
  --header 'X-API-Key: wrn_your_key'
```

## Python SDK

```python theme={null}
from wrenn import Capsule

# Destroy by ID (static method — no need to connect first)
Capsule.destroy("cl-abc123")

# Or destroy an existing instance
capsule = Capsule.connect("cl-abc123")
capsule.destroy()
```

The `Capsule` context manager calls `destroy()` automatically when the `with` block exits:

```python theme={null}
with Capsule(template="minimal", wait=True) as capsule:
    result = capsule.commands.run("echo done")
# capsule is destroyed here
```

## Error responses

| Status             | Description                                       |
| ------------------ | ------------------------------------------------- |
| `401 Unauthorized` | Missing or invalid `X-API-Key`.                   |
| `404 Not Found`    | No capsule with the given ID exists in your team. |
