---
title: "Get consumption analytics"
method: GET
path: "/api/v2alpha/analytics/consumption"
---

# Get consumption analytics

`GET /api/v2alpha/analytics/consumption`

Query credit or ACU consumption data for the authenticated team. Results are sourced from
hourly-aggregated billing events and can be filtered by date range, product, model, and group.

The response shape depends on the team's billing strategy:
- **Credits-based** teams receive `prompt_credits` and `flex_credits` in each row.
- **ACU-based** teams receive `billed_acus` in each row.

Responses are cached for 1 hour. Use `If-None-Match` with a previously returned `ETag` to
receive a `304 Not Modified` when the data has not changed.

These endpoints are designed for periodic reporting and bulk export. They are **not** intended for real-time usage monitoring: data is hourly-aggregated and the rate limit is low (10 requests per hour per team).

## Query parameters

- `start_date` string, date, required
- `end_date` string, date, required
- `product` 'agent', required
- `granularity` 'daily' | 'monthly'
- `group_by` string
- `models` string
- `group_id` string
- `user_id` string
- `page_size` integer
- `page_cursor` string

## Headers

- `If-None-Match` string

## Response `200`

Consumption data returned successfully.

- ConsumptionResponse
  - `data` ConsumptionRow[], required — Array of consumption data rows.
    - `timestamp` string — Time bucket for the row. Format depends on `granularity`: `YYYY-MM-DD` for daily, `YYYY-MM` for monthly. Only present when `granularity` is specified.
    - `user_id` string — User identifier (auth UID). Only present when `group_by` includes `user`.
    - `user_email` string — User's email address. Only present when `group_by` includes `user`.
    - `model_uid` string — Model identifier. Only present when `group_by` includes `model_uid`.
    - `ide` string — IDE name. Only present when `group_by` includes `ide`.
    - `ide_version` string — IDE version. Only present when `group_by` includes `ide_version` (which additionally requires `ide`).
    - `consumption` Consumption, required — Usage metrics for the row. Fields are populated based on the team's billing strategy.
      - `prompt_credits` integer — Prompt credits consumed (credits-based billing only).
      - `flex_credits` integer — Flex credits consumed (credits-based billing only).
      - `billed_acus` number, double — Billed ACUs consumed (ACU-based billing only).
      - `message_count` integer — Number of messages (billing events) in this row. Always populated regardless of billing strategy.
  - `pagination` object, required
    - `next_page_cursor` string, nullable — Opaque cursor for fetching the next page of results. Pass this value as the `page_cursor` query parameter in a follow-up request. `null` when there are no more pages. Page cursors expire after 24 hours.
  - `metadata` object, required
    - `billing_strategy` 'CREDITS' | 'ACU' — The billing strategy for the authenticated team. Determines which fields in `consumption` are populated: - `CREDITS` — `prompt_credits` and `flex_credits` - `ACU` — `billed_acus`
    - `data_freshness` string, date-time — Timestamp indicating when the underlying data was last refreshed (truncated to the hour).
    - `query_time_ms` integer — Server-side query execution time in milliseconds.
    - `team_id` string — The team ID resolved from the authenticated service key.
    - `group_id` string — The group ID the results were scoped to. Only present when `group_id` was supplied.

## Other responses

- `304` — Data has not changed since the ETag provided in `If-None-Match`.
- `400` — Invalid request parameters.
- `401` — Authentication failed or insufficient permissions.
- `403` — The supplied page cursor does not belong to the authenticated team or requested group.
- `405` — HTTP method not allowed (only `GET` is supported).
- `429` — Rate limit exceeded (10 requests per hour per team). Paginating an earlier query does not count against this limit.
- `503` — Analytics service is not available (e.g., in self-hosted deployments).

---

[API](https://skmtc.net/devin/apis/devin-api-v1.md) · [All operations](https://skmtc.net/devin/apis/devin-api-v1/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/devin/devin-api-v1/versions/e3244476af1c/schema)
