customer
get usage
Get usage for a customer
GET
/
v1
/
customer
/
{customerId}
/
getUsage
Copy
curl --request GET \
--url https://api.unprice.dev/v1/customer/{customerId}/getUsage \
--header 'Authorization: Bearer <token>'
Copy
{
"planVersion": {
"description": "<string>",
"flatPrice": "<string>",
"currentTotalPrice": "<string>",
"billingConfig": {
"name": "<string>",
"billingInterval": "month",
"billingIntervalCount": 6,
"billingAnchor": 16,
"planType": "recurring"
}
},
"subscription": {
"planSlug": "<string>",
"status": "idle",
"currentCycleEndAt": 123,
"timezone": "<string>",
"currentCycleStartAt": 123,
"prorationFactor": 123,
"prorated": true
},
"phase": {
"trialEndsAt": 123,
"endAt": 123,
"trialDays": 123,
"isTrial": true
},
"entitlement": [
{
"featureSlug": "<string>",
"featureType": "flat",
"isCustom": true,
"limit": 123,
"usage": 123,
"freeUnits": 123,
"max": 123,
"units": 123,
"included": 123,
"featureVersion": {
"id": "<string>",
"projectId": "<string>",
"createdAtM": 123,
"updatedAtM": 123,
"planVersionId": "<string>",
"featureId": "<string>",
"featureType": "flat",
"config": {
"tiers": [
{
"unitPrice": {
"dinero": {
"amount": 123,
"currency": {
"code": "<string>",
"base": 123,
"exponent": 123
},
"scale": 123
},
"displayAmount": "<string>"
},
"flatPrice": {
"dinero": {
"amount": 123,
"currency": {
"code": "<string>",
"base": 123,
"exponent": 123
},
"scale": 123
},
"displayAmount": "<string>"
},
"firstUnit": 2,
"lastUnit": 2
}
],
"price": {
"dinero": {
"amount": 123,
"currency": {
"code": "<string>",
"base": 123,
"exponent": 123
},
"scale": 123
},
"displayAmount": "<string>"
},
"usageMode": "tier",
"tierMode": "volume",
"units": 2
},
"metadata": {
"stripeProductId": "<string>",
"realtime": true
},
"aggregationMethod": "sum",
"order": 123,
"defaultQuantity": 1,
"limit": 123,
"hidden": true,
"feature": {
"id": "<string>",
"projectId": "<string>",
"createdAtM": 123,
"updatedAtM": 123,
"slug": "<string>",
"code": 123,
"title": "<string>",
"description": "<string>"
}
},
"price": "<string>"
}
]
}
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Path Parameters
The customer ID
Example:
"cus_1H7KQFLr7RepUyQBKdnvY"
Response
200
application/json
The result of the get usage
The response is of type object
.
Copy
curl --request GET \
--url https://api.unprice.dev/v1/customer/{customerId}/getUsage \
--header 'Authorization: Bearer <token>'
Copy
{
"planVersion": {
"description": "<string>",
"flatPrice": "<string>",
"currentTotalPrice": "<string>",
"billingConfig": {
"name": "<string>",
"billingInterval": "month",
"billingIntervalCount": 6,
"billingAnchor": 16,
"planType": "recurring"
}
},
"subscription": {
"planSlug": "<string>",
"status": "idle",
"currentCycleEndAt": 123,
"timezone": "<string>",
"currentCycleStartAt": 123,
"prorationFactor": 123,
"prorated": true
},
"phase": {
"trialEndsAt": 123,
"endAt": 123,
"trialDays": 123,
"isTrial": true
},
"entitlement": [
{
"featureSlug": "<string>",
"featureType": "flat",
"isCustom": true,
"limit": 123,
"usage": 123,
"freeUnits": 123,
"max": 123,
"units": 123,
"included": 123,
"featureVersion": {
"id": "<string>",
"projectId": "<string>",
"createdAtM": 123,
"updatedAtM": 123,
"planVersionId": "<string>",
"featureId": "<string>",
"featureType": "flat",
"config": {
"tiers": [
{
"unitPrice": {
"dinero": {
"amount": 123,
"currency": {
"code": "<string>",
"base": 123,
"exponent": 123
},
"scale": 123
},
"displayAmount": "<string>"
},
"flatPrice": {
"dinero": {
"amount": 123,
"currency": {
"code": "<string>",
"base": 123,
"exponent": 123
},
"scale": 123
},
"displayAmount": "<string>"
},
"firstUnit": 2,
"lastUnit": 2
}
],
"price": {
"dinero": {
"amount": 123,
"currency": {
"code": "<string>",
"base": 123,
"exponent": 123
},
"scale": 123
},
"displayAmount": "<string>"
},
"usageMode": "tier",
"tierMode": "volume",
"units": 2
},
"metadata": {
"stripeProductId": "<string>",
"realtime": true
},
"aggregationMethod": "sum",
"order": 123,
"defaultQuantity": 1,
"limit": 123,
"hidden": true,
"feature": {
"id": "<string>",
"projectId": "<string>",
"createdAtM": 123,
"updatedAtM": 123,
"slug": "<string>",
"code": 123,
"title": "<string>",
"description": "<string>"
}
},
"price": "<string>"
}
]
}
Assistant
Responses are generated using AI and may contain mistakes.