> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Metrics

> Read a sandbox's latest CPU, memory and network usage and a per-minute series for a time range.

`GET /v2/ai/sandboxes/{sandbox_id}/metrics` returns the latest sample and a per-minute series for a time range.

> [!NOTE]
>
> The metrics currently cover CPU, memory, disk, and network. GPU usage isn't reported yet: `gpus` is always `null`.

```bash CLI theme={null}
telnyx-edge sandbox-gpu metrics "$SANDBOX_ID" --from 2026-11-13T09:00:00Z --to 2026-11-13T10:00:00Z
telnyx-edge sandbox-gpu metrics "$SANDBOX_ID" --since 15m
```

```bash curl theme={null}
curl -sS -G "https://api.telnyx.com/v2/ai/sandboxes/$SANDBOX_ID/metrics" \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  --data-urlencode "from=2026-11-13T09:00:00Z" \
  --data-urlencode "to=2026-11-13T10:00:00Z"
```

`--since` sets the range's length before `--to` or now, and `--json` prints the `data` object of the response below.

| Parameter | Default | Description |
| - | - | - |
| `from` | 60 minutes before `to`, clipped to the sandbox's lifetime | Start of the range (RFC 3339, with a UTC offset). |
| `to` | Now, or the sandbox's end if it has ended | End of the range (RFC 3339, with a UTC offset). |

A range spans at most 24 hours. An invalid range is `400`. Metrics are kept for 30 days.

## Response

```json theme={null}
{
  "data": {
    "sandbox_id": "sb-0192f1c2-7a4b-7c3e-9d1e-2f3a4b5c6d7e",
    "from": "2026-11-13T09:00:00Z",
    "to": "2026-11-13T10:00:00Z",
    "step_seconds": 60,
    "latest": {
      "ts": "2026-11-13T09:59:51Z",
      "cpu_cores": 11.84,
      "net_rx_bytes": 52428800,
      "net_tx_bytes": 1048576,
      "mem_bytes": 2147483648,
      "disk_bytes": 34359738368,
      "gpus": null
    },
    "series": [
      {
        "ts": "2026-11-13T09:00:00Z",
        "cpu_cores_avg": 11.2,
        "cpu_cores_max": 12.6,
        "net_rx_bytes": 209715200,
        "net_tx_bytes": 4194304,
        "mem_bytes_avg": 2013265920,
        "mem_bytes_max": 2147483648,
        "disk_bytes": 34359738368,
        "gpus": null
      }
    ]
  }
}
```

* `latest` is the most recent sample, taken every 15 seconds; `null` if there is none yet.
* `series` has one point per minute (`step_seconds` is always 60), starting at the minute. It is empty where nothing is stored.

## Sources

CPU (`cpu_cores`, `cpu_cores_avg`, `cpu_cores_max`) and network (`net_rx_bytes`, `net_tx_bytes`) are measured on the host, outside the sandbox. Disk (`disk_bytes`) is the bytes used on `/data`, also measured outside the sandbox, every one to two minutes; it doesn't include the root filesystem. Memory (`mem_bytes`, `mem_bytes_avg`, `mem_bytes_max`) is reported from inside the sandbox. Memory and disk are for display only: billing uses the sandbox's requested resources, never these numbers. Each is `null` for a period in which it wasn't measured.

## Field Notes

* **CPU** is in cores, for the whole sandbox VM including its virtualization overhead. A busy sandbox can read above its `cpu`, by up to 1 core. `latest.cpu_cores` is the average since the previous sample; `cpu_cores_max` is the busiest interval between two samples in the minute.
* **Memory** is in bytes: what's in use inside the sandbox, meaning its processes, page cache in active use, and what it keeps in memory, such as files in `/dev/shm` and the kept output of its execs. It isn't the sandbox VM's total. `latest.mem_bytes` is the latest sample; `mem_bytes_avg` and `mem_bytes_max` are the average and the highest of the minute's samples (about every 15 seconds).
* **Network** counts bytes received (`net_rx_bytes`) and sent (`net_tx_bytes`): since the previous sample in `latest`, and within the minute in `series`. After a gap in measurement, the gap's bytes are in the first minute measured after it.
* A sandbox's last few seconds, and a sandbox that lives less than about 15 seconds, may not be measured.
