Credit usage

Get credit usage

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

get/api/v1/credits/usage

Query parameters

limitinteger

Maximum number of items to return

afterstring

Return items that come after this cursor

beforestring

Return items that come before this cursor

customerIdstring required

Filter by customer ID (required)

resourceIdstring

Filter by resource ID

currencyIdstring

Filter by currency ID

timeRange'LAST_DAY' | 'LAST_WEEK' | 'LAST_MONTH' | 'LAST_YEAR'

Time range for usage data (LAST_DAY, LAST_WEEK, LAST_MONTH, LAST_YEAR). Defaults to LAST_MONTH

startDatestring date-time

Start date for the credit usage time range (ISO 8601). Takes precedence over timeRange when provided

endDatestring date-time

End date for the credit usage time range (ISO 8601). Defaults to now when startDate is provided

groupBystring

Comma-separated list of feature dimension keys to group usage series by (up to 3). Each key matches /^[a-zA-Z0-9_$-]+$/

Headers

X-ACCOUNT-IDstring

Account ID — optional when authenticating with a user JWT (Bearer token); falls back to the user's first membership. Ignored for API-key auth.

X-ENVIRONMENT-IDstring

Environment ID — required when authenticating with a user JWT (Bearer token) on environment-scoped endpoints. Ignored for API-key auth (env is intrinsic to the key).

Response

Credit usage data with time-series points per feature.

Changes

Changed in 10 of the 115 revisions of this API.21010

    • added the required property data/series/items/eventCount to the response with the 200 status

      response-required-property-added

    • added the required property data/series/items/points/items/eventCount to the response with the 200 status

      response-required-property-added

    • added the new ContractNotFound enum value to the code response property for the response status 404

      response-property-enum-value-added

    • added the new CreditOveragePriceCurrencyNotFound enum value to the code response property for the response status 400

      response-property-enum-value-added

    • added the new InvalidCreditOverageBillingModel enum value to the code response property for the response status 400

      response-property-enum-value-added

    • added the new InvoicePreviewNotAvailableForDraftContract enum value to the code response property for the response status 400

      response-property-enum-value-added

    • added the new OveragePriceNotSupportedOnAddon enum value to the code response property for the response status 400

      response-property-enum-value-added

    • added the new OveragePriceRequiresUsageLimit enum value to the code response property for the response status 400

      response-property-enum-value-added

    • added the new GovernanceNotEnabled enum value to the code response property for the response status 403

      response-property-enum-value-added

    • added the new optional header request parameter X-ACCOUNT-ID

      new-optional-request-parameter

    • added the new optional header request parameter X-ENVIRONMENT-ID

      new-optional-request-parameter

    • added the new PricingModelNotSupportedByBillingIntegration enum value to the code response property for the response status 400

      response-property-enum-value-added

    • added the new optional query request parameter after

      new-optional-request-parameter

    • added the new optional query request parameter before

      new-optional-request-parameter

    • added the new optional query request parameter limit

      new-optional-request-parameter

    • added the required property data/pagination to the response with the 200 status

      response-required-property-added

    • added the new DataExportIntegrationError enum value to the code response property for the response status 400

      response-property-enum-value-added

    • added the new InvalidReceivedSignatureError enum value to the code response property for the response status 400

      response-property-enum-value-added

  • 97c0c1bef62122See the full diff
    • the response property data/series/items/featureId became nullable for the status 200

      response-property-became-nullable

    • the response property data/series/items/featureName became nullable for the status 200

      response-property-became-nullable

    • added the new optional query request parameter groupBy

      new-optional-request-parameter

    • added the optional property data/series/items/tags to the response with the 200 status

      response-optional-property-added