# Query Cpu

> Channels API · Metrics

```http
GET /api/channel-metrics/cpu/
```

Query CPU utilization over time range. Returns Prometheus format.

## Authentication

- `Authorization` header — Bearer authentication of the form `Bearer <token>`.

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `start` | string | Yes | Start time (ISO8601 or Unix timestamp) |
| `end` | string | Yes | End time (ISO8601 or Unix timestamp) |
| `step` | string | No | Query resolution step _Defaults to 60s_ |

## Example request

```bash
curl -X GET "/api/channel-metrics/cpu/?step=60s" \
  -H "Authorization: Bearer <token>"
```

## Responses

### 200 — Successful Response

- `status` · string · **Required** — 'success' or 'error'
- `data` · object · Optional
  - One of the following variants:
    - **PrometheusMatrixData** (object)
      - `resultType` · string · Optional · _Defaults to matrix_
      - `result` · list of objects · **Required**
        - Array items (object):
          - `metric` · object · **Required** — Metric labels from Prometheus. Allows arbitrary labels.
            - `serverID` · object · Optional
              - One of the following variants:
                - **string** (string)
                - **null** (null)
            - `name` · object · Optional
              - One of the following variants:
                - **string** (string)
                - **null** (null)
            - `job` · object · Optional
              - One of the following variants:
                - **string** (string)
                - **null** (null)
          - `values` · list of list of itemss · **Required** — Array of [unix_timestamp, value_string] pairs
            - Array items (list of items):
    - **null** (null)
- `error` · object · Optional — Error message if status is 'error'
  - One of the following variants:
    - **string** (string)
    - **null** (null)
- `errorType` · object · Optional
  - One of the following variants:
    - **string** (string)
    - **null** (null)

Example:

```json
{
  "status": "string",
  "data": {
    "resultType": "matrix",
    "result": [
      {
        "metric": {
          "serverID": "string",
          "name": "string",
          "job": "string"
        },
        "values": [
          []
        ]
      }
    ]
  },
  "error": "string",
  "errorType": "string"
}
```

### 422 — Validation Error

- `detail` · list of objects · Optional
  - Array items (object):
    - `loc` · list of objects · **Required**
      - Array items (object):
        - One of the following variants:
          - **string** (string)
          - **integer** (integer)
    - `msg` · string · **Required**
    - `type` · string · **Required**
    - `input` · any · Optional
    - `ctx` · object · Optional

Example:

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}
```

---

Source spec: `channels-api` · operationId: `query_cpu_metrics_cpu__get`
