logoSellhub
Coupons
background
Sellhub Docs
Sellhub Docs
Create New Coupon
POST
/products/coupons

Authorization

Authorization<token>

In: header

Request Body

application/jsonRequired

Request body for creating a coupon

couponCodestring

Coupon Code

couponValuenumber

Coupon Value

valueTypestring

Coupon Value Type

enableStartDateboolean
startDatestring
Format: "date-time"
productsAcceptedobject

Mapping of product IDs to arrays of variant IDs

bundlesAcceptedarray<string>

List of bundle IDs the coupon applies to

paymentsAcceptedarray<string>

Payment methods valid for this coupon

disabledPaymentMethodsarray<string>

Payment methods disabled from using this coupon

enableEndDateboolean
endDatestring
Format: "date-time"
enableLimitboolean
couponLimitnumber
curl -X POST "https://dash.sellhub.cx/api/sellhub/products/coupons" \
  -H "Authorization: <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "couponCode": "SUMMER2024",
    "couponValue": 25,
    "valueType": "percentage",
    "enableStartDate": true,
    "startDate": "2024-06-01T00:00:00Z",
    "productsAccepted": {
      "prod_123": {
        "variants": [
          "var_456",
          "var_789"
        ]
      }
    },
    "bundlesAccepted": [
      "bundle_123",
      "bundle_456"
    ],
    "paymentsAccepted": [
      "stripe"
    ],
    "disabledPaymentMethods": [
      "paypalF&F"
    ],
    "enableEndDate": false,
    "endDate": "2024-08-31T23:59:59Z",
    "enableLimit": true,
    "couponLimit": 1000
  }'

Coupon created

{
  "success": "Coupon created successfully",
  "couponId": "coupon_456"
}