POST
/
v2
/
promo_codes
curl --request POST \
  --url https://api.whop.com/api/v2/promo_codes \
  --header 'Content-Type: application/json' \
  --data '{
  "amount_off": 123,
  "base_currency": "usd",
  "code": "<string>",
  "promo_type": "percentage",
  "expiration_datetime": 123,
  "new_users_only": true,
  "number_of_intervals": 123,
  "plan_ids": [
    "<string>"
  ],
  "stock": 123,
  "unlimited_stock": true,
  "metadata": {}
}'
{
  "id": "<string>",
  "plans": "<string>",
  "amount_off": 123,
  "base_currency": "usd",
  "code": "<string>",
  "new_users_only": true,
  "number_of_intervals": 123,
  "plan_ids": [
    [
      "<any>"
    ]
  ],
  "promo_type": "percentage",
  "status": "active",
  "stock": 123,
  "unlimited_stock": true,
  "uses": 123,
  "created_at": 123,
  "expiration_datetime": 123,
  "metadata": {},
  "duration": "forever",
  "existing_memberships_only": true
}

Headers

Authorization
string

Your API key, which can be found on the Whop Business Dashboard. You must prepend your key with the word 'Bearer', which will look like Bearer ***************************

Query Parameters

expand
enum<string>[]

Whether or not to expand the Plans on the returned Promo Code(s). Pass an array with each object(s) you want to expand, e.g. [plans]

Available options:
plans,
promo_code

Body

application/json
amount_off
number
required

The amount off (percentage or flat amount) for the Promo Code.

base_currency
enum<string>
required

The monetary currency of the Promo Code.

Available options:
usd,
sgd,
inr,
aud,
brl,
cad,
dkk,
eur,
nok,
gbp,
sek,
chf,
hkd,
huf,
jpy,
mxn,
myr,
pln,
czk,
nzd,
aed,
eth,
ape,
cop,
ron,
thb
code
string
required

The specific code used to apply the Promo Code at checkout.

promo_type
enum<string>
required

Whether the Promo Code is a percentage or flat amount off.

Available options:
percentage,
flat_amount
expiration_datetime
integer

The date/time of when the Promo Code expires.

new_users_only
boolean
default: false

Restricts Promo Code use to users who haven't purchased from the company before.

number_of_intervals
integer
default: 0

The number of billing cycles the Promo Code is applied for. By default, it is applied forever (0).

plan_ids
string[]

The IDs of plans associated with the Promo Code. Use JSON as your content-type when setting this. Form encoded data will not work well with arrays.

stock
integer

The number of total uses remaining for the Promo Code.

unlimited_stock
boolean

Whether or not the Promo Code has unlimited uses.

metadata
object

A key value pair of metadata. Whatever you put on here will be assigned to any memberships that are created on this plan

Response

201 - application/json
id
string

The ID of the Promo Code, which will look like promo_*************

plans
string

The Plans this Promo Code is valid for. By default this will just be the IDs of the Plans, but you can expand it to get more information about the Plan by passing [plan] in the expand parameter.

amount_off
number

The amount off (percentage or flat amount) for the Promo Code.

base_currency
enum<string>

The monetary currency of the Promo Code.

Available options:
usd,
sgd,
inr,
aud,
brl,
cad,
dkk,
eur,
nok,
gbp,
sek,
chf,
hkd,
huf,
jpy,
mxn,
myr,
pln,
czk,
nzd,
aed,
eth,
ape,
cop,
ron,
thb
code
string

The specific code used to apply the Promo Code at checkout.

new_users_only
boolean

Restricts Promo Code use to users who haven't purchased from the company before.

number_of_intervals
integer

The number of billing cycles the Promo Code is applied for. By default, it is applied forever (0).

plan_ids
array

Please use plans instead, as this field is deprecated.

promo_type
enum<string>

Whether the Promo Code is a percentage or flat amount off.

Available options:
percentage,
flat_amount
status
enum<string>

Indicates if the Promo Code is live, disabled, or archived.

Available options:
active,
inactive,
archived
stock
integer

The number of total uses remaining for the Promo Code.

unlimited_stock
boolean

Whether or not the Promo Code has unlimited uses.

uses
integer

The amount of times the Promo Code has been used.

created_at
integer

The time at which the Promo Code was created. Measured in seconds since the Unix epoch.

expiration_datetime
integer

The date/time of when the Promo Code expires.

metadata
object

A polymorphic object containing information that can be user defined

duration
enum<string>

The duration setting for the promo code.

Available options:
forever,
once,
repeating
existing_memberships_only
boolean

If true, the promo code can only be applied to existing memberships (post checkout).