# Enable or disable calculation specifications

Sets the enabled status of a compute specification.

```text
PATCH $CLOUDSIGMA_API_BASE/compute-resource-specs/{spec_id}/enabled
```

## 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.

First [list the calculation specifications](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/resource-center/compute-resource-specs/list-compute-resource-specs.html.md) and confirm the specifications to set the status.

Set the operation-specific values used in the request:

- `$SPEC_ID`: The compute spec ID to set the status for, taken from the response of [List compute spec](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/resource-center/compute-resource-specs/list-compute-resource-specs.html.md).

First [Query the calculation specification management permission](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/resource-center/compute-resource-specs/get-compute-resource-spec-management-permission.html.md). The enabled status can only be modified if the result is `true`. Disabling a specification does not replace lifecycle management of existing compute instances.

## Request example

```bash
curl -X PATCH "$CLOUDSIGMA_API_BASE/compute-resource-specs/$SPEC_ID/enabled" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "enabled": false
  }'
```

## Path parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `spec_id` | string | Yes | The ID of the compute specification to set the state for. |

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | No | `true` is enabled, `false` is disabled. The service is handled as `false` when not provided, so should always be passed in explicitly. |

## Successful response

Returns `200` on success. `data` returns the updated specification object, where `enabled` is the state after the request.

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "id": "task-standard-small",
    "enabled": false
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | `OK` on success. |
| `msg` | string | `OK` on success. |
| `data.id` | string | Compute spec ID. |
| `data.kind` | string | Resource type. |
| `data.family` | string | Specification family identifier. |
| `data.family_name` | string | Specification family name. |
| `data.family_name_en` | string | English name of the specification family. |
| `data.cpu_milli` | integer | CPU capacity in millicore. |
| `data.memory_mib` | integer | Memory capacity in MiB. |
| `data.gpu_count` | integer | Number of GPUs. |
| `data.gpu_memory_mib` | integer | GPU memory, unit is MiB. |
| `data.gpu_cores` | integer | Number of GPU cores. |
| `data.credit_per_hour` | number | Credit usage per hour. |
| `data.description` | string | Specification. |
| `data.description_en` | string | English specifications; system specifications can be returned. |
| `data.node_placement` | object | Node scheduling configuration. |
| `data.enabled` | boolean | Updated enabled status. |
| `data.is_system` | boolean | Whether it is a built-in specification of the system. |
| `data.created_by` | string | Creator ID. |
| `data.updated_by` | string | The last updater ID. |
| `data.created_at` | string | Creation time. |
| `data.updated_at` | string | Last updated time. |

## Error response

```json
{
  "code": "INVALID_PARAMS",
  "msg": "invalid request parameters",
  "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`
  - `INVALID_PARAMS`
  - The request body cannot be parsed, or `enabled` is not a Boolean value.
  - Explicitly pass in `enabled` of type boolean.
* - `401`
  - —
  - Missing, invalid or expired access credentials.
  - Check API Key.
* - `403`
  - `COMPUTE_RESOURCE_SPEC_FORBIDDEN`
  - The current identity does not have specification management rights.
  - Try again using an identity with appropriate permissions.
* - `404`
  - —
  - The specification corresponding to `spec_id` does not exist.
  - First [list the calculation specifications](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/resource-center/compute-resource-specs/list-compute-resource-specs.html.md), and confirm the path parameters.
* - `500`
  - `SET_SPEC_ENABLED_FAILED`
  - The server failed to update the enabled status.
  - Try again later; if it continues to fail, contact support.
```

## Follow-up operations

[List calculation specifications](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/resource-center/compute-resource-specs/list-compute-resource-specs.html.md) Confirm the new status.
