For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Dev Portal
DocsAPI ReferenceLearnCommunityChangelog
DocsAPI ReferenceLearnCommunityChangelog
    • About Our APIs
  • REST
    • Overview
      • Overview
        • Abandoned Cart Emails
        • Custom Template Associations
        • Email Templates
        • Pages
        • Marketing
              • GETList Coupons
              • POSTCreate Coupon
              • DELDelete All Coupons
              • GETGet Count of Coupons
              • PUTUpdate Coupon
              • DELDelete Coupon
        • Store Content
        • Themes
        • Widgets
        • Page Widgets
      • Payments
  • GraphQL
    • Overview
  • MCP
    • Overview
Dev Portal
LogoLogo
RESTAdminContentMarketingCoupons

Create Coupon

POST
https://api.bigcommerce.com/stores/:store_hash/v2/coupons
POST
/stores/:store_hash/v2/coupons
$curl -X POST https://api.bigcommerce.com/stores/store_hash/v2/coupons \
> -H "Accept: application/json" \
> -H "X-Auth-Token: <apiKey>" \
> -H "Content-Type: application/json" \
> -d '{
> "name": "Spring Sale 2024",
> "type": "percentage_discount",
> "amount": "15",
> "code": "SPRING15OFF",
> "applies_to": {
> "ids": [
> 12,
> 45
> ],
> "entity": "products"
> },
> "min_purchase": "50",
> "expires": "Fri, 30 Jun 2024 23:59:59 +0000",
> "enabled": true,
> "max_uses": 100,
> "max_uses_per_customer": 2,
> "restricted_to": {
> "countries": "US"
> },
> "shipping_methods": [
> "standard_shipping",
> "express_shipping"
> ],
> "id": 102,
> "num_uses": 0,
> "date_created": "Mon, 01 Apr 2024 10:00:00 +0000"
>}'
201Response
1{
2 "amount": "15.0000",
3 "applies_to": {
4 "ids": [
5 12,
6 45
7 ],
8 "entity": "products"
9 },
10 "code": "SPRING15OFF",
11 "id": 102,
12 "name": "Spring Sale 2024",
13 "type": "percentage_discount",
14 "date_created": "Mon, 01 Apr 2024 10:00:00 +0000",
15 "enabled": true,
16 "expires": "Fri, 30 Jun 2024 23:59:59 +0000",
17 "max_uses": 100,
18 "max_uses_per_customer": 2,
19 "min_purchase": "50.0000",
20 "num_uses": 0,
21 "restricted_to": {
22 "countries": "US"
23 },
24 "shipping_methods": [
25 "standard_shipping",
26 "express_shipping"
27 ]
28}
Creates a *Coupon*. **Required Fields** * `name` * `code` * `type` * `amount` * `applies_to` **Read Only Fields** * `id` * `num_uses` **Notes** The coupon type can be one of the following: * `per_item_discount` * `per_total_discount` * `shipping_discount` * `free_shipping` * `percentage_discount` Legacy coupon codes only work with the store's default currency. Applying a coupon with any other currency other than the store's default will result in the error: "Coupons only apply to default currency."
Was this page helpful?
Previous

List Coupons

Next

Delete All Coupons

Built with

Creates a Coupon.

Required Fields

  • name
  • code
  • type
  • amount
  • applies_to

Read Only Fields

  • id
  • num_uses

Notes

The coupon type can be one of the following:

  • per_item_discount
  • per_total_discount
  • shipping_discount
  • free_shipping
  • percentage_discount

Legacy coupon codes only work with the store’s default currency. Applying a coupon with any other currency other than the store’s default will result in the error: “Coupons only apply to default currency.”

Authentication

X-Auth-Tokenstring
### OAuth scopes | UI Name | Permission | Parameter | |:--------|:-----------|:----------| | Marketing | modify | `store_v2_marketing` | | Marketing | read-only | `store_v2_marketing_read_only` | ### Authentication header | Header | Argument | Description | |:-------|:---------|:------------| | `X-Auth-Token` | `access_token` | For more about API accounts that generate `access_token`s, see our [Guide to API Accounts](/developer/docs/overview/api-fundamentals/api-accounts#api-accounts). | ### Further reading For example requests and more information about authenticating BigCommerce APIs, see [Authentication and Example Requests](/developer/docs/overview/api-fundamentals/api-accounts#x-auth-token-header-example-requests). For more about BigCommerce OAuth scopes, see our [Guide to API Accounts](/developer/docs/overview/api-fundamentals/api-accounts#oauth-scopes). For a list of API status codes, see [API Status Codes](/developer/api-reference/rest/overview#rest-http-status-codes).

