A coupon set contains a bunch of coupon codes that can be redeemed by your customers when they are checking out. It belongs to an existing coupon and will usually be combined with other coupons that share similar promotion or discount offers. Using this resource, you can create, update, retrieve, delete coupon sets and add coupon codes to a coupon set.
Sample coupon set [ JSON ] {
"archived_count": 0,
"coupon_id": "beta",
"id": "cs_3RtyuIHol",
"name": "Launch Promotion",
"object": "coupon_set",
"redeemed_count": 0,
"total_count": 0
}
API Index URL GET https://{site}.chargebee.com/api/v2/coupon_sets
string, max chars=50 Uniquely identifies a coupon_set
string, max chars=100 Coupon id linked to coupon set
string, max chars=50 Name of the coupon set
optional, integer No of coupon codes present in coupon set
optional, integer No of redeemed codes
optional, integer No of archived codes
string, max chars=50 Uniquely identifies a coupon_set
string, max chars=100 Coupon id linked to coupon set
string, max chars=50 Name of the coupon set
optional, integer No of coupon codes present in coupon set
optional, integer No of redeemed codes
optional, integer No of archived codes
Create a coupon set with a coupon code compatible to your product offers and promotional discounts
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Sample Request
curl https://{site}.chargebee.com/api/v2/coupon_sets \
-u {site_api_key}:\
-d coupon_id="beta" \
-d name="Launch Promotion" \
-d id="cs_3RtyuIHol"
Sample Response [ JSON ] Show more...
{
"coupon_set": {
"archived_count": 0,
"coupon_id": "beta",
"id": "cs_3RtyuIHol",
"name": "Launch Promotion",
"object": "coupon_set",
"redeemed_count": 0,
"total_count": 0
}
}
URL Format
POST
https://{site}.chargebee.com/api/v2/coupon_sets
required, string, max chars=100 Coupon id linked to coupon set.
required, string, max chars=50 Name of the coupon set.
required, string, max chars=50 Uniquely identifies a coupon_set.
optional, jsonobject A collection of key-value pairs that provides extra information about the coupon set. Note: There's a character limit of 65,535.
Learn more .
always returned required Resource object representing coupon_set
Sample admin console URL
https://{site}.chargebee.com/admin-console/coupon_sets/123x
This API add coupon codes to an existing coupon set.
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Sample Request
curl https://{site}.chargebee.com/api/v2/coupon_sets/cs_3RtyuLol/add_coupon_codes \
-u {site_api_key}:\
-d code[0]="CBCC789"
Sample Response [ JSON ] Show more...
{
"coupon_set": {
"archived_count": 0,
"coupon_id": "sample_coupon",
"id": "cs_3RtyuLol",
"name": "Weekend Offer",
"object": "coupon_set",
"redeemed_count": 0,
"total_count": 1
}
}
URL Format
POST
https://{site}.chargebee.com/api/v2/coupon_sets/{coupon-set-id}/add_coupon_codes
optional, list of string You can pass up to 100 values per API call. You can also use the Chargebee UI to pass up to 1000 codes per operation. There is no limit on the total number of coupon codes that can be included in a coupon set.
always returned required Resource object representing coupon_set
Sample admin console URL
https://{site}.chargebee.com/admin-console/coupon_sets/123x
Use this API to get the list of all the coupon sets.
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Sample Request
curl https://{site}.chargebee.com/api/v2/coupon_sets \
-G \
-u {site_api_key}:\
--data-urlencode limit=2
Sample Response [ JSON ] Show more...
{
"list": [
{
"coupon_set": {
"archived_count": 0,
"coupon_id": "sample_coupon",
"id": "cs_3RtyuLol",
"name": "Weekend Offer",
"object": "coupon_set",
"redeemed_count": 0,
"total_count": 1
}
},
{..}
],
"next_offset": "[\"154000000001\",\"1517501418000\"]"
}
URL Format
GET
https://{site}.chargebee.com/api/v2/coupon_sets
optional, integer, default=10, min=1, max=100 The number of resources to be returned.
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.
optional, string filter Uniquely identifies a coupon_set. Possible values are : Supported operators : is, is_not, starts_with, in, not_in
Example → id[is] = "bulk-codes-1"
Uniquely identifies a coupon_set. pass parameters as id[<param name>][<operator>]
optional, string, min chars=1 filter Possible values are : Supported operators :
Example →
optional, string, min chars=1 filter Possible values are : Supported operators :
Example →
id[starts_with][operator ] id[starts_with] [operator ] optional, string, min chars=1 filter Possible values are : Supported operators :
Example →
optional, string filter Possible values are : Supported operators :
Example →
optional, string filter Possible values are : Supported operators :
Example →
optional, string filter Name of the coupon set. Possible values are : Supported operators : is, is_not, starts_with, in, not_in
Example → name[is] = "bulk-codes-1"
Name of the coupon set. pass parameters as name[<param name>][<operator>]
optional, string, min chars=1 filter Possible values are : Supported operators :
Example →
optional, string, min chars=1 filter Possible values are : Supported operators :
Example →
name[starts_with][operator ] name[starts_with] [operator ] optional, string, min chars=1 filter Possible values are : Supported operators :
Example →
optional, string filter Possible values are : Supported operators :
Example →
optional, string filter Possible values are : Supported operators :
Example →
optional, string filter Coupon id linked to coupon set. Possible values are : Supported operators : is, is_not, starts_with, in, not_in
Example → coupon_id[is] = "OFF2008"
Coupon id linked to coupon set. pass parameters as coupon_id[<param name>][<operator>]
optional, string, min chars=1 filter Possible values are : Supported operators :
Example →
coupon_id[is_not][operator ] coupon_id[is_not] [operator ] optional, string, min chars=1 filter Possible values are : Supported operators :
Example →
coupon_id[starts_with][operator ] coupon_id[starts_with] [operator ] optional, string, min chars=1 filter Possible values are : Supported operators :
Example →
optional, string filter Possible values are : Supported operators :
Example →
coupon_id[not_in][operator ] coupon_id[not_in] [operator ] optional, string filter Possible values are : Supported operators :
Example →
optional, number filter No of coupon codes present in coupon set. Possible values are : Supported operators : is, is_not, lt, lte, gt, gte, between
Example → total_count[is] = "10"
No of coupon codes present in coupon set. pass parameters as total_count[<param name>][<operator>]
total_count[is][operator ] total_count[is] [operator ] optional, number filter Possible values are : Supported operators :
Example →
total_count[is_not][operator ] total_count[is_not] [operator ] optional, number filter Possible values are : Supported operators :
Example →
total_count[lt][operator ] total_count[lt] [operator ] optional, number filter Possible values are : Supported operators :
Example →
total_count[lte][operator ] total_count[lte] [operator ] optional, number filter Possible values are : Supported operators :
Example →
total_count[gt][operator ] total_count[gt] [operator ] optional, number filter Possible values are : Supported operators :
Example →
total_count[gte][operator ] total_count[gte] [operator ] optional, number filter Possible values are : Supported operators :
Example →
total_count[between][operator ] total_count[between] [operator ] optional, string filter Possible values are : Supported operators :
Example →
redeemed_count[<operator> ] redeemed_count [<operator> ] optional, number filter No of redeemed codes. Possible values are : Supported operators : is, is_not, lt, lte, gt, gte, between
Example → redeemed_count[is] = "5"
No of redeemed codes. pass parameters as redeemed_count[<param name>][<operator>]
redeemed_count[is][operator ] redeemed_count[is] [operator ] optional, number filter Possible values are : Supported operators :
Example →
redeemed_count[is_not][operator ] redeemed_count[is_not] [operator ] optional, number filter Possible values are : Supported operators :
Example →
redeemed_count[lt][operator ] redeemed_count[lt] [operator ] optional, number filter Possible values are : Supported operators :
Example →
redeemed_count[lte][operator ] redeemed_count[lte] [operator ] optional, number filter Possible values are : Supported operators :
Example →
redeemed_count[gt][operator ] redeemed_count[gt] [operator ] optional, number filter Possible values are : Supported operators :
Example →
redeemed_count[gte][operator ] redeemed_count[gte] [operator ] optional, number filter Possible values are : Supported operators :
Example →
redeemed_count[between][operator ] redeemed_count[between] [operator ] optional, string filter Possible values are : Supported operators :
Example →
archived_count[<operator> ] archived_count [<operator> ] optional, number filter No of archived codes. Possible values are : Supported operators : is, is_not, lt, lte, gt, gte, between
Example → archived_count[is] = "2"
No of archived codes. pass parameters as archived_count[<param name>][<operator>]
archived_count[is][operator ] archived_count[is] [operator ] optional, number filter Possible values are : Supported operators :
Example →
archived_count[is_not][operator ] archived_count[is_not] [operator ] optional, number filter Possible values are : Supported operators :
Example →
archived_count[lt][operator ] archived_count[lt] [operator ] optional, number filter Possible values are : Supported operators :
Example →
archived_count[lte][operator ] archived_count[lte] [operator ] optional, number filter Possible values are : Supported operators :
Example →
archived_count[gt][operator ] archived_count[gt] [operator ] optional, number filter Possible values are : Supported operators :
Example →
archived_count[gte][operator ] archived_count[gte] [operator ] optional, number filter Possible values are : Supported operators :
Example →
archived_count[between][operator ] archived_count[between] [operator ] optional, string filter Possible values are : Supported operators :
Example →
always returned required Resource object representing coupon_set
always returned 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`.
Sample admin console URL
https://{site}.chargebee.com/admin-console/coupon_sets/123x
Use this API to retrieve a specific coupon set.
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Sample Request
curl https://{site}.chargebee.com/api/v2/coupon_sets/cs_3RtyuLop \
-u {site_api_key}:
Sample Response [ JSON ] Show more...
{
"coupon_set": {
"archived_count": 0,
"coupon_id": "beta2",
"id": "cs_3RtyuLop",
"name": "Clearance Offer",
"object": "coupon_set",
"redeemed_count": 0,
"total_count": 0
}
}
URL Format
GET
https://{site}.chargebee.com/api/v2/coupon_sets/{coupon-set-id}
always returned required Resource object representing coupon_set
Sample admin console URL
https://{site}.chargebee.com/admin-console/coupon_sets/123x
Use this API to update a specific coupon set by updating its name
and the meta_data
.
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Sample Request
curl https://{site}.chargebee.com/api/v2/coupon_sets/cs_3Rtyuqop/update \
-u {site_api_key}:\
-d name="Promotional Offer"
Sample Response [ JSON ] Show more...
{
"coupon_set": {
"archived_count": 0,
"coupon_id": "beta3",
"id": "cs_3Rtyuqop",
"name": "Promotional Offer",
"object": "coupon_set",
"redeemed_count": 0,
"total_count": 0
}
}
URL Format
POST
https://{site}.chargebee.com/api/v2/coupon_sets/{coupon-set-id}/update
optional, string, max chars=50 Name of the coupon set.
optional, jsonobject A collection of key-value pairs that provides extra information about the coupon set. Note: There's a character limit of 65,535.
Learn more .
always returned required Resource object representing coupon_set
Sample admin console URL
https://{site}.chargebee.com/admin-console/coupon_sets/123x
Use this endpoint to delete a specific coupon set
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Sample Request
curl https://{site}.chargebee.com/api/v2/coupon_sets/cs_3Rtyupop/delete \
-X POST \
-u {site_api_key}:
Sample Response [ JSON ] Show more...
{
"coupon_set": {
"archived_count": 0,
"coupon_id": "beta4",
"id": "cs_3Rtyupop",
"name": "Launch Offer",
"object": "coupon_set",
"redeemed_count": 0,
"total_count": 0
}
}
URL Format
POST
https://{site}.chargebee.com/api/v2/coupon_sets/{coupon-set-id}/delete
always returned required Resource object representing coupon_set
Sample admin console URL
https://{site}.chargebee.com/admin-console/coupon_sets/123x
Use this API to delete all the unutilised coupon codes from a specific coupon set.
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Sample Request
curl https://{site}.chargebee.com/api/v2/coupon_sets/cs_3RtyuSuN/delete_unused_coupon_codes \
-X POST \
-u {site_api_key}:
Sample Response [ JSON ] Show more...
{
"coupon_set": {
"archived_count": 0,
"coupon_id": "beta5",
"id": "cs_3RtyuSuN",
"name": "Welcome Offer",
"object": "coupon_set",
"redeemed_count": 0,
"total_count": 0
}
}
URL Format
POST
https://{site}.chargebee.com/api/v2/coupon_sets/{coupon-set-id}/delete_unused_coupon_codes
always returned required Resource object representing coupon_set
Sample admin console URL
https://{site}.chargebee.com/admin-console/coupon_sets/123x