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.
Authorizations
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
What the buyer types. Letters, numbers, dashes and underscores.
^[A-Za-z0-9_-]{1,64}$Your own label for the code, shown back to you on the single-code route. Not allowed on a code that carries no discount.
120Percentage off the first invoice. A code cannot take the whole price off — set up a free trial for that.
0.01 <= x <= 99Integer 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.
x >= 1x >= 1Must be in the future.
Restrict the code to one subscription plan.
Response
Discount code created.
Fully camelCase on the wire.
As you typed it. Buyers may type it in any case.
discount changes the price. tracking changes nothing and only records who used it.
discount, tracking The one plan this code works on; null means every subscription plan you own.
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.