# Delete a managed sandbox

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

Advance credential, remote resource, and Ownership cleanup within the request. Success returns 200 and an empty object.

```text
DELETE https://api.moi.matrixorigin.cn/v5/admin/agent-sandboxes/{id}
```

## Before you call this API

Prepare a valid identity for this environment, configured administrator privileges, and an accessible authentication Workspace. Workspace Owner status or Genesis taas:admin does not automatically grant these administrator privileges. The example uses a personal access token and one X-Workspace-ID. See [AI Studio](../../../../../developer/api/ai-studio/index.md).

Before deletion, confirm the target Workspace, resource ID, and data that may be deleted. This operation cannot recover original runtime contents; verify only on resources you are authorized to discard. An error may occur after partial cleanup or after deletion intent is persisted. Check the original resource and recovery records. A 404 or disappearance from a list does not establish completed cleanup. Do not create a replacement resource over the original ID.

## Request parameters

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Request example

```bash
curl -X DELETE "https://api.moi.matrixorigin.cn/v5/admin/agent-sandboxes/sandbox-example" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $AUTH_WORKSPACE_ID"
```

:::::
:::::{tab-item} Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `X-API-Key` | string | Yes in this example | A valid personal access token for this environment, belonging to a configured administrator principal. Confirm other standard authentication methods, such as Bearer, for the environment. |
| `X-Workspace-ID` | string | Yes | One nonempty authentication Workspace header; not a target filter or target quota Workspace. |
| `id` | string | Yes | Sandbox ID in the path. |

:::::
::::::
:::::::

## Successful response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {}
}
```

:::::
:::::{tab-item} Fields

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | OK on success. |
| `msg` | string | OK on success. |
| `data` | object | Success data. |
| `data` | object | Always an empty object {}, not a 202 acceptance receipt. |

See [Shared objects](objects.md) for all public nested object fields and separate explanations of omission and null.
:::::
::::::
:::::::

## Error responses

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{"code":"ErrParamInvalid","msg":"Bad Request"}
```

:::::
:::::{tab-item} Fields

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | Error code for the current stage. |
| `msg` | string | Error text; service-classified errors are usually localized. |

| HTTP / code | Conditions and handling |
| --- | --- |
| 400 / ErrParamInvalid | Missing authentication Workspace, request decoding/integer parsing failure, or invalid quota fields. |
| 400 / SANDBOX_INVALID_SPEC | A service validation failure, such as an invalid list window or network tool. A name containing SPEC does not limit it to specification creation. |
| 403 / COMPUTE_RESOURCE_SPEC_FORBIDDEN | The current principal is not a configured administrator, or its identity does not match the authorization boundary. |
| 503 / COMPUTE_RESOURCE_SPEC_ADMIN_UNAVAILABLE | Classified administrator directory/authorization facts are unavailable. |
| 404 / SANDBOX_NOT_FOUND | The resource is unmanaged, ephemeral, pooled, missing, or in a hidden creation/deletion stage. |
| 503 / SANDBOX_IAM_UNAVAILABLE or SANDBOX_NETWORK_STORAGE_UNAVAILABLE | Lifecycle identity or network persistence dependencies are unavailable. |
| 500 / SANDBOX_ERROR or ErrServer | An unclassified Provider or other failure, or localization failure; these do not always return 503. |

See [Errors and recovery](errors-recovery.md) for recovery stages.
:::::
::::::
:::::::
