# Usage

What you have used, and what it cost.

Source: https://docs.pantechdynamics.com/api/usage

Usage is measured per resource and rated into cost. `GET /usage/by-resource` answers "what did each thing cost"; the other endpoints return the measured quantities.

Endpoints:

- `GET /public/v1/instances/{instance_id}/usage`: Get an instance's usage
- `GET /public/v1/volumes/{volume_id}/usage`: Get a volume's usage
- `GET /public/v1/snapshots/{snapshot_id}/usage`: Get a snapshot's usage
- `GET /public/v1/usage`: Get usage
- `GET /public/v1/usage/by-resource`: Get cost by resource

## Get an instance's usage

```http
GET /public/v1/instances/{instance_id}/usage
```

Measured usage for this instance in the current billing period: running hours, storage, memory and network.

Scope: `read`.

Path parameters:

- `instance_id`: The resource's id.

Example:

```sh
curl "https://api.pantechdynamics.com/public/v1/instances/vm_06gk3x9tq7m2v8r4y1c5d0zp8w/usage" \
  -H "Authorization: Bearer $PANTECH_API_KEY"
```

Response `200`:

```json
{
  "window_start": "2026-10-03T09:30:00Z",
  "window_end": "2026-10-03T09:30:00Z",
  "totals": {
    "running_hours": 730,
    "storage_gb_hours": 1,
    "allocated_memory_mb_hours": 1,
    "network_bytes_sent": 1,
    "network_bytes_received": 1
  },
  "entries": [
    {
      "resource_id": "vm_06gk3x9tq7m2v8r4y1c5d0zp8w",
      "usage_type": 1,
      "usage": "24 Hrs",
      "period_start": "2026-10-03T09:30:00Z",
      "period_end": "2026-10-03T09:30:00Z"
    }
  ]
}
```

Errors:

