Subscriptions are created in Chargebee using items. Items represent the products or services that you offer to your customers. Items often differ in the number of product features that are available to them. The Features API helps you define the various features offered as part of your product line. It also defines the entitlements that items and subscriptions can have towards said features.
Note
The maximum number of features a site can have is 400.
The Features API enables you to:
{
"feature": {
"description": "Integration of Chargebee with Quickbooks",
"id": "fea-4c163c85-f873-46d4-a268-5a80ddf40971",
"levels": [],
"name": "Quickbooks Integration_123",
"object": "feature",
"status": "draft",
"type": "switch"
}
}
user license
, data storage
, Salesforce Integration
, devices
, UHD Streaming
, and so on. draft
or an archived
feature can be changed to active
. Any entitlements or subscription entitlements defined for the feature take effect immediately.archivedAn active
feature can be changed to archived
. Once archived
, no new entitlements or subscription entitlements can be created for the feature. However, any pre-existing item or subscription entitlements from the time that the feature was active
, remain effective.draftThe feature is in an unpublished state. Entitlements and subscription entitlements can be created for a draft feature but they are not effective until the feature is active. A feature status
cannot be changed back to draft
once it is in active
or archived
status
.Email Support
can have entitlement levels as 24×7
and 24×5
.quantityThe feature is quantity-based and entitlement levels available for it are a set of predefined number of quantity units. For example, a feature with name
such as number of users
can have entitlement levels of say, 5
, 20
, 50
, and 100
. levels[is_unlimited]
is used for specifying the “unlimited” entitlement level.rangeThe feature is quantity-based and the entitlement levels available for it are the set of whole numbers within a range. The range is defined by a minimum and a maximum value. For example, a feature such as number of users
can have entitlement levels starting at 5
users and go up to 50000
. levels[is_unlimited]
is used for specifying the “unlimited” entitlement level.type
quantity
or range
, this specifies the unit of measure. The value is expected in the singular form and when used by the system, it is pluralized automatically as needed. For example, for a feature such as user licenses
, the unit
can be license
. type
is other than switch
.type
of the feature is switch
, this is not applicable. This is because any given entity can be either fully entitled to a switch
feature or not entitled at all; there are no intermediate entitlement levels.curl https://{site}.chargebee.com/api/v2/features \ -G \ -u {site_api_key}:\ --data-urlencode limit=2
curl https://{site}.chargebee.com/api/v2/features \ -G \ -u {site_api_key}:\ --data-urlencode limit=2
user license
, data storage
, Salesforce Integration
, devices
, UHD Streaming
, and so on. number-of-users-ccjht01
. When not provided, a random value is automatically set. curl https://{site}.chargebee.com/api/v2/features \ -u {site_api_key}:\ -d name="Quickbooks Integration_123" \ -d type="SWITCH" \ -d description="Integration of Chargebee with Quickbooks"
curl https://{site}.chargebee.com/api/v2/features \ -u {site_api_key}:\ -d name="Phone Support" \ -d type="CUSTOM" \ -d "levels[level][0]"=0 \ -d "levels[value][0]"="24 * 5" \ -d "levels[name][0]"="24 * 5" \ -d "levels[level][1]"=1 \ -d "levels[value][1]"="24 * 7" \ -d "levels[name][1]"="24 * 7"
curl https://{site}.chargebee.com/api/v2/features \ -u {site_api_key}:\ -d name="User Licenses" \ -d type="QUANTITY" \ -d description="Maximum user licenses allowed" \ -d "levels[level][0]"=0 \ -d "levels[value][0]"="5" \ -d "levels[name][0]"="5 Users" \ -d "levels[level][1]"=1 \ -d "levels[value][1]"="10" \ -d "levels[name][1]"="10 Users" \ -d "levels[level][2]"=2 \ -d "levels[value][2]"="Unlimited" \ -d "levels[name][2]"="Unlimited Users" \ -d "levels[is_unlimited][2]"=true
curl https://{site}.chargebee.com/api/v2/features \ -u {site_api_key}:\ -d name="API call limit" \ -d type="RANGE" \ -d description="API call limit" \ -d "levels[level][0]"=0 \ -d "levels[value][0]"="5" \ -d "levels[name][0]"="5 calls/month" \ -d "levels[level][1]"=1 \ -d "levels[value][1]"="100" \ -d "levels[name][1]"="100 calls/month"
user license
, data storage
, Salesforce Integration
, devices
, UHD Streaming
, and so on. Email Support
can have entitlement levels as 24×7
and 24×5
.quantityThe feature is quantity-based and entitlement levels available for it are a set of predefined number of quantity units. For example, a feature with name
such as number of users
can have entitlement levels of say, 5
, 20
, 50
, and 100
. levels[is_unlimited]
is used for specifying the “unlimited” entitlement level.rangeThe feature is quantity-based and the entitlement levels available for it are the set of whole numbers within a range. The range is defined by a minimum and a maximum value. For example, a feature such as number of users
can have entitlement levels starting at 5
users and go up to 50000
. levels[is_unlimited]
is used for specifying the “unlimited” entitlement level.draft
or an archived
feature can be changed to active
. Any entitlements or subscription entitlements defined for the feature take effect immediately.draftThe feature is in an unpublished state. Entitlements and subscription entitlements can be created for a draft feature but they are not effective until the feature is active. A feature status
cannot be changed back to draft
once it is in active
or archived
status
.type
quantity
or range
, this specifies the unit of measure. The value is expected in the singular form and when used by the system, it is pluralized automatically as needed. For example, for a feature such as user licenses
, the unit
can be license
. Email Support
can have entitlement levels named as All weekdays
, All days
, 40 hours per week
and so on.
When not provided for feature.type
quantity
or range
, this name is auto-generated as the space-separated concatenation of levels[].value
and the pluralized version of unit
. For example, if levels[].value
is 20
and unit
is user
, then levels[].name
becomes 20 users
. type
is quantity
: this attribute denotes the quantity of units of the feature for this entitlement level. For example, a feature such as number of users
can have levels[].value
as 5
, 20
, 50
, and 100
. levels[].is_unlimited
is used to set the entitlement level to “unlimited”.type
is range
: there can be be only two elements in the levels[]
array; one corresponding to the minimum value (levels[0]
) and the other to the maximum value (levels[1]
) of the range of possible entitlement levels. For example, a feature such as number of users
may have levels[0].value
= 5
and levels[1].value
= 50000
. When the upper limit is “unlimited”, then levels[1].value
is not set and levels[1].is_unlimited
is true
.type
is custom
: this attribute denotes the value of this custom entitlement level. For example, a feature Email Support
can have levels[].value
as one of say, 24×7
and 24×5
.When type
is quantity
or range
, this attribute indicates whether the entitlement level corresponds to unlimited units of the feature. Possible values are:
true
: The entitlement level corresponds to unlimited units of the feature. levels[].value
is ignored for this level. This can only be set for the level that has the highest value for levels[].level.
false
: The entitlement level does not correspond to unlimited units of the feature.Either this or levels[value] should be passed.
Represents the order of the entitlement levels from lowest to highest.
type
is quantity
or custom
: Provide the level
for the lowest entitlement level as 0
, the next higher level as 1
, followed by 2
, and so on.type
is range
: Provide 0
for the minimum value and 1
for the maximum value in the range.When not defined, it is assumed as the index of the levels[]
array.
Updates a specific feature.
Note
The list of objects levels[]
provided as part of this operation fully replaces the existing
list of objects levels[]
of the feature.
levels
This section describes validations that are performed by Chargebee when modifying the levels
list of
objects for the feature, using this operation.
levels
Adding a new object to the levels[]
list is allowed if and only if the feature type
is quantity
or custom
levels
Removing an existing object in the levels[]
list is not allowed if the value
for that
object is currently mapped to one or more item_entitlement
s or
subscription_entitlement
s.
levels
Note
The validation described in this section is only applicable for features of type
custom
If any of levels[].value
are currently mapped to item_entitlement
s or subscription_entitlement
s,
then the relative order of the corresponding levels[].level
must be preserved when invoking this
operation.
For example, consider that the levels[]
list is currently in the state shown below. (For brevity,
only the value
and level
key are shown here and the JSONs have been compacted.)
{
"levels":[{
"value":"email-basic",
"level":0
},{
"value":"email-rise",
"level":1
},{
"value":"email-advanced",
"level":2
},{
"value":"email-pro",
"level":3
},{
"value":"email-scale",
"level":4
}]
}
Now consider that email-rise
, email-advanced
, and email-pro
have already
been mapped to item_entitlement
s or subscription_entitlement
s. As seen in the above
object, the relative order of levels[].level
is such that email-rise
< email-advanced
< email-pro
.
Invoking this API to change levels[]
to the state below is allowed since the relative order of
level
corresponding to email-rise
, email-advanced
, and
email-pro
has been preserved.
{
"levels":[{
"value":"email-basic",
"level":0
},{
"value":"email-rise",
"level":1
},{
"value":"email-scale",
"level":2
},{
"value":"email-advanced",
"level":3
},{
"value":"email-pro",
"level":4
}]
}
However, changing levels[]
to the state shown below is not permissible because the
level
of email-advanced
is provided as greater than the level
of email-pro
,
thereby disrupting the original order.
{
"levels":[{
"value":"email-basic",
"level":0
},{
"value":"email-rise",
"level":1
},{
"value":"email-pro",
"level":2
},{
"value":"email-advanced",
"level":3
},{
"value":"email-scale",
"level":4
}]
}
curl https://{site}.chargebee.com/api/v2/features/fea-a5d1f7de-c58c-45da-a08b-6934e3ab3ede \ -u {site_api_key}:\ -d name="User Licenses (updated name)" \ -d description="Maximum number of user licenses allowed" \ -d "levels[level][0]"=0 \ -d "levels[value][0]"="25" \ -d "levels[name][0]"="25 Users" \ -d "levels[level][1]"=1 \ -d "levels[value][1]"="100" \ -d "levels[name][1]"="100 Users" \ -d "levels[level][2]"=2 \ -d "levels[value][2]"="Unlimited" \ -d "levels[name][2]"="Unlimited Users" \ -d "levels[is_unlimited][2]"=true
curl https://{site}.chargebee.com/api/v2/features/fea-a5d1f7de-c58c-45da-a08b-6934e3ab3ede \ -u {site_api_key}:\ -d name="User Licenses (updated name)" \ -d description="Maximum number of user licenses allowed" \ -d "levels[level][0]"=0 \ -d "levels[value][0]"="25" \ -d "levels[name][0]"="25 Users" \ -d "levels[level][1]"=1 \ -d "levels[value][1]"="100" \ -d "levels[name][1]"="100 Users" \ -d "levels[level][2]"=2 \ -d "levels[value][2]"="Unlimited" \ -d "levels[name][2]"="Unlimited Users" \ -d "levels[is_unlimited][2]"=true
user license
, data storage
, Salesforce Integration
, devices
, UHD Streaming
, and so on. draft
or an archived
feature can be changed to active
. Any entitlements or subscription entitlements defined for the feature take effect immediately.archivedAn active
feature can be changed to archived
. Once archived
, no new entitlements or subscription entitlements can be created for the feature. However, any pre-existing item or subscription entitlements from the time that the feature was active
, remain effective.draftThe feature is in an unpublished state. Entitlements and subscription entitlements can be created for a draft feature but they are not effective until the feature is active. A feature status
cannot be changed back to draft
once it is in active
or archived
status
.type
quantity
or range
, this specifies the unit of measure. The value is expected in the singular form and when used by the system, it is pluralized automatically as needed. For example, for a feature such as user licenses
, the unit
can be license
. Email Support
can have entitlement levels named as All weekdays
, All days
, 40 hours per week
and so on.
When not provided for feature.type
quantity
or range
, this name is auto-generated as the space-separated concatenation of levels[].value
and the pluralized version of unit
. For example, if levels[].value
is 20
and unit
is user
, then levels[].name
becomes 20 users
. The value denoting the entitlement level granted.
type
is quantity
: this attribute denotes the quantity of units of the feature for this entitlement level. For example, a feature such as number of users
can have levels[].value
as 5
, 20
, 50
, and 100
. levels[].is_unlimited
is used to set the entitlement level to “unlimited”.type
is range
: there can be only two elements in the levels[]
array; one corresponding to the minimum value (levels[0]
) and the other to the maximum value (levels[1]
) of the range of possible entitlement levels. For example, a feature such as number of users
may have levels[0].value
= 5
and levels[1].value
= 50000
. When the upper limit is “unlimited”, then levels[1].value
is not set and levels[1].is_unlimited
is true
.type
is custom
: this attribute denotes the value of this custom entitlement level. For example, a feature Email Support
can have levels[].value
as one of say, 24×7
and 24×5
.Note
This must be provided exactly as it already exists for the feature if the value
is currently mapped to an entitlement
s or subscription_entitlement
s.
When type
is quantity
or range
, this attribute indicates whether the entitlement level corresponds to unlimited units of the feature. Possible values are:
true
: The entitlement level corresponds to unlimited units of the feature. levels[].value
is ignored for this level. This can only be set for the level that has the highest value for levels[].level.
false
: The entitlement level does not correspond to unlimited units of the feature.Either this or levels[value] should be passed.
Represents the order of the entitlement levels from lowest to highest.
type
is quantity
: Provide the level
for the lowest entitlement level as 0
, the next higher level as 1
, followed by 2
, and so on.type
is custom
: Provide the level
for the lowest entitlement level as 0
, the next higher level as 1
, followed by 2
, and so on. Note: There are some validations to be considered.type
is range
: Provide 0
for the minimum value and 1
for the maximum value in the range.When not defined, it is assumed as the index of the levels[]
array.
curl https://{site}.chargebee.com/api/v2/features/fea-user-licenes \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/features/fea-user-licenes \ -u {site_api_key}:
status
of the feature is active
.curl https://{site}.chargebee.com/api/v2/features/fea-d49b2371-572b-439d-993d-04b8135194c3/delete \ -X POST \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/features/fea-d49b2371-572b-439d-993d-04b8135194c3/delete \ -X POST \ -u {site_api_key}:
draft
feature so that any entitlements or subscription entitlements defined towards it take effect immediately. This operation changes the status
of the feature to active
. The feature status
must be draft
when calling this endpoint.curl https://{site}.chargebee.com/api/v2/features/fea-8f2fb6c8-d582-435a-9d92-b3e04ec7f40e/activate_command \ -X POST \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/features/fea-8f2fb6c8-d582-435a-9d92-b3e04ec7f40e/activate_command \ -X POST \ -u {site_api_key}:
active
feature so that no new entitlements or subscription entitlements can be created towards the feature. Any pre-existing item or subscription entitlements from the time that the feature was active
remain effective. This operation changes the status
of the feature to archived
. The feature status
must be active
when calling this endpoint.curl https://{site}.chargebee.com/api/v2/features/fea-c3c68438-9f26-4a88-b2cb-88428a8d85f5/archive_command \ -X POST \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/features/fea-c3c68438-9f26-4a88-b2cb-88428a8d85f5/archive_command \ -X POST \ -u {site_api_key}:
status
of the feature to active
. The feature status
must be archived
when calling this endpoint.curl https://{site}.chargebee.com/api/v2/features/fea-a2dbb732-c54d-4a96-aaa3-b8c0b362e578/reactivate_command \ -X POST \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/features/fea-a2dbb732-c54d-4a96-aaa3-b8c0b362e578/reactivate_command \ -X POST \ -u {site_api_key}: