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

# Get Metrics

> Retrieve resource usage metrics for a sandbox.

Returns an array of recent resource-usage snapshots for the sandbox. Each entry
captures CPU utilisation, memory usage, and disk usage at a point in time.

<Warning>
  Metrics collection is not yet implemented. The endpoint currently returns
  `501 Not Implemented`. The signature and response schema below describe the
  shape that will be returned once collection ships.
</Warning>

## Path Parameters

<ParamField path="sandbox_id" type="string" required>
  The sandbox identifier. Format: `sbx-<8 chars>`.
</ParamField>

## Response

Returns an array of `SandboxMetrics` objects.

<ResponseField name="[].timestamp" type="string">
  UTC timestamp of the measurement in ISO 8601 format.
</ResponseField>

<ResponseField name="[].cpu_usage_percent" type="number">
  CPU utilisation as a percentage (0–100).
</ResponseField>

<ResponseField name="[].memory_usage_mb" type="number">
  Resident memory usage in megabytes.
</ResponseField>

<ResponseField name="[].disk_usage_mb" type="number">
  Disk usage in megabytes.
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.declaw.ai/sandboxes/sbx-a1b2c3d4/metrics \
    -H "X-API-Key: YOUR_API_KEY"
  ```

  ```python Python theme={null}
  from declaw import Sandbox

  sbx = Sandbox.connect("sbx-a1b2c3d4", api_key="YOUR_API_KEY", domain="api.declaw.ai")
  metrics = sbx.metrics()
  for m in metrics:
      print(m.cpu_usage_percent, m.memory_usage_mb)
  ```

  ```typescript TypeScript theme={null}
  import { Sandbox } from "@declaw/sdk";

  const sbx = await Sandbox.connect("sbx-a1b2c3d4", {
    apiKey: "YOUR_API_KEY",
    domain: "api.declaw.ai",
  });
  const metrics = await sbx.metrics();
  for (const m of metrics) {
    console.log(m.cpuUsagePercent, m.memoryUsageMb);
  }
  ```
</CodeGroup>

```json Response theme={null}
[
  {
    "timestamp": "2024-01-15T10:30:00Z",
    "cpu_usage_percent": 15.0,
    "memory_usage_mb": 256.0,
    "disk_usage_mb": 100.0
  }
]
```

## Error Responses

| Status | Cause                      |
| ------ | -------------------------- |
| `401`  | Missing or invalid API key |
| `404`  | Sandbox not found          |
