---
title: "Get credit usage"
method: GET
path: "/api/v1/credits/usage"
tags: ["Credit usage"]
---

# Get credit usage

`GET /api/v1/credits/usage`

Retrieves credit usage time-series data for a customer, grouped by feature, over a specified time range.

## Query parameters

- `limit` integer
- `after` string
- `before` string
- `customerId` string, required
- `resourceId` string
- `currencyId` string
- `timeRange` 'LAST_DAY' | 'LAST_WEEK' | 'LAST_MONTH' | 'LAST_YEAR'
- `startDate` string, date-time
- `endDate` string, date-time
- `groupBy` string

## Headers

- `X-ACCOUNT-ID` string
- `X-ENVIRONMENT-ID` string

## Response `200`

Credit usage data with time-series points per feature.

- CreditUsageResponseDto — Response object
  - `data` object, required — Credit usage data grouped by feature with time-series points
    - `series` object[], required — Credit usage series grouped by feature
      - `featureId` string, nullable, required — The feature ID; null when grouping by dimensions only
      - `featureName` string, nullable, required — The display name of the feature; null when grouping by dimensions only
      - `totalCredits` number, required — Total credits consumed by this feature in the time range
      - `eventCount` number, required — Number of distinct usage events that consumed credits in this series. This count is not additive across series, because an event matched by several meters appears in more than one series.
      - `points` object[], required — Time-series data points for this feature
        - `timestamp` string, date-time, required — The timestamp of the data point
        - `value` number, required — The credit usage value at this point
        - `eventCount` number, required — Number of distinct usage events that consumed credits in this time bucket
      - `tags` object[] — Dimension key/value pairs identifying this series when groupBy is applied
        - `key` string, required — The dimension key
        - `value` string, required — The dimension value for this series
    - `currency` object, nullable, required — The custom currency used for credit measurement
      - `currencyId` string, required — The currency identifier
      - `displayName` string, required — The display name of the currency
      - `symbol` string, nullable, required — The currency symbol
      - `singular` string, nullable, required — Singular unit label
      - `plural` string, nullable, required — Plural unit label
    - `pagination` object, required — Cursor-based pagination for the returned series. `next`/`prev` are opaque cursors; pass them back as `after`/`before` to traverse pages. The series axis is `groupBy` when provided, otherwise `featureId`
      - `next` string, nullable, required — Cursor for fetching the next page of results, or null if no additional pages exist
      - `prev` string, nullable, required — Cursor for fetching the previous page of results, or null if at the beginning

## Other responses

- `400` — bad request.
- `401` — User is not authenticated.
- `403` — User is not allowed to access this resource.
- `404` — CreditUsage not found.
- `429` — Too many requests.

---

[API](https://skmtc.net/stiggio/apis/stigg-api.md) · [All operations](https://skmtc.net/stiggio/apis/stigg-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/stiggio/stigg-api/revisions/3e2c8cfcd035/schema)
