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

# Kill Sandbox

> Kill and destroy a sandbox and its underlying sandbox VM.

Sets the sandbox state to `killed` and instructs the orchestrator to terminate the
VM. This action is irreversible — all in-memory state and filesystem contents are
lost. Returns `{ "killed": true }` on success.

<Warning>
  Killing a sandbox destroys all data inside the VM. If you need to preserve the
  state, [create a snapshot](/api-reference/sandbox/create-snapshot) first.
</Warning>

## Path Parameters

<ParamField path="sandbox_id" type="string" required>
  The sandbox identifier. Format: `sbx-<8 chars>`.

  Example: `sbx-a1b2c3d4`
</ParamField>

## Response

<ResponseField name="killed" type="boolean">
  Always `true` when the sandbox was found and the kill was dispatched.
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE https://api.declaw.ai/sandboxes/sbx-a1b2c3d4 \
    -H "X-API-Key: YOUR_API_KEY"
  ```

  ```python Python theme={null}
  from declaw import Sandbox

  sbx = Sandbox.connect("sbx-a1b2c3d4", api_key="YOUR_API_KEY", domain="api.declaw.ai")
  sbx.kill()
  ```

  ```typescript TypeScript theme={null}
  import { Sandbox } from "@declaw/sdk";

  const sbx = await Sandbox.connect("sbx-a1b2c3d4", {
    apiKey: "YOUR_API_KEY",
    domain: "api.declaw.ai",
  });
  await sbx.kill();
  ```
</CodeGroup>

```json Response theme={null}
{
  "killed": true
}
```

<Note>
  The SDK `kill()` method wraps this endpoint. Always call it in a `try/finally`
  block to avoid leaving orphaned sandboxes running.
</Note>

## Error Responses

| Status | Cause                      |
| ------ | -------------------------- |
| `401`  | Missing or invalid API key |
| `404`  | Sandbox not found          |