- `401`: `UNAUTHENTICATED`: the request has no API key, or the key is mistyped, revoked or expired, or its creator has left the organization. Send `Authorization: Bearer PAN_…` with a valid key; create one in the console under Organization › API keys.
- `403`: `INSUFFICIENT_SCOPE`: the API key lacks the scope this endpoint needs (`read` for GET, `write` for changes; an AI app's key also needs `delete` for a destructive call). Use a key with that scope, or reconnect the AI app with "Manage and delete" access.
`FORBIDDEN`: the member who created the key may not do this in the organization. Use a key created by an owner or admin.
`AI_APPS_DISABLED`: the organization has turned AI app access off, and this request was made with an AI app's key or sent by Pantech's MCP server (`Pantech-Client: mcp/…`). An owner can turn it on in the console under Organization › AI apps.
- `404`: `RESOURCE_NOT_FOUND`: no instance with this id in your organization, or the id is not a instance id (`vm_…`). Check the id.
- `429`: `RATE_LIMITED`: this API key, verified user or organization used its request budget for the current window, or this address exceeded an IP/failed-auth limit. Wait `Retry-After` seconds, then retry. For authenticated quota denials, `RateLimit-Scope` identifies the denying quota and `RateLimit-Reset` reports its remaining window in seconds.
- `503`: `SERVICE_UNAVAILABLE`: request quota storage is unavailable. Wait a few seconds, then retry.
## Get a volume's usage

```http
GET /public/v1/volumes/{volume_id}/usage
```

Measured storage usage for this volume in the current billing period.

Scope: `read`.

Path parameters:

- `volume_id`: The resource's id.

Example:

```sh
curl "https://api.pantechdynamics.com/public/v1/volumes/vol_06gk3x9tq7m2v8r4y1c5d0zp8w/usage" \
  -H "Authorization: Bearer $PANTECH_API_KEY"
```

Response `200`:

```json
{
  "window_start": "2026-10-03T09:30:00Z",
  "window_end": "2026-10-03T09:30:00Z",
  "totals": {
    "running_hours": 730,
    "storage_gb_hours": 1,
    "allocated_memory_mb_hours": 1,
    "network_bytes_sent": 1,
    "network_bytes_received": 1
  },
  "entries": [
    {
      "resource_id": "vm_06gk3x9tq7m2v8r4y1c5d0zp8w",
      "usage_type": 1,
      "usage": "24 Hrs",
      "period_start": "2026-10-03T09:30:00Z",
      "period_end": "2026-10-03T09:30:00Z"
    }
  ]
}
```

Errors:

- `401`: `UNAUTHENTICATED`: the request has no API key, or the key is mistyped, revoked or expired, or its creator has left the organization. Send `Authorization: Bearer PAN_…` with a valid key; create one in the console under Organization › API keys.
- `403`: `INSUFFICIENT_SCOPE`: the API key lacks the scope this endpoint needs (`read` for GET, `write` for changes; an AI app's key also needs `delete` for a destructive call). Use a key with that scope, or reconnect the AI app with "Manage and delete" access.
`FORBIDDEN`: the member who created the key may not do this in the organization. Use a key created by an owner or admin.
`AI_APPS_DISABLED`: the organization has turned AI app access off, and this request was made with an AI app's key or sent by Pantech's MCP server (`Pantech-Client: mcp/…`). An owner can turn it on in the console under Organization › AI apps.
- `404`: `RESOURCE_NOT_FOUND`: no volume with this id in your organization, or the id is not a volume id (`vol_…`). Check the id.
- `429`: `RATE_LIMITED`: this API key, verified user or organization used its request budget for the current window, or this address exceeded an IP/failed-auth limit. Wait `Retry-After` seconds, then retry. For authenticated quota denials, `RateLimit-Scope` identifies the denying quota and `RateLimit-Reset` reports its remaining window in seconds.
- `503`: `SERVICE_UNAVAILABLE`: request quota storage is unavailable. Wait a few seconds, then retry.
## Get a snapshot's usage

```http
GET /public/v1/snapshots/{snapshot_id}/usage
```

Measured storage usage for this snapshot in the current billing period.

Scope: `read`.

Path parameters:

- `snapshot_id`: The resource's id.

Example:

```sh
curl "https://api.pantechdynamics.com/public/v1/snapshots/snap_06gk3x9tq7m2v8r4y1c5d0zp8w/usage" \
  -H "Authorization: Bearer $PANTECH_API_KEY"
```

Response `200`:

```json
{
  "window_start": "2026-10-03T09:30:00Z",
  "window_end": "2026-10-03T09:30:00Z",
  "totals": {
    "running_hours": 730,
    "storage_gb_hours": 1,
    "allocated_memory_mb_hours": 1,
    "network_bytes_sent": 1,
    "network_bytes_received": 1
  },
  "entries": [
    {
      "resource_id": "vm_06gk3x9tq7m2v8r4y1c5d0zp8w",
      "usage_type": 1,
      "usage": "24 Hrs",
      "period_start": "2026-10-03T09:30:00Z",
      "period_end": "2026-10-03T09:30:00Z"
    }
  ]
}
```

Errors:

- `401`: `UNAUTHENTICATED`: the request has no API key, or the key is mistyped, revoked or expired, or its creator has left the organization. Send `Authorization: Bearer PAN_…` with a valid key; create one in the console under Organization › API keys.
- `403`: `INSUFFICIENT_SCOPE`: the API key lacks the scope this endpoint needs (`read` for GET, `write` for changes; an AI app's key also needs `delete` for a destructive call). Use a key with that scope, or reconnect the AI app with "Manage and delete" access.
`FORBIDDEN`: the member who created the key may not do this in the organization. Use a key created by an owner or admin.
`AI_APPS_DISABLED`: the organization has turned AI app access off, and this request was made with an AI app's key or sent by Pantech's MCP server (`Pantech-Client: mcp/…`). An owner can turn it on in the console under Organization › AI apps.
- `404`: `RESOURCE_NOT_FOUND`: no snapshot with this id in your organization, or the id is not a snapshot id (`snap_…`). Check the id.
- `429`: `RATE_LIMITED`: this API key, verified user or organization used its request budget for the current window, or this address exceeded an IP/failed-auth limit. Wait `Retry-After` seconds, then retry. For authenticated quota denials, `RateLimit-Scope` identifies the denying quota and `RateLimit-Reset` reports its remaining window in seconds.
- `503`: `SERVICE_UNAVAILABLE`: request quota storage is unavailable. Wait a few seconds, then retry.
## Get usage

```http
GET /public/v1/usage
```

Measured usage for the whole organization in the current billing period.

Scope: `read`.

Example:

```sh
curl "https://api.pantechdynamics.com/public/v1/usage" \
  -H "Authorization: Bearer $PANTECH_API_KEY"
```

Response `200`:

```json
{
  "window_start": "2026-10-03T09:30:00Z",
  "window_end": "2026-10-03T09:30:00Z",
  "totals": {
    "running_hours": 730,
    "storage_gb_hours": 1,
    "allocated_memory_mb_hours": 1,
    "network_bytes_sent": 1,
    "network_bytes_received": 1
  },
  "entries": [
    {
      "resource_id": "vm_06gk3x9tq7m2v8r4y1c5d0zp8w",
      "usage_type": 1,
      "usage": "24 Hrs",
      "period_start": "2026-10-03T09:30:00Z",
      "period_end": "2026-10-03T09:30:00Z"
    }
  ]
}
```

Errors:

- `401`: `UNAUTHENTICATED`: the request has no API key, or the key is mistyped, revoked or expired, or its creator has left the organization. Send `Authorization: Bearer PAN_…` with a valid key; create one in the console under Organization › API keys.
- `403`: `INSUFFICIENT_SCOPE`: the API key lacks the scope this endpoint needs (`read` for GET, `write` for changes; an AI app's key also needs `delete` for a destructive call). Use a key with that scope, or reconnect the AI app with "Manage and delete" access.
`FORBIDDEN`: the member who created the key may not do this in the organization. Use a key created by an owner or admin.
`AI_APPS_DISABLED`: the organization has turned AI app access off, and this request was made with an AI app's key or sent by Pantech's MCP server (`Pantech-Client: mcp/…`). An owner can turn it on in the console under Organization › AI apps.
- `429`: `RATE_LIMITED`: this API key, verified user or organization used its request budget for the current window, or this address exceeded an IP/failed-auth limit. Wait `Retry-After` seconds, then retry. For authenticated quota denials, `RateLimit-Scope` identifies the denying quota and `RateLimit-Reset` reports its remaining window in seconds.
- `503`: `SERVICE_UNAVAILABLE`: request quota storage is unavailable. Wait a few seconds, then retry.
## Get cost by resource

```http
GET /public/v1/usage/by-resource
```

What each resource cost over `period`: the last `30d` or `7d`, this `month` or `last_month`.

Scope: `read`.

Query parameters:

- `period` (string): One of `30d`, `7d`, `month`, `last_month`. Defaults to `30d`.

Example:

```sh
curl "https://api.pantechdynamics.com/public/v1/usage/by-resource" \
  -H "Authorization: Bearer $PANTECH_API_KEY"
```

Response `200`:

```json
{
  "currency": "NGN",
  "period_start": "2026-10-03T09:30:00Z",
  "period_end": "2026-10-03T09:30:00Z",
  "data": [
    {
      "resource_id": "vm_06gk3x9tq7m2v8r4y1c5d0zp8w",
      "resource_name": "web-1",
      "resource_kind": "instance",
      "type": "compute",
      "days_active": 3,
      "window_days": 30,
      "rate_unit": "hour",
      "rate_unit_price_micros": 1232876000,
      "cost_minor": 295890
    }
  ]
}
```

Errors:

- `401`: `UNAUTHENTICATED`: the request has no API key, or the key is mistyped, revoked or expired, or its creator has left the organization. Send `Authorization: Bearer PAN_…` with a valid key; create one in the console under Organization › API keys.
- `403`: `INSUFFICIENT_SCOPE`: the API key lacks the scope this endpoint needs (`read` for GET, `write` for changes; an AI app's key also needs `delete` for a destructive call). Use a key with that scope, or reconnect the AI app with "Manage and delete" access.
`FORBIDDEN`: the member who created the key may not do this in the organization. Use a key created by an owner or admin.
`AI_APPS_DISABLED`: the organization has turned AI app access off, and this request was made with an AI app's key or sent by Pantech's MCP server (`Pantech-Client: mcp/…`). An owner can turn it on in the console under Organization › AI apps.
- `422`: `VALIDATION_FAILED`: a field is invalid. Each entry of `errors` names the `field` and its `code`:
`period` `INVALID_PERIOD`: use `30d`, `7d`, `month` or `last_month`.
- `429`: `RATE_LIMITED`: this API key, verified user or organization used its request budget for the current window, or this address exceeded an IP/failed-auth limit. Wait `Retry-After` seconds, then retry. For authenticated quota denials, `RateLimit-Scope` identifies the denying quota and `RateLimit-Reset` reports its remaining window in seconds.
- `503`: `SERVICE_UNAVAILABLE`: request quota storage is unavailable. Wait a few seconds, then retry.
`BILLING_UNAVAILABLE`: billing is not answering right now. Wait a few seconds, then retry.
