---
title: "List accounts with usage for a time range."
method: GET
path: "/v2/accounts/usage"
tags: ["Accounts"]
---

# List accounts with usage for a time range.

`GET /v2/accounts/usage`

Returns a page of accounts with usage aggregated by metric or currency. Metric sorting requires exactly one of metric_id or currency.

## Query parameters

- `start_at` integer, required — Unix timestamp in seconds.
- `end_at` integer, required — Unix timestamp in seconds.
- `aggregation` 'sum' | 'min' | 'max' | 'avg' | 'latest' | 'count' — Aggregation applied to corrected usage events. latest returns the quantity from the event with the latest occurred_at; ties use accepted_at then event ID. count returns the number of events.
- `limit` integer
- `starting_after` string — Return the next records after this account id.
- `sort` 'created_at' | 'customer_name' | 'metric_ascending' | 'metric_descending'
- `metric_id` string — LedgerUp metric identifier.
- `currency` string

## Response `200`

Page of accounts and aggregated usage.

- AccountUsageList
  - `data` AccountUsage[], required
    - `account` Account, required
      - `id` string, required — LedgerUp account identifier.
      - `external_id` string, nullable, required — Optional caller-supplied external identifier. Maximum 256 Unicode scalar values.
      - `ledgerup_customer_id` string, uuid, nullable, required — Optional LedgerUp billing customer UUID.
      - `name` string, required — Human-readable name. Maximum 256 Unicode scalar values.
      - `description` string, nullable, required — Optional description. Maximum 2048 Unicode scalar values.
      - `created_at` integer, required — Unix timestamp in seconds.
      - `updated_at` integer, required — Unix timestamp in seconds.
      - `archived_at` integer, required — Unix timestamp in seconds.
    - `events_consumed` AccountMetricUsage[], required
      - `metric_id` string, required — LedgerUp metric identifier, or the lowercase currency code for currency usage.
      - `currency` string, nullable, required — Lowercase currency code for currency usage. Null for normal metric usage.
      - `metric_name` string, nullable, required — Metric name. Null for currency usage.
      - `measurement_units` string, nullable, required — Optional unit of measure for the metric, such as m, ft, seconds, or tokens.
      - `quantity` string, required — Summed decimal quantity serialized as a string.
  - `has_more` boolean, required — True when additional records are available after the returned page.

## Other responses

- `400` — Bad request, invalid header, invalid amount/quantity/currency, or text validation failure.
- `401` — Missing or invalid API key.
- `403` — API key lacks the required permission, or reset was attempted outside the test namespace.
- `408` — Request exceeded the 30 second timeout.
- `422` — Semantically invalid request, such as a service period with start greater than end.
- `429` — Rate limit exceeded.
- `500` — Internal server error or queue failure.

---

[API](https://skmtc.dev/ledgerup/apis/ledgerup-api.md) · [All operations](https://skmtc.dev/ledgerup/apis/ledgerup-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/ledgerup/ledgerup-api/revisions/be257191807b/schema)
