# List calculation specifications

Lists calculation specifications visible in the current workspace.

```text
GET https://moi.matrixorigin.cn/newmoi/compute-resource-specs
```

## Preparation before calling

Prepare a personal access token and target workspace ID that has access to the target workspace.

The example below uses:

- `$AI_STUDIO_API_KEY`: The actual personal access token, passed through the `X-API-Key` Header.
- `$WORKSPACE_ID`: The workspace ID to be queried is passed through the `X-Workspace-ID` Header.

Reread this interface before creating an instance, and do not assume that the specifications of other workspaces are available.

## Request example

```bash
curl "https://moi.matrixorigin.cn/newmoi/compute-resource-specs" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

## Successful response

When successful, `200` is returned. `data` is the calculation specification array.

```json
{
  "code": "OK",
  "msg": "OK",
  "data": [
    {
      "id": "task-standard-small",
      "kind": "task",
      "family": "standard",
      "cpu_milli": 2000,
      "memory_mib": 4096,
      "gpu_count": 0,
      "credit_per_hour": 1,
      "enabled": true
    }
  ]
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | `OK` on success. |
| `msg` | string | `OK` on success. |
| `data[].id` | string | Specification ID, used to create computing instances. |
| `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. |
| `data[].node_placement` | object | Node scheduling configuration. |
| `data[].enabled` | boolean | Whether the specification is enabled. |
| `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. |

In field paths, `[]` means each item in an array. For example, `data[].id` is the `id` field of each item in `data`.

## Error response

```json
{
  "code": "LIST_SPECS_FAILED",
  "msg": "failed to list compute resource specs",
  "data": null
}
```

### Common HTTP errors

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

* - HTTP status code
  - error code
  - Common causes
  - Recommended actions
* - `401`
  - —
  - Missing, invalid or expired access credentials.
  - Check API Key.
* - `403`
  - —
  - The current identity does not have access to the specifications of this workspace.
  - Check workspace ID and access permissions.
* - `500`
  - `LIST_SPECS_FAILED`
  - The server cannot read the specification list.
  - Try again later; if it continues to fail, contact support.
```

## Follow-up operations

Use `id` [Create a calculation instance](../compute-resources/create-compute-resource.md) with spec enabled.
