Skip to main content

Create a discount code

Create a discount code for a partner. The partner's group must already have a discount assigned to it, and the discount code must be associated with a link that is not already linked with another discount code.
1 min read
post/discount-codes
Request example
Response
post/discount-codes
Tip

The partner's group must already have a discount assigned, and each referral link can only have one discount code. If you omit code, Dub generates one from the partner's name.

Authorization

Authorizationstringheaderrequired#
Default authentication mechanism

Body

application/json
codestring#
The discount code to create. If omitted, a unique code will be generated automatically from the partner's name.

Length: max 100Pattern: ^[a-zA-Z0-9\-_]+$

partnerIdstringrequired#
The ID of the partner to create a discount code for.
linkIdstringrequired#
The ID of the partner's referral link to associate this discount code with. Each link can only have one discount code.

Responses

application/json
The created discount code.
idstringrequired#
The unique ID of the discount code.
codestringrequired#
The alphanumeric discount code that customers can apply at checkout.
discountIdstringrequired#
The ID of the discount this code belongs to.
partnerIdstringrequired#
The ID of the partner this discount code is assigned to.
linkIdstringrequired#
The ID of the partner's referral link this discount code is associated with.
disabledAtstring#
When this discount code was disabled, which happens when a partner is banned or deactivated. We don't delete the discount code to avoid another partner claiming a banned/deactivated code (abuse vector).