Discounts
Overview
A discount says what comes off a price. It belongs to the company and is reusable across every event the company organizes. A discount code hands one out. It belongs to a single event and to the paid ticket types of that event it names, and it is what a buyer types at checkout. The two are separate on purpose: one promotion (“10% off”) can be handed out as many codes, on many events, to many audiences. A discount with no code cannot be applied to an order — creating a discount alone changes nothing a buyer sees. Subscription: All plans, including Free.Discount types
amount is read in the terms of the type, never as a raw column: money in major units
on fixed_amount, a plain percentage on percentage, and nothing at all on bundle.
Sending an amount on a bundle is 422, not ignored.
readable_amount is a ready-made string for a reader that will not format money itself
(-€5.50, 10%, 3x2). Money is rendered in English regardless of the event’s locale,
so one discount does not read two ways on the same API.
Bundle quantities come as a pair
bundle_quantity is how many products the buyer gets; free_quantity is how many of
those are free. “Get 3, pay for 2” is bundle_quantity: 3, free_quantity: 1.
A request carries both or neither. On a PATCH that leaves type alone they are
optional, but sending one without the other is 422 rather than being measured against
the stored other half — 3 is a valid bundle_quantity against a stored free_quantity
of 1 and an invalid one against a stored 3, and which it is, is not something a caller
should have to remember.
Constraints: free_quantity > 0, and bundle_quantity > free_quantity. A bundle that
gives everything away is refused.
Endpoints
List discounts
- Method:
GET - Path:
/api/v1/{company}/discounts - Scope:
discounts:read - Subscription: All plans, including Free
Path parameters
Query parameters
Response 200
Response fields
Show discount
- Method:
GET - Path:
/api/v1/{company}/discounts/{discount} - Scope:
discounts:read - Subscription: All plans, including Free
usage and the first page of the codes that hand it
out, across every event.
codes is a preview, not the whole list. At most one page of them (15) is embedded, and
codes_count is how many there are in total. When codes_count is larger than the
number of entries in codes, read the rest from
List the codes of a discount — there is no way to ask
for the next slice here.
Response 200
Create discount
- Method:
POST - Path:
/api/v1/{company}/discounts/create - Scope:
discounts:create - Subscription: All plans, including Free
Request body
Response 201
Returns a single discount in a data envelope.
Update discount
- Method:
PATCH - Path:
/api/v1/{company}/discounts/{discount} - Scope:
discounts:update - Subscription: All plans, including Free
amount / quantities, which describe the type rather than
standing on their own. A request that sends type settles what the discount is and must
carry the fields that give the new type its meaning — turning a bundle into a percentage
needs an amount, and the old quantities are dropped rather than kept. A request that
leaves type alone leaves them alone too.
Set is_active: false to call a promotion off: every code handing it out stops working,
and no order that already used it is touched.
Request body
Same fields as create, all optional.Response 200
Returns the updated discount.
Delete discount
- Method:
DELETE - Path:
/api/v1/{company}/discounts/{discount} - Scope:
discounts:delete - Subscription: All plans, including Free
Response 204
No content.
List the codes of a discount
- Method:
GET - Path:
/api/v1/{company}/discounts/{discount}/codes - Scope:
discounts:read - Subscription: All plans, including Free
codes_count on Show discount points at, and the only code list that crosses
events.
To ask the other question — which codes does this event have — use
List discount codes below.
Query parameters
Response 200
Paginated discount codes; see Discount code fields.
List discount codes
- Method:
GET - Path:
/api/v1/{company}/event/{organizingEvent}/discount-codes - Scope:
discounts:read(route group also requiresevents:read) - Subscription: All plans, including Free
Path parameters
Query parameters
Response 200
Discount code fields
Show discount code
- Method:
GET - Path:
/api/v1/{company}/event/{organizingEvent}/discount-codes/{discountCode} - Scope:
discounts:read - Subscription: All plans, including Free
usage.
Create discount code
- Method:
POST - Path:
/api/v1/{company}/event/{organizingEvent}/discount-codes/create - Scope:
discounts:create - Subscription: All plans, including Free
Request body
Only paid ticket types can be named: a free ticket has no price for a discount to come
off. A slug that is not a paid ticket type of this event is
422.
Code uniqueness is per ticket type. The same string may be reused on another ticket
type of the event, which is what lets one promotion cover several tiers, but not on one
that already has it. Deleting a code frees its string again.
Response 201
Returns the created code.
Delete discount code
- Method:
DELETE - Path:
/api/v1/{company}/event/{organizingEvent}/discount-codes/{discountCode} - Scope:
discounts:delete - Subscription: All plans, including Free
Response 204
No content.
Usage
usage is what a discount, or one of its codes, has been worth. It is read from the order
lines it was sold on, so the numbers are the ones that were actually charged.
It costs one aggregated query and is therefore only present on the single-resource
endpoints, never on a list.
Reserved fields
max_uses and expires_at are present on every discount code and are always null.
The columns exist and can_be_used honors them, but no write path accepts them — not
POST .../discount-codes/create, and not the Animo admin. Treat them as reserved: read
them if you like, do not build on them, and do not expect to be able to set them. They
will be documented here when a write path lands.
To limit a promotion today, delete the code (or set the discount is_active: false) when
you want it to stop.
No update on a discount code
There is deliberately noPATCH for a discount code. The interesting change — which
ticket types a code applies to — changes the meaning of a code that may already be in
circulation. Delete it and create another instead. The Animo admin offers the same.