Skip to main content
POST
Create a discount code
Webhook: none. A discount code moves no money until a buyer uses it at checkout. See Which action fires which event.

Authorizations

x-api-key
string
header
required

Your secret key, from app.agentaos.ai -> Settings -> Developers -> API Keys. The key's prefix is both its identity and its environment: sk_test_... (sandbox, free, no verification) or sk_live_... (real money, requires business verification). A missing or invalid key returns 401.

Body

application/json
code
string
required

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

Pattern: ^[A-Za-z0-9_-]{1,64}$
name
string

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

Maximum string length: 120
percentOff
number

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

Required range: 0.01 <= x <= 99
amountOffMinor
integer

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.

Required range: x >= 1
maxRedemptions
integer
Required range: x >= 1
expiresAt
string<date-time>

Must be in the future.

Restrict the code to one subscription plan.

Response

Discount code created.

Fully camelCase on the wire.

id
string<uuid>
required
code
string
required

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

kind
enum<string>
required

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

Available options:
discount,
tracking

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

planName
string | null
required
archivedAt
string<date-time> | null
required
createdAt
string<date-time>
required
active
boolean
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.