Create discount coupon

POST https://app.ecwid.com/api/v3/{storeId}/discount_coupons

Request and response example

Request:

POST /api/v3/1003/discount_coupons HTTP/1.1
Authorization: Bearer secret_token
Host: app.ecwid.com
Content-Type: application/json
Cache-Control: no-cache

{
  "name": "Coupon #1",
  "code": "MOXQ3YCWXRXA",
  "discountType": "ABS",
  "status": "ACTIVE",
  "discount": 1,
  "launchDate": "2024-06-06 08:00:00 +0400",
  "usesLimit": "UNLIMITED",
  "applicationLimit": "UNLIMITED",
  "orderCount": 0,
  "catalogLimit": {
    "products": [
      37208342,
      37208338
    ],
    "categories": []
  },
  "shippingLimit": {
    "shippingMethods": [
      "5376-1635838180367",
      "37151-1623844935660"
    ]
  }
}

Response:

{
  "id": 358845013,
  "code": "MOXQ3YCWXRXA"
}

Required access scopes

Your app must have the following access scopes to make this request: create_discount_coupons

Path params

All path params are required.

Param
Type
Description

storeId

number

Ecwid store ID.

Headers

The Authorization header is required.

Header
Format
Description

Authorization

Bearer secret_ab***cd

Access token of the application.

Request JSON

A JSON object with the following fields:

Field
Type
Description

name

string

Discount coupon name visible on the storefront.

code

string

Discount coupon code used for its activation at the checkout.

discountType

string

Discount type One of: ABS PERCENT SHIPPING ABS_AND_SHIPPING PERCENT_AND_SHIPPING

status

string

Current state of the discount coupon. One of: ACTIVE PAUSED EXPIRED USEDUP

discount

number

Discount coupon value.

launchDate

string

The date of coupon launch, for example, 2014-06-06 08:00:00 +0400. Any date provided will be corrected to the UTC +0 timezone.

expirationDate

string

Coupon expiration date, e.g. 2014-06-06 08:00:00 +0400. Any date provided will be corrected to the UTC +0 timezone.

totalLimit

number

Minimum order subtotal for the discount coupon to be applied.

usesLimit

string

Number of uses limitation. One of: UNLIMITED ONCEPERCUSTOMER SINGLE

applicationLimit

string

User application limit for the discount coupon.

One of: UNLIMITED - no user application limits. NEW_CUSTOMER_ONLY - discount coupon can be applied only by customers without placed orders. REPEAT_CUSTOMER_ONLY - discount coupon can be applied only by customers who placed orders in the store before.

creationDate

string

Coupon creation date. Format example: 2023-06-29 11:36:55 +0000

updateDate

string

Coupon update date. Format example: 2023-06-29 11:36:55 +0000

orderCount

number

Count of orders where the discount coupon was used.

catalogLimit

Product and category limitations for the discount coupon. If empty, discount coupon can be applied to all products and categories available on the storefront.

shippingLimit

Shipping method limitations for the discount coupon. If empty, discount coupon can be applied to any shipping method available at the checkout.

catalogLimit

Field
Type
Description

products

array of numbers

List of product IDs the discount coupon can be applied to, for example, [123456,234567]

categories

array of numbers

List of category IDs the discount coupon can be applied to, for example, [0,87253552,765257901]

shippingLimit

Field
Type
Description

shippingMethods

array of strings

List of shipping method IDs the discount coupon can be applied to, for example, ["18765-8651899366181"]

Response JSON

A JSON object with the following fields:

Field
Type
Description

id

number

Internal coupon ID.

code

string

Code of the created discount coupon that customers can use at the checkout.

Last updated

Was this helpful?