Skip to main content
POST
Create a discount
Click the base URL in the API playground and select the Sandbox host for test data or the Production host for live data. Use credentials from the same environment.

Authorizations

Authorization
string
header
required

The Server API Key obtained from the kelviq application. Pass as a Bearer token in the Authorization header. Example: 'Authorization: Bearer YOUR_API_KEY'

Body

application/json
discountType
enum<string>
required
Available options:
PERCENTAGE,
FIXED_AMOUNT
name
string
required

Displayed on the customer's invoice.

code
string
required

Checkout discount code. Uppercase letters and numbers only, and must be unique among active discounts for the organization.

amountOff
string

Required (and only used) when discountType is FIXED_AMOUNT.

percentageOff
integer

Required (and only used) when discountType is PERCENTAGE.

currency
string

3-letter ISO currency code. Required when discountType is FIXED_AMOUNT.

duration
enum<string>
default:ONCE
Available options:
ONCE,
REPEATING,
FOREVER
durationInMonths
integer

Number of billing periods the discount applies for. Despite the field name, this counts billing cycles, not calendar months — e.g. 3 on a yearly plan means 3 years. Required when duration is REPEATING.

redeemBy
string<date-time>

UTC time after which this discount can no longer be redeemed. Must be in the future.

maxRedemptions
integer

Total number of times this code can be redeemed across all customers.

appliesTo
object[]

Restrict the discount to specific products/plans. Omit to apply to all products.

Response

Discount created.

id
string<uuid>
Example:

"b3f1a2c4-5d6e-4f7a-8b9c-0d1e2f3a4b5c"

discountType
enum<string>

PERCENTAGE discounts a percentage off the price. FIXED_AMOUNT discounts a flat amount off the total.

Available options:
PERCENTAGE,
FIXED_AMOUNT
amountOff
string | null

Amount to discount, in currency units (e.g. "10.00"). Set when discountType is FIXED_AMOUNT.

Example:

"10.00"

percentageOff
integer | null

Percentage to discount. Set when discountType is PERCENTAGE.

Example:

20

currency
string | null

3-letter ISO currency code. Required when discountType is FIXED_AMOUNT.

Example:

"usd"

currencySymbol
string
Example:

"$"

name
string

Displayed on the customer's invoice.

Example:

"Summer Sale"

code
string

Checkout discount code. Uppercase letters and numbers only.

Example:

"SUMMER20"

duration
enum<string>

How many billing cycles the discount applies for.

Available options:
ONCE,
REPEATING,
FOREVER
durationInMonths
integer | null

Number of billing periods the discount applies for. Despite the field name, this counts billing cycles, not calendar months — e.g. 3 on a yearly plan means 3 years. Set when duration is REPEATING.

redeemBy
string<date-time> | null

UTC time after which this discount can no longer be redeemed.

maxRedemptions
integer | null

Total number of times this code can be redeemed across all customers.

timesRedeemed
integer

Number of times this code has been redeemed so far.

appliesTo
object[]

Products/plans this discount is restricted to. Empty means the discount applies to all products.

isActive
boolean