# Usage API

> Read team spend, spend per model and every usage row through the Sume API: GET /v1/usage/summary and GET /v1/usage/generations, with examples and error codes.

Source: https://www.sume.com/docs/usage

Two endpoints give you the numbers of the
[Usage dashboard](https://www.sume.com/dashboard/usage) and its CSV export as
JSON:

```text
GET /v1/usage/summary        spend added up by model, day, month, member or surface
GET /v1/usage/generations    every usage row, with the CSV's columns
```

The live [OpenAPI](https://api.sume.com/reference/json) gives the accurate
schemas.

## Who can read the team's spend

The answer follows the person who made the API key:

| Key owner | Reads | `scope` in the response |
|---|---|---|
| Team Owner, Admin or Billing member | Every member's usage. | `workspace` |
| Any other team member | Only that member's own usage. | `own` |
| A personal workspace | That workspace's usage. | `workspace` |

A key that reads only its owner's usage gets `403 insufficient_role` when it
asks for `scope=workspace` or names another person in `member`. For reports,
make a read-only key from an Owner, Admin or Billing account in
[Dashboard → API keys](https://www.sume.com/dashboard/api-keys).

## Spend per model

```bash
curl "https://api.sume.com/v1/usage/summary?from=2026-11-01&to=2026-11-30&group_by=model" \
  -H "Authorization: Bearer $SUME_API_KEY"
```

```json
{
  "object": "usage_summary",
  "scope": "workspace",
  "currency": "usd",
  "range": {
    "from": "2026-11-01",
    "to": "2026-11-30",
    "timezone": "UTC",
    "date_field": "created_at",
    "since": "2026-11-01T00:00:00.000Z",
    "before": "2026-12-01T00:00:00.000Z"
  },
  "group_by": ["model"],
  "groups": [
    {
      "model": "seedance-2.5",
      "requests": 412,
      "charged_requests": 398,
      "refunded_requests": 11,
      "held_requests": 3,
      "charged_usd": "861.420000",
      "refunded_usd": "21.750000",
      "held_usd": "6.300000",
      "list_usd": "861.420000",
      "input_tokens": 0,
      "output_tokens": 0,
      "duration_seconds": 2985,
      "share_of_charged": "0.7204"
    },
    {
      "model": "openai/gpt-image-2.5",
      "requests": 1930,
      "charged_requests": 1921,
      "refunded_requests": 9,
      "held_requests": 0,
      "charged_usd": "334.254000",
      "refunded_usd": "1.566000",
      "held_usd": "0.000000",
      "list_usd": "334.254000",
      "input_tokens": 0,
      "output_tokens": 0,
      "duration_seconds": 0,
      "share_of_charged": "0.2796"
    }
  ],
  "totals": {
    "requests": 2342,
    "charged_requests": 2319,
    "refunded_requests": 20,
    "held_requests": 3,
    "charged_usd": "1195.674000",
    "refunded_usd": "23.316000",
    "held_usd": "6.300000",
    "list_usd": "1195.674000",
    "input_tokens": 0,
    "output_tokens": 0,
    "duration_seconds": 2985,
    "share_of_charged": "1.0000"
  }
}
```

`totals.charged_usd` is the team's spend for the range. `group_by` takes one or
two of these, separated by a comma:

| `group_by` | Each group is | Fields it adds |
|---|---|---|
| `model` | One model. | `model` |
| `day` | One day in `timezone`. | `day` (`YYYY-MM-DD`) |
| `month` | One month in `timezone`. | `month` (`YYYY-MM`) |
| `member` | One person. | `member_user_id`, `member_name`, `member_email` |
| `surface` | Where the request was made. | `surface` |

`day` and `month` cannot be used together. Groups come in time order when you
group by `day` or `month`. After that, the group with the largest
`charged_usd` is first.

```bash
# Spend per person
curl "https://api.sume.com/v1/usage/summary?from=2026-11-01&to=2026-11-30&group_by=member" \
  -H "Authorization: Bearer $SUME_API_KEY"

# Each model's spend per day, in Seoul time
curl "https://api.sume.com/v1/usage/summary?from=2026-11-01&to=2026-11-30&group_by=model,day&timezone=Asia/Seoul" \
  -H "Authorization: Bearer $SUME_API_KEY"
```

## Every usage row

```bash
curl "https://api.sume.com/v1/usage/generations?from=2026-11-01&to=2026-11-30&limit=100" \
  -H "Authorization: Bearer $SUME_API_KEY"
```

```json
{
  "object": "list",
  "scope": "workspace",
  "currency": "usd",
  "range": {
    "from": "2026-11-01",
    "to": "2026-11-30",
    "timezone": "UTC",
    "date_field": "created_at",
    "since": "2026-11-01T00:00:00.000Z",
    "before": "2026-12-01T00:00:00.000Z"
  },
  "data": [
    {
      "created_at": "2026-11-24T08:12:44.512Z",
      "captured_at": "2026-11-24T08:13:31.007Z",
      "refunded_at": null,
      "usage_id": "usage_0f3c9a51d2b74e6f",
      "job_id": "job_0123456789abcdef",
      "run_id": null,
      "status": "captured",
      "job_status": "completed",
      "surface": "api",
      "member_user_id": "user_2abcDEF",
      "member_name": "Ada Park",
      "member_email": "ada@example.com",
      "former_member": false,
      "api_key_id": "key_7d1e",
      "api_key_prefix": "sume_live_ab12",
      "connection_id": null,
      "model": "seedance-2.5",
      "operation_type": "video_generation",
      "resolution": "720p",
      "quality": null,
      "duration_seconds": 5,
      "references": "image",
      "reference_images": 1,
      "reference_videos": 0,
      "reference_audios": 0,
      "input_tokens": null,
      "output_tokens": null,
      "cache_read_tokens": null,
      "cache_write_tokens": null,
      "price_basis": "standard",
      "funding_mode": "prepaid",
      "list_usd": "1.380000",
      "discount_usd": null,
      "charged_usd": "1.380000",
      "refunded_usd": "0.000000",
      "held_usd": "0.000000"
    }
  ],
  "has_more": true,
  "next_cursor": "MjAyNi0xMS0yNCAwODoxMjo0NC41MTIwMDArMDB8dXNhZ2VfMGYzYzlhNTFkMmI3NGU2Zg"
}
```

Rows come newest first. Send `next_cursor` back as `cursor` to read the next
page, until `has_more` is `false`. With a `model` or `surface` filter, a page
can hold fewer rows than `limit` while `has_more` is `true`.

```bash
cursor=""
while :; do
  page=$(curl -s "https://api.sume.com/v1/usage/generations?from=2026-11-01&to=2026-11-30&limit=1000${cursor:+&cursor=$cursor}" \
    -H "Authorization: Bearer $SUME_API_KEY")
  echo "$page" | jq -c '.data[]' >> usage.jsonl
  cursor=$(echo "$page" | jq -r '.next_cursor // empty')
  [ -z "$cursor" ] && break
done
```

A row has the same 36 columns as the CSV, in the same order:

| Field | Meaning |
|---|---|
| `created_at` | When the request was made. |
| `captured_at` | When the charge settled, or `null` while the amount is held. |
| `refunded_at` | When the charge was returned, or `null`. |
| `usage_id` | The id of the usage row. |
| `job_id`, `run_id` | The generation job, and the Format, Action or Agent run that made it. |
| `status` | `reserved` (held while the job runs), `captured` (charged) or `refunded` (returned). |
| `job_status` | The status of the job. |
| `surface` | Where the request was made: `studio`, `director`, `agents`, `connection` (a connected app), `api` (an API key) or `other`. |
| `member_user_id`, `member_name`, `member_email` | The person whose request it was. The name and the email are `null` outside a team. |
| `former_member` | `true` when the person left the team. |
| `api_key_id`, `api_key_prefix` | The API key that made the request, if a key made it. |
| `connection_id` | The connected app that made the request, if an app made it. |
| `model` | The public id of the model. |
| `operation_type` | The kind of work, such as `video_generation`. |
| `resolution`, `quality`, `duration_seconds` | The settings of the output. |
| `references`, `reference_images`, `reference_videos`, `reference_audios` | The reference media that the request sent. |
| `input_tokens`, `output_tokens`, `cache_read_tokens`, `cache_write_tokens` | Token counts of a language-model call. |
| `price_basis` | How the price was set, such as the list price or an agreed price. |
| `funding_mode` | Which balance paid. |
| `list_usd` | The list price of Sume. |
| `discount_usd` | The amount that an agreement or an event took off. |
| `charged_usd` | The amount that left the balance. It is zero unless the row is `captured`. |
| `refunded_usd` | The amount that was returned. It is zero unless the row is `refunded`. |
| `held_usd` | The amount that is held while the job runs. It is zero unless the row is `reserved`. |

## Parameters

| Parameter | Used by | Meaning |
|---|---|---|
| `from`, `to` | both | The first day and the last day, `YYYY-MM-DD`. Both are required, and `to` is included. The range can be 3,660 days at most. |
| `timezone` | both | The IANA time zone that the days are read in, such as `Asia/Seoul`. The default is `UTC`. |
| `date_field` | both | `created_at` (default) counts a row on the day of the request. `captured_at` counts a row on the day that its charge settled. Billing uses `captured_at`. |
| `model` | both | Only this model, by its public id as the rows show it. |
| `member` | both | Only this person, by user id. |
| `surface` | both | Only this surface. |
| `scope` | both | `workspace` or `own`. Without it, you get the widest scope that the key can read. |
| `group_by` | summary | One or two of `model`, `day`, `month`, `member`, `surface`. It is required. |
| `limit` | generations | Rows in one page, from 1 to 1,000. The default is 100. |
| `cursor` | generations | The `next_cursor` of the page before. |

## Money and timing

- Each `_usd` field is a string in US dollars with six decimals, such as
  `"1.380000"`. The values are the same as in the CSV.
- The prices are your prices. `list_usd` is the list price, and `charged_usd`
  is the amount that left the balance.
- The data is live. A row is `reserved` while its job runs. Then it becomes
  `captured` or `refunded`. Thus the numbers of today can change.
  Use `date_field=captured_at` for numbers that agree with billing.

## Limits

- A summary reads 300,000 usage rows at most. A larger range gets
  `400 usage_range_too_large`. Ask for fewer days.
- Usage reports have their own rate budget, apart from other reads and from
  submits. `GET /v1/usage/generations` gets the request rate of your plan
  (120 each minute on Free). `GET /v1/usage/summary` gets a tenth of that rate
  (12 each minute on Free). A `429` for this budget has
  `error.details.scope: "report"`.

## Errors

| Status | `error.code` | Cause |
|---|---|---|
| `400` | `invalid_request` | A parameter is absent or not valid. The message names the parameter. |
| `400` | `usage_range_too_large` | The range has more rows than a summary reads. |
| `401` | `unauthorized` | The key is absent or not valid. |
| `403` | `insufficient_role` | The owner of the key can read only their own usage. |
| `429` | `rate_limited` | The report budget is used up. Wait for `retry-after` seconds. |
| `503` | `usage_unavailable` | Usage reports are not available at this time. Try again later. |

`GET /v1/usage` gives the newest ledger rows and the spend of one thread, run
or job, and it obeys the same rule for teams. A key from Dashboard → API keys
does not call `GET /v1/usage`. It calls the two routes on this page.
