Discount Codes

Create a discount code

Set at most one of percentOff and amountOffMinor. Set neither and the code carries no discount at all: the buyer pays full price and you still see who it brought in. A code with no discount cannot carry a name, because the code itself is its name. Terms are fixed once created: to change them, archive this code and create another.

post/gateway/discount-codes

Request

  • Base URL: https://api.agentaos.ai/api/v1
  • URL: https://api.agentaos.ai/api/v1/gateway/discount-codes
  • Auth: API key in header x-api-key

Request body

codestring required

What the buyer types. Letters, numbers, dashes and underscores.

namestring

Your own label for the code, shown back to you on the single-code route. Not allowed on a code that carries no discount.

percentOffnumber

Percentage off the first invoice. A code cannot take the whole price off — set up a free trial for that.

amountOffMinorinteger

Integer minor units. The currency is the plan's, or your settlement currency when the code is not tied to a plan. It comes off the total the buyer pays, VAT included.

maxRedemptionsinteger
expiresAtstring date-time

Must be in the future.

linkIdstring uuid

Restrict the code to one subscription plan.

Response

Discount code created.

idstring uuid required
codestring required

As you typed it. Buyers may type it in any case.

kind'discount' | 'tracking' required

discount changes the price. tracking changes nothing and only records who used it.

planLinkIdstring uuid nullable required

The one plan this code works on; null means every subscription plan you own.

planNamestring nullable required
archivedAtstring date-time nullable required
createdAtstring date-time required
activeboolean required

Usable as far as this list can tell: not archived, and fully created. Whether the code has since been used up is answered by the single-code route.

Changes

No recorded changes to this operation across all 1 revision of this API.