Skip to main content
POST
/
stores
/
{storeId}
/
coupons
Create coupon
curl --request POST \
  --url https://api.komerza.com/stores/{storeId}/coupons \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "code": "<string>",
  "maximumUses": 49999999,
  "isEnabled": true,
  "percentageDecrease": 50.5,
  "amountDecrease": 50000.005,
  "variantIds": [
    "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  ]
}
'
{
  "success": true,
  "message": "<string>",
  "code": "<string>",
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "dateCreated": "2023-11-07T05:31:56Z",
    "code": "<string>",
    "uses": 123,
    "maximumUses": 50000000,
    "isEnabled": true,
    "storeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "percentageDecrease": 50,
    "amountDecrease": 50000,
    "variantIds": [
      "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    ],
    "expirationDate": "2023-11-07T05:31:56Z"
  }
}

Authorizations

Authorization
string
header
required

Your API key goes here

Path Parameters

storeId
string<uuid>
required

The ID of the store to create the coupon in

Body

application/json

The form containing the details of the new coupon

The data-transfer object for a coupon, used for creating or updating a coupon and returned by the API.

code
string
required

The case-insensitive code the customer will enter to redeem the coupon.

Required string length: 3 - 32
maximumUses
integer<int32>
required

The maximum number of times the coupon may be used. Set to –1 for unlimited uses.

Required range: -1 <= x <= 100000000
isEnabled
boolean
required

Whether the coupon is active and may be used at checkout.

percentageDecrease
number<double> | null

The percentage to subtract from the order total when the coupon is applied.

Required range: 1 <= x <= 100
amountDecrease
number<double> | null

A fixed amount to subtract from the order total when the coupon is applied.

Required range: 0.01 <= x <= 100000
variantIds
string<uuid>[] | null

The list of variant IDs this coupon applies to; null or empty for all variants.

Response

The object was successfully created.

Represents a default generic response for API endpoints.

success
boolean
required

Indicates whether the operation or response was successful.

message
string | null

A descriptive message providing additional context or information about the response.

code
string | null

The error code (if there was an error) to use when referencing the error

data
object

A coupon code can be used to reduce the cost of an order with a store for a specified percentage