# Delete calculation instance

Delete the compute instance in the current workspace.

```text
DELETE $CLOUDSIGMA_API_BASE/compute-resources/{resource_id}
```

## Before you call this API

Configure the [regional API endpoint and authentication](https://omnifabric.cloudsigma.com/docs/developer/endpoints-and-authentication.html.md), and select the target workspace.

[Check](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/resource-center/compute-resources/preflight-delete.html.md) before deleting to confirm the instance to be deleted.

Set the operation-specific values used in the request:

- `$RESOURCE_ID`: The compute instance ID to be deleted.

`force=true` will require the server to forcibly handle dependencies, and its impact should be confirmed before use.

## Request example

```bash
curl -X DELETE "$CLOUDSIGMA_API_BASE/compute-resources/$RESOURCE_ID" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

## Path parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `resource_id` | string | Yes | The ID of the computing instance to be deleted. |

## Query parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `force` | boolean | No | Request forced deletion when passing `true`. |

## Successful response

Returns `200` on success, `data` is `null`.

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

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | `OK` on success. |
| `msg` | string | `OK` on success. |
| `data` | null | Fixed to `null` when the delete request completes successfully. |

## Error response

```json
{
  "code": "DELETE_FAILED",
  "msg": "请求参数无效",
  "data": null
}
```

### Common HTTP errors

```{list-table}
:header-rows: 1
:widths: 12 22 32 34

* - HTTP status code
  - error code
  - Common causes
  - Recommended actions
* - `400`
  - `DELETE_FAILED`
  - `resource_id` is invalid, or the current status of the instance does not allow deletion.
  - First execute [CHECK](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/resource-center/compute-resources/preflight-delete.html.md) before deleting.
* - `401`
  - —
  - Missing or invalid access credentials.
  - Check the regional endpoint, API key, and workspace ID.
* - `403`
  - `ErrForbidden`
  - The current identity does not have the permission to delete the instance.
  - Use valid credentials, or contact your administrator for authorization.
* - `404`
  - `NOT_FOUND`
  - The instance does not exist or does not belong to the current workspace.
  - Check `resource_id` and workspace.
* - `409`
  - `ErrConflict`
  - There are still active tasks or binding relationships, and they cannot be deleted based on the current conditions.
  - Retry after processing check results; only use `force=true` if impact is confirmed.
* - `500`
  - `DELETE_FAILED`
  - The server failed to delete the instance.
  - Record the request time and error message and try again.
```

## Follow-up operations

Re-[List calculation instances](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/resource-center/compute-resources/list-compute-resources.html.md) to confirm that the resource is no longer visible.
