# Usage

URL: https://docs.folkways.io/docs/platform-api/usage

Read a workspace's or segment's connections and traffic over time, and the current period's usage against its allowances.

Two kinds of report:

- **Usage over a range** (`/usage`): connections and traffic in time buckets, for charts.
- **The current period** (`/usage/period`): the billing totals for this month's period, against the allowances.

## Workspace usage [#workspace-usage]

```http
GET /api/v1/organizations/{workspaceId}/usage?from=2026-11-24T00:00:00Z&to=2026-12-01T00:00:00Z
X-API-Key: <key with workspace access>
```

| Query | Default | Meaning |
| --- | --- | --- |
| `from`, `to` | the last 24 hours | ISO 8601 times. `from` before `to`, at most 400 days apart |

The bucket size follows the range: 5 minutes up to 6 hours, 1 hour up to 3 days, 1 day beyond.

`data`:

| Field | Meaning |
| --- | --- |
| `from`, `to`, `bucket` | The range and bucket size |
| `collecting` | `true` while live figures are arriving. When `false`, current values are zero |
| `connections` | Connections open now |
| `messagesToday` | Publishes accepted since 00:00 UTC |
| `messagesIn`, `messagesOut` | Messages published and delivered in the range |
| `bytesIn`, `bytesOut` | Bytes in and out in the range |
| `series` | Per bucket: `start`, `connections` (the bucket's peak), `messagesIn`, `messagesOut`, `bytesIn`, `bytesOut` |
| `segments` | Per segment: `segmentId`, `name`, `connections` and `topics` now, `messagesIn`, `messagesOut`, `bytesIn`, `bytesOut` |

## Segment usage [#segment-usage]

```http
GET /api/v1/segments/{segmentId}/usage
X-API-Key: <key with access to the segment>
```

The same query and report, for one segment.

## Current period [#current-period]

```http
GET /api/v1/organizations/{workspaceId}/usage/period
X-API-Key: <key with workspace access>
```

The billing record for the current monthly period:

| Field | Meaning |
| --- | --- |
| `periodStart`, `periodEnd` | The current period |
| `used.messages` | Every publish plus every delivery |
| `used.dataTransferBytes` | Bytes in plus out, framing included |
| `used.peakConnections` | The busiest minute's connections |
| `used.framedBytesIn`, `used.framedBytesOut`, `used.payloadBytesIn`, `used.payloadBytesOut` | The traffic, with and without protocol framing |
| `used.connectionMinutes` | Connection time, for information; not billed |
| `used.publishesBlocked` | Publishes refused because an allowance or cap was used up |
| `allowances` | The package's `peakConnections`, `messages` and `dataTransferBytes` for the period; a missing one isn't limited |
| `graceUntil` | When a running grace period ends, if one is running |

```json
{
  "status": "SUCCESS",
  "data": {
    "allowances": { "dataTransferBytes": 53687091200, "messages": 20000000, "peakConnections": 1000 },
    "periodEnd": "2026-12-17T00:00:00.000Z",
    "periodStart": "2026-11-17T00:00:00.000Z",
    "used": { "dataTransferBytes": 1849120544, "messages": 4210388, "peakConnections": 312, "publishesBlocked": 0 }
  },
  "meta": { "requestId": "…", "timestamp": "…", "version": "v1" }
}
```

(Shortened.) [Usage and limits](/docs/console/usage) explains how each meter counts and what grace means.
