Billing · Usage export

# GET/account/usage

Returns one row per charged request: the lines your invoice is added up from. Any of the account’s keys can call it, and it covers every key unless you ask for one. As CSV by default, or as JSON. It is the same export the console downloads.

## Parameters

Parameters

- `month` (string): A calendar month in UTC, as YYYY-MM. Not together with from and to.
- `from` (string): The start of a range: a date (2026-10-01) or an ISO 8601 time. Rows completed at or after it are returned. Needs to.
- `to` (string): The end of a range. A date includes that whole day; a time is the instant the range stops before. Needs from.
- `key_id` (string): Only the requests made with this key.
- `format` (string): csv (the default) or json.
- `limit` (number): JSON only. Rows per page: 1 to 10000. 1000 when left out.
- `cursor` (string): JSON only. The next_cursor of the page before.

With neither month nor a range, the current month so far. A request belongs to the month in which it completed, in UTC.

## Request body

This request has no body.

## Examples

### As CSV

Request

```bash
curl "https://media.logicboostkit.com/account/usage?month=2026-10" \
  -H "Authorization: Basic $MEDIA_KEY"
```

Response

```http
HTTP/1.1 200 OK
X-Request-Id: job_0mv6io8lccjzfdcme0rft6oj
Content-Type: text/csv; charset=utf-8
Content-Disposition: attachment; filename="usage-2026-10-01-to-2026-11-01.csv"

request_id,completed_at,key_id,gb_sec,amount_usd
job_0mv6hcx5429ir9i0kjnput8u,2026-10-13T09:30:15.880Z,key_r927c1t0v2p6,90.307013221,1.202889416
job_0mv6hnzdy93wuugau1rys4cn,2026-10-13T09:38:52.006Z,key_sbdjfopoebls,1.118652615,0.014900453
job_0mv6hqvpqkiwproi518azpod,2026-10-13T09:41:07.214Z,key_r927c1t0v2p6,3.536250000,0.047102850
```

### As JSON

Request

```bash
curl "https://media.logicboostkit.com/account/usage?from=2026-10-13&to=2026-10-13&key_id=key_r927c1t0v2p6&format=json" \
  -H "Authorization: Basic $MEDIA_KEY"
```

Response

```http
HTTP/1.1 200 OK
X-Request-Id: job_0mv6iv6v5rmhf80bjaztl3yl

{
  "ok": true,
  "from": "2026-10-13T00:00:00.000Z",
  "to": "2026-10-14T00:00:00.000Z",
  "rows": [
    {
      "request_id": "job_0mv6hcx5429ir9i0kjnput8u",
      "completed_at": "2026-10-13T09:30:15.880Z",
      "key_id": "key_r927c1t0v2p6",
      "gb_sec": 90.307013221,
      "amount_usd": 1.202889416
    },
    {
      "request_id": "job_0mv6hqvpqkiwproi518azpod",
      "completed_at": "2026-10-13T09:41:07.214Z",
      "key_id": "key_r927c1t0v2p6",
      "gb_sec": 3.53625,
      "amount_usd": 0.04710285
    }
  ],
  "next_cursor": null
}
```

## Response fields

Response fields

- `request_id` (string): The request’s id: the X-Request-Id of its response, and for an async job its job_id.
- `completed_at` (string): When the request completed, in UTC, to the millisecond.
- `key_id` (string): The key that made the request. The console shows each key’s id.
- `gb_sec` (number): The GB-seconds the request was charged on. Nine decimal places in CSV.
- `amount_usd` (number): What it was charged, in USD. Nine decimal places in CSV.

These five columns, and nothing else. The CSV is the whole range in one file, oldest first. JSON adds `ok`, the range as `from` and `to`, and `next_cursor`, which is null on the last page. Rows are kept 24 months.

## Status codes

Status codes

- **200**: The rows. Not charged.
- **400**: month isn’t YYYY-MM, month came with from or to, only one of from and to was given, from isn’t before to, or key_id, format, limit or cursor isn’t valid.
- **401**: The `Authorization` header is missing, or the key is invalid, revoked or expired.
- **403**: The account isn’t active. The error says what to do.
- **429**: More than 300 requests in a minute on this key. Wait for the number of seconds in `Retry-After`.

Every error has the shape `{"ok": false, "error": "…"}` and is never charged.
