The customer_entitlement resource can be viewed as a subset of the subscription_entitlement resource enhanced with the customer's ID. It is introduced to help retrieve all subscription entitlements for a specific customer.
{
"customer_entitlement": {
"customer_id": "cus01",
"subscription_id": "sub123",
"feature_id": "licenses",
"value": "60",
"name": "60 licenses",
"is_enabled": true,
"object": "customer_entitlement"
}
}The display name for the entitlement level. The value is automatically generated based on feature.type:
feature.type is range or quantity: the name is the space-separated concatenation of value and the pluralized form of feature.unit. For example, if value is 20 and feature.unit is user, then name becomes 20 users.feature.type is custom, the name is the same as value.feature.type is switch: name is set to Available when value is true; it's set to Not Available when value is false.true, indicates that the subscription_entitlement is enabled. Disabled by default
This endpoint is disabled by default. To enable it, contact Chargebee Support.
Tip
To retrieve subscription entitlements for a specific subscription, use the List subscription entitlements API.
Returns a list of customer_entitlement objects for the specified customer. The entitlements returned are for active subscriptions only. Specifically, these are subscriptions with a status of active or non_renewing.
Pagination works differently for this endpoint than other List endpoints in the Billing API. In other list endpoints, the limit parameter sets the limit on the total number of objects returned in the response. However, in this endpoint, the limit parameter defines the number of features for which the customer_entitlement objects are returned. For example, if limit = n, then all customer_entitlement objects for up to n features are returned.
Let's look at an example:
Consider the following three features defined in Chargebee for a project management software:
The feature objects are listed below:
{
"feature": {
"id": "user-licenses",
"name": "User Licenses",
"description": "Maximum number of user licenses allowed.",
"status": "active",
"type": "quantity",
"unit": "licence",
"levels": [
{
"name": "3 licences",
"value": "3",
"is_unlimited": false,
"level": 1
},
{
"name": "10 licences",
"value": "10",
"is_unlimited": false,
"level": 2
},
{
"name": "25 licences",
"value": "25",
"is_unlimited": false,
"level": 3
},
{
"name": "Unlimited licence",
"value": "Unlimited",
"is_unlimited": true,
"level": 4
}
],
"object": "feature"
}
}
{
"feature": {
"id": "support-level",
"name": "Support Level",
"description": "Level of support offered.",
"status": "active",
"type": "custom",
"levels": [
{
"name": "Email",
"value": "Email",
"is_unlimited": false,
"level": 1
},
{
"name": "Chat",
"value": "Chat",
"is_unlimited": false,
"level": 2
},
{
"name": "Calls",
"value": "Calls",
"is_unlimited": false,
"level": 3
}
],
"object": "feature"
}
}
{
"feature": {
"id": "xero-integration",
"name": "Xero Integration",
"description": "Integrate your Chargebee site with Xero",
"status": "active",
"type": "switch",
"object": "feature"
}
}
Now consider that a customer c1 has two subscriptions: s1 and s2.
Consider the following subscription entitlements for s1 and s2:
| Subscription id | Feature Name | Entitlement Value |
|---|---|---|
s1 | User Licenses | 3 |
s1 | Support Level | Email |
s2 | User Licenses | 10 |
s2 | Support Level | Chat |
s2 | Xero Integration | true |
API calls to this endpoint work as follows:
Consider the first call with limit set to 2.
GET /api/v2/customers/c1/customer_entitlements?limit=2
{
"list": [
{
"customer_entitlement": {
"customer_id": "c1",
"subscription_id": "s1",
"feature_id": "user-licenses",
"value": "3",
"name": "3 licences",
"is_enabled": true,
"object": "customer_entitlement"
}
},
{
"customer_entitlement": {
"customer_id": "c1",
"subscription_id": "s2",
"feature_id": "xero-integration",
"value": "true",
"name": "Available",
"is_enabled": true,
"object": "customer_entitlement"
}
},
{
"customer_entitlement": {
"customer_id": "c1",
"subscription_id": "s2",
"feature_id": "user-licenses",
"value": "10",
"name": "10 licences",
"is_enabled": true,
"object": "customer_entitlement"
}
}
],
"next_offset": "2"
}
Since limit = 2, the API returns the customer_entitlement for two features: User Licenses and Xero Integration. Three objects are returned, corresponding to rows 1, 3, and 5 in the table above.
We now retrieve the next page of the list in the second call by setting offset to the value of next_offset obtained from the previous response.
GET /api/v2/customers/c1/customer_entitlements?limit=2&offset=2
{
"list": [
{
"customer_entitlement": {
"customer_id": "c1",
"subscription_id": "s1",
"feature_id": "support-level",
"value": "Email",
"name": "Email",
"is_enabled": true,
"object": "customer_entitlement"
}
},
{
"customer_entitlement": {
"customer_id": "c1",
"subscription_id": "s2",
"feature_id": "support-level",
"value": "Chat",
"name": "Chat",
"is_enabled": true,
"object": "customer_entitlement"
}
}
]
}
Although limit = 2, the customer_entitlement objects for only one more feature, namely, Support Level are returned because the remaining were covered in the previous page. No more customer_entitlement objects remain for the customer, as indicated by the absence of the next_offset attribute in the response. The returned objects in this last call correspond to rows 2 and 4 in the table above.
true, the response returns a unified view of entitlement values for each feature across the customer. This includes entitlements assigned directly to the customer as well as those inherited from any of the customer's subscriptions. In this mode, the subscription_id field is omitted from the response objects. The consolidated entitlement value is derived using the same logic described in the Subscription Entitlements documentation, based on the feature type.