Introducing the Chargebee CLI

List credit rates for a subscription

Lists all the credit rates that apply to a subscription. A credit rate applies to a subscription when the subscription has a credit grant for the credit rate's credit unit. If no credit rates apply, an empty list is returned.

Each entry is the rate the subscription uses for a metered feature: its credit rate override when is_overridden is true, otherwise the feature-level credit rate.

Implementation Notes

  • To list only overrides, filter with is_overridden[is] set to true.
  • After an override is removed, the entry shows the feature-level credit rate that applies to the subscription, with is_overridden set to false.

Sample Request

list credit rates in effect for a subscription

Sample Result[JSON]

URL Format

GET https://[site].chargebee.com/api/v2/subscriptions/{subscription-id}/credit_rates

Input Parameters

limit
optional, integer, default=10, min=1, max=100

The number of credit rates to return.

offset
optional, string, max chars=1000

Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set offset to the value of next_offset obtained in the previous iteration of the API call.

sort_by[<sort-order>]
optional, object

optional, string filter

Sorts based on the specified attribute. Supported attributes : effective_from, updated_at

Supported sort-orders : asc, desc

Only one sort order may be specified. Defaults to descending effective_from.

Example → sort_by[desc] = "updated_at"

Filter Params

For operator usages, see the Pagination and Filtering section.
metered_feature_id[<operator>]

optional, string filter

The identifier of the metered feature.

Supported operators : is, in

Example → metered_feature_id[is] = "opus-usage"

Supported operators: is, in
credit_unit_id[<operator>]

optional, string filter

The identifier of the credit unit that usage is converted into.

Supported operators : is

Example → credit_unit_id[is] = "ai-credits"

Supported operators: is
status[<operator>]

optional, enumerated string filter

The status of the credit rate. Possible values are : active, archived. Credit rates are currently always active.

Supported operators : is

Example → status[is] = "active"

Supported operators: is
is_overridden[<operator>]

optional, boolean filter

Filters by whether the entry is an override (true) or the feature-level credit rate (false).

Supported operators : is

Example → is_overridden[is] = "true"

Supported operators: is

Returns

next_offset
optional, string, max chars=1000

This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter offset.

Subscription credit rate object

The credit rate that the subscription uses for one metered feature.