Path parameters

store_hashstringRequired
Permanent ID of the BigCommerce store.

Headers

AcceptstringRequiredDefaults to application/json
The [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of the response body.

Request

This endpoint expects an object.
namestringRequired<=100 characters
The name of the coupon. The value must be unique.
typeenumRequired
amountstringRequired

The discount to apply to an order, as either an amount or a percentage. This field’s usage is determined by the coupon type. For example, a type of + percentage_discount would determine a percentage here.

codestringRequiredformat: "[a-zA-Z0-9_\ -]"<=50 characters
The coupon code that customers will use to receive their discounts. Value must be unique. Only letters, numbers, white space, underscores, and hyphens are allowed.
applies_toobjectRequired
If it is not included in the PUT request, its existing value on the coupon will be cleared. Also required to be set on the POST request
min_purchasestringOptional
Specifies a minimum value that an order must have before the coupon can be applied to it.
expiresstringOptional

Specifies when a coupon expires. Coupons need not have an expiry date – you can also control expiry via + max_uses or max_uses_per_customer. If you do use this date field, the value must be in RFC 2822 format.

enabledbooleanOptional

If the coupon is enabled, this field’s value is true; otherwise, false.

max_usesintegerOptional
Maximum number of times this coupon can be used.
max_uses_per_customerintegerOptional
Maximum number of times each customer can use this coupon.
restricted_toobjectOptional
shipping_methodslist of stringsOptional

This is a list of shipping-method names. A shipping method must be enabled on the store to use it with a coupon. To check which shipping methods are enabled, please use the List Shipping Methods endpoint.

Response

amountstring

The discount to apply to an order, as either an amount or a percentage. This field’s usage is determined by the coupon type. For example, a type of + percentage_discount would determine a percentage here.

applies_toobject
If it is not included in the PUT request, its existing value on the coupon will be cleared. Also required to be set on the POST request
codestringformat: "[a-zA-Z0-9_\ -]"<=50 characters
The coupon code that customers will use to receive their discounts. Value must be unique. Only letters, numbers, white space, underscores, and hyphens are allowed.
idinteger

The coupon’s ID. This is a read-only field; do not set or modify its value in a POST or PUT request.

namestring<=100 characters
The name of the coupon. The value must be unique.
typeenum
date_createdstring
Date Created
enabledboolean

If the coupon is enabled, this field’s value is true; otherwise, false.

expiresstring

Specifies when a coupon expires. Coupons need not have an expiry date – you can also control expiry via + max_uses or max_uses_per_customer. If you do use this date field, the value must be in RFC 2822 format.

max_usesinteger
Maximum number of times this coupon can be used.
max_uses_per_customerinteger
Maximum number of times each customer can use this coupon.
min_purchasestring
Specifies a minimum value that an order must have before the coupon can be applied to it.
num_usesinteger

Number of times this coupon has been used. This is a read-only field; do not set or modify its value in a POST or PUT request.

restricted_toobject
shipping_methodslist of strings

This is a list of shipping-method names. A shipping method must be enabled on the store to use it with a coupon. To check which shipping methods are enabled, please use the List Shipping Methods endpoint.

OAuth scopes

UI NamePermissionParameter
Marketingmodifystore_v2_marketing
Marketingread-onlystore_v2_marketing_read_only

Authentication header

HeaderArgumentDescription
X-Auth-Tokenaccess_tokenFor more about API accounts that generate access_tokens, see our Guide to API Accounts.

Further reading

For example requests and more information about authenticating BigCommerce APIs, see Authentication and Example Requests.

For more about BigCommerce OAuth scopes, see our Guide to API Accounts.

For a list of API status codes, see API Status Codes.

The MIME type of the response body.