Skip to main content
POST
/
v1
/
coupons
Create Coupon
curl --request POST \
  --url https://api.withflex.com/v1/coupons \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "coupon": {
    "applies_to": {},
    "name": "Coupon",
    "amount_off": 100,
    "duration": "once",
    "percent_off": 10,
    "max_redemptions": 100,
    "metadata": {
      "key": "value"
    }
  }
}
'
{
  "coupon": {
    "coupon_id": "fcoup_1234567890",
    "amount_off": 0,
    "applies_to": {},
    "duration": "once",
    "duration_in_months": 0,
    "metadata": {},
    "name": "Example",
    "percent_off": 0,
    "max_redemptions": 0,
    "times_redeemed": 0,
    "valid": false,
    "created_at": "2024-01-01T00:00:00Z",
    "test_mode": false
  }
}

Authorizations

Authorization
string
header
required

Use a Bearer token to access this API.

Body

application/json
coupon
object
required
Example:
{
  "applies_to": { "products": ["string"] },
  "name": "Coupon",
  "amount_off": 100,
  "duration": "once",
  "percent_off": 10,
  "max_redemptions": 100,
  "metadata": { "key": "value" }
}

Response

Success

coupon
object
required

A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. Coupons may be applied to subscriptions and checkout sessions.

Example:
{
  "coupon_id": "fcoup_1234567890",
  "amount_off": 0,
  "applies_to": { "products": ["string"] },
  "duration": "once",
  "duration_in_months": 0,
  "metadata": {},
  "name": "Example",
  "percent_off": 0,
  "max_redemptions": 0,
  "times_redeemed": 0,
  "valid": false,
  "created_at": "2024-01-01T00:00:00Z",
  "test_mode": false
}