<span id="提交计算资源管理删除"></span>

# Submit an administrative compute resource deletion

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

Persist the deletion intent and return an acknowledgement. Background processing continues the cleanup.

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

<span id="调用前准备"></span>

## Before you call this API

Prepare an identity configured as a compute specification administrator in this deployment and an accessible authentication Workspace. Workspace Owner status or a Genesis administration scope is insufficient. Replace example IDs with targets you are authorized to read or operate on. See [Compute Instances](../../../../../developer/cli/tasks/compute-resources.md).

Run the [deletion preflight](preflight-delete.md) first. Active tasks or bound workflows block deletion by default. After acceptance, force=true rereads dependencies, cancels active tasks, removes resource bindings from affected workflows and versions, and then proceeds with permission and runtime cleanup. This changes business content; confirm its impact and recovery procedure first. A 202 response does not mean cleanup has completed.

<span id="请求参数"></span>

## Request parameters

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

```bash
curl -X DELETE "https://api.moi.matrixorigin.cn/v5/admin/compute-resources/cr-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 an identity configured as a compute specification administrator in this deployment. |
| `X-Workspace-ID` | string | Yes | One nonempty authentication Workspace, separate from the resource's Workspace and the workspace_id list filter. |
| `id` | string | Yes | Target resource ID. The service resolves its owning workspace from the administrative repository. |
| `force` | string (query parameter) | No | Only the exact string true enables this option. Omission, True, and 1 do not. There is no --force CLI flag; see SDK and CLI support. |

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

<span id="成功响应"></span>

## Successful response

HTTP 202。

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

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "resource_id": "cr-example",
    "status": "TERMINATING"
  }
}
```

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

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | OK on success. |
| `msg` | string | OK on success. |
| `data` | object | Data returned by this API; see the fields below. |
| `data.resource_id` | string | Resource ID whose deletion intent has been persisted. |
| `data.status` | string | TERMINATING; only indicates that deletion intent has been persisted. |

See [Shared objects](compute-admin-crud-objects.md) for nested objects and omission rules.
:::::
::::::
:::::::

<span id="错误响应"></span>

## Error responses

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

```json
{"code": "INVALID_PARAMS", "msg": "invalid compute resource request", "data": null}
```

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

| HTTP / code | Conditions and handling |
| --- | --- |
| 400 / INVALID_PARAMS | Invalid request or classified resource parameters. |
| 403 / ErrForbidden | A classified rejection of administrator eligibility, principal, or Workspace access. |
| 503 / ErrServiceUnavailable | A classified shared authorization unavailability error; does not cover every directory/configuration error. |
| 404 / NOT_FOUND | Target resource not found. |
| 409 / DELETE_CONFLICT | Active tasks or bindings block deletion, or the deletion intent conflicts. Inspect the original request first. |
| 503 / DELETE_UNAVAILABLE | The runtime service is not configured, or deletion service unavailability has been classified. |
| 400 / DELETE_FAILED | Unclassified deletion failure; the current mapping is not always 500. Retain the request ID and check the actual phase. |

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | Classified by the specific failure stage. |
| `msg` | string | Error text; shared errors may be localized. |
| `data` | null or omitted | Direct compute errors use null. See error recovery for shared error formats. |

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

An error does not mean every stage was rolled back. See [Errors and recovery](compute-admin-crud-errors-recovery.md).
