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 Carts
        • Carts
        • Channels
        • Checkouts
        • Currencies
        • Customer Segmentation
        • Geography
        • Infrastructure Hosting
        • Inventory
        • Orders
        • Order Operations
        • Pickup
        • Pickup Methods
        • Pickup Options
        • Pricing
        • Price Lists
        • Promotions
              • GETList Coupon Codes
              • DELDelete Multiple Coupon Codes
              • POSTGenerate Multiple Coupon Codes
        • Promotion Settings
        • Redirects
        • Scripts
        • Settings
        • Shipping
        • Sites
        • Subscribers
        • System Logs
        • Tax
        • Wishlists
      • Payments
  • GraphQL
    • Overview
  • MCP
    • Overview
Dev Portal
LogoLogo
RESTAdminManagementPromotionsCoupon Codes Bulk

Generate Multiple Coupon Codes

POST
https://api.bigcommerce.com/stores/:store_hash/v3/promotions/:promotion_id/codegen
POST
/stores/:store_hash/v3/promotions/:promotion_id/codegen
$curl -X POST https://api.bigcommerce.com/stores/store_hash/v3/promotions/promotion_id/codegen \
> -H "Accept: application/json" \
> -H "X-Auth-Token: <apiKey>" \
> -H "Content-Type: application/json" \
> -d '{
> "batch_size": 5
>}'
1{
2 "data": {
3 "created": "2019-01-20T22:00:00+00:00",
4 "max_uses": 10,
5 "max_uses_per_customer": 5,
6 "batch_size": 5,
7 "codes": [
8 {
9 "code": "WFYUYQM1W1ZYGK7S"
10 },
11 {
12 "code": "TQ4PBBEK9SCZ212Z"
13 },
14 {
15 "code": "B2YKV43O18LPJGNS"
16 },
17 {
18 "code": "OSGJJBV3WBRC3G7X"
19 },
20 {
21 "code": "XA8JS9T2N0C2TGS3"
22 }
23 ]
24 },
25 "meta": {}
26}
Generate a batch of coupon codes for a particular bulk coupon promotion. **Note:** * batch_size (number of codes generated per request) is limited to 250. If batch_size is not an integer or larger than 250, it will return a 422 error code. * The default rate limit for this endpoint is 10 concurrent requests.
Was this page helpful?
Previous

Delete Multiple Coupon Codes

Next

Create Coupon Code

Built with

Generate a batch of coupon codes for a particular bulk coupon promotion.

Note:

  • batch_size (number of codes generated per request) is limited to 250. If batch_size is not an integer or larger than 250, it will return a 422 error code.
  • The default rate limit for this endpoint is 10 concurrent requests.

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 [API Accounts and OAuth Scopes](/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). For more about BigCommerce OAuth scopes, see [API Accounts and OAuth Scopes](/developer/docs/overview/api-fundamentals/api-accounts#api-accounts). For a list of API status codes, see [API Status Codes](/developer/api-reference/rest/overview#rest-http-status-codes).

Path parameters

promotion_idstringRequired
The ID of the associated promotion.
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.
batch_sizeintegerRequired1-250
The number of coupon codes to generate in each batch. The maximum value is 250.
max_usesintegerOptional0-100000
The maximum number of times each coupon code can be used. The default value is 1. The value 0 means unlimited usage.
max_uses_per_customerintegerOptional0-100000
The maximum number of times a specific customer can use each coupon code. The default value is 1. The value 0 means unlimited usage.

Response

dataobject
metaobject
Empty meta object, which may be used at a later time.

Errors

400
Bad Request Error
403
Forbidden Error
405
Method Not Allowed Error
422
Unprocessable Entity Error

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 API Accounts and OAuth Scopes.

Further reading

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

For more about BigCommerce OAuth scopes, see API Accounts and OAuth Scopes.

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

The MIME type of the response body.