Get usage for a subscription
curl --request POST \
--url https://api.cloud.flexprice.io/v1/subscriptions/usage \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"subscription_id": "123",
"end_time": "2024-03-20T00:00:00Z",
"lifetime_usage": false,
"start_time": "2024-03-13T00:00:00Z"
}
'{
"amount": 123,
"charges": [
{
"amount": 123,
"currency": "<string>",
"display_amount": "<string>",
"filter_values": {},
"is_overage": true,
"meter_display_name": "<string>",
"meter_id": "<string>",
"overage_factor": 123,
"price": {
"amount": 123,
"billing_cadence": "RECURRING",
"billing_model": "FLAT_FEE",
"billing_period": "MONTHLY",
"billing_period_count": 123,
"conversion_rate": 123,
"created_at": "<string>",
"created_by": "<string>",
"currency": "<string>",
"description": "<string>",
"display_amount": "<string>",
"display_price_unit_amount": "<string>",
"end_date": "<string>",
"entity_id": "<string>",
"entity_type": "PLAN",
"environment_id": "<string>",
"group_id": "<string>",
"id": "<string>",
"invoice_cadence": "ARREAR",
"lookup_key": "<string>",
"metadata": {},
"meter_id": "<string>",
"parent_price_id": "<string>",
"price_unit": "<string>",
"price_unit_amount": 123,
"price_unit_id": "<string>",
"price_unit_tiers": [
{
"flat_amount": 123,
"unit_amount": 123,
"up_to": 123
}
],
"price_unit_type": "FIAT",
"start_date": "<string>",
"status": "published",
"tenant_id": "<string>",
"tier_mode": "VOLUME",
"tiers": [
{
"flat_amount": 123,
"unit_amount": 123,
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123,
"round": "<string>"
},
"trial_period": 123,
"type": "USAGE",
"updated_at": "<string>",
"updated_by": "<string>"
},
"quantity": 123
}
],
"commitment_amount": 123,
"commitment_utilized": 123,
"currency": "<string>",
"display_amount": "<string>",
"end_time": "<string>",
"has_overage": true,
"overage_amount": 123,
"overage_factor": 123,
"start_time": "<string>"
}Enter your API key in the format x-api-key <api-key>*
Usage request
OK
Show child attributes
Whether this charge is at overage rate
Factor applied to this charge if in overage
Show child attributes
Amount stored in main currency units (e.g., dollars, not cents) For USD: 12.50 means $12.50
RECURRING, ONETIME FLAT_FEE, PACKAGE, TIERED MONTHLY, ANNUAL, WEEKLY, DAILY, QUARTERLY, HALF_YEARLY BillingPeriodCount is the count of the billing period ex 1, 3, 6, 12
ConversionRate is the rate of the price unit to the base currency For BTC: 1 BTC = 100000000 USD
Currency 3 digit ISO currency code in lowercase ex usd, eur, gbp
Description of the price
DisplayAmount is the formatted amount with currency symbol For USD: $12.50
DisplayPriceUnitAmount is the formatted amount with price unit symbol For BTC: 0.00000001 BTC
EndDate is the end date of the price
EntityID holds the value of the "entity_id" field.
PLAN, SUBSCRIPTION, ADDON, PRICE, COSTSHEET EnvironmentID is the environment identifier for the price
GroupID references the group this price belongs to
ID uuid identifier for the price
ARREAR, ADVANCE LookupKey used for looking up the price in the database
MeterID is the id of the meter for usage based pricing
ParentPriceID references the root price (always set for price lineage tracking)
PriceUnit 3 digit ISO currency code in lowercase ex btc For BTC: btc
PriceUnitAmount is the amount stored in price unit For BTC: 0.00000001 means 0.00000001 BTC
PriceUnitID is the id of the price unit
PriceUnitTiers are the tiers for the price unit
Show child attributes
flat_amount is the flat amount for the given tier (optional) Applied on top of unit_amount*quantity. Useful for cases like "2.7$ + 5c"
unit_amount is the amount per unit for the given tier
up_to is the quantity up to which this tier applies. It is null for the last tier. IMPORTANT: Tier boundaries are INCLUSIVE.
FIAT, CUSTOM StartDate is the start date of the price
published, deleted, archived VOLUME, SLAB Show child attributes
flat_amount is the flat amount for the given tier (optional) Applied on top of unit_amount*quantity. Useful for cases like "2.7$ + 5c"
unit_amount is the amount per unit for the given tier
up_to is the quantity up to which this tier applies. It is null for the last tier. IMPORTANT: Tier boundaries are INCLUSIVE.
TrialPeriod is the number of days for the trial period Note: This is only applicable for recurring prices (BILLING_CADENCE_RECURRING)
USAGE, FIXED Amount of commitment used
Whether any usage exceeded commitment
Amount charged at overage rate
curl --request POST \
--url https://api.cloud.flexprice.io/v1/subscriptions/usage \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"subscription_id": "123",
"end_time": "2024-03-20T00:00:00Z",
"lifetime_usage": false,
"start_time": "2024-03-13T00:00:00Z"
}
'{
"amount": 123,
"charges": [
{
"amount": 123,
"currency": "<string>",
"display_amount": "<string>",
"filter_values": {},
"is_overage": true,
"meter_display_name": "<string>",
"meter_id": "<string>",
"overage_factor": 123,
"price": {
"amount": 123,
"billing_cadence": "RECURRING",
"billing_model": "FLAT_FEE",
"billing_period": "MONTHLY",
"billing_period_count": 123,
"conversion_rate": 123,
"created_at": "<string>",
"created_by": "<string>",
"currency": "<string>",
"description": "<string>",
"display_amount": "<string>",
"display_price_unit_amount": "<string>",
"end_date": "<string>",
"entity_id": "<string>",
"entity_type": "PLAN",
"environment_id": "<string>",
"group_id": "<string>",
"id": "<string>",
"invoice_cadence": "ARREAR",
"lookup_key": "<string>",
"metadata": {},
"meter_id": "<string>",
"parent_price_id": "<string>",
"price_unit": "<string>",
"price_unit_amount": 123,
"price_unit_id": "<string>",
"price_unit_tiers": [
{
"flat_amount": 123,
"unit_amount": 123,
"up_to": 123
}
],
"price_unit_type": "FIAT",
"start_date": "<string>",
"status": "published",
"tenant_id": "<string>",
"tier_mode": "VOLUME",
"tiers": [
{
"flat_amount": 123,
"unit_amount": 123,
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123,
"round": "<string>"
},
"trial_period": 123,
"type": "USAGE",
"updated_at": "<string>",
"updated_by": "<string>"
},
"quantity": 123
}
],
"commitment_amount": 123,
"commitment_utilized": 123,
"currency": "<string>",
"display_amount": "<string>",
"end_time": "<string>",
"has_overage": true,
"overage_amount": 123,
"overage_factor": 123,
"start_time": "<string>"
}