> ## Documentation Index
> Fetch the complete documentation index at: https://docs.animo.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Discounts

# 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

| `type` | What it does | Fields that define it |
| - | - | - |
| `fixed_amount` | Takes money off | `amount` — major units, e.g. `"5.50"` for five euros fifty |
| `percentage` | Takes a share off | `amount` — the percentage, e.g. `"10"` or `"7.5"`, at most `100` |
| `bundle` | Gives products away (3 for the price of 2) | `bundle_quantity` and `free_quantity` |

`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

| Name | Type | Description |
| - | - | - |
| `company` | string | Company sqid |

#### Query parameters

| Name | Type | Description |
| - | - | - |
| `q` | string | Case-insensitive substring filter on `name` |
| `page` | integer | Pagination page; see [Conventions — Pagination](https://docs.animo.co/conventions.md#pagination) |

#### Response `200`

```json theme={null}
{
  "data": [
    {
      "id": "ZWitU",
      "name": "Early bird",
      "type": "percentage",
      "is_active": true,
      "amount": "10",
      "readable_amount": "10%",
      "rules": null,
      "created_at": "2026-10-30T12:00:00.0000+00:00"
    }
  ],
  "links": { "first": "...", "last": "...", "prev": null, "next": null },
  "meta": { "current_page": 1, "last_page": 1, "per_page": 15, "total": 1 }
}
```

#### Response fields

| Field | Type | Description |
| - | - | - |
| `id` | string | Discount sqid |
| `name` | string | What the organizer calls this discount |
| `type` | string | `fixed_amount`, `percentage` or `bundle` |
| `is_active` | boolean | A discount that is off is never applied, whatever codes it has |
| `amount` | string\|null | In the terms of the type; `null` on a bundle |
| `readable_amount` | string | Formatted for display (`-€5.50`, `10%`, `3x2`) |
| `rules` | object\|null | `{bundle_quantity, free_quantity}` on a bundle, `null` otherwise |
| `codes` | array | Only on **Show discount**; see below |
| `codes_count` | integer | Only on **Show discount**; total number of codes |
| `usage` | object | Only on **Show discount**; see [Usage](#usage) |
| `created_at` | string | ISO 8601 |

***

### Show discount

* **Method:** `GET`
* **Path:** `/api/v1/{company}/discounts/{discount}`
* **Scope:** `discounts:read`
* **Subscription:** All plans, including Free

Returns the discount with its `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](#list-the-codes-of-a-discount) — there is no way to ask
for the next slice here.

#### Response `200`

```json theme={null}
{
  "data": {
    "id": "ZWitU",
    "name": "Early bird",
    "type": "fixed_amount",
    "is_active": true,
    "amount": "5.50",
    "readable_amount": "-€5.50",
    "rules": null,
    "codes": [ { "id": "k2Jd9", "code": "EARLY", "...": "..." } ],
    "codes_count": 420,
    "usage": {
      "uses": 12,
      "quantity": 14,
      "orders": 12,
      "discounted_amount": "66.00",
      "currency": "EUR"
    },
    "created_at": "2026-10-30T12:00:00.0000+00:00"
  }
}
```

***

### Create discount

* **Method:** `POST`
* **Path:** `/api/v1/{company}/discounts/create`
* **Scope:** `discounts:create`
* **Subscription:** All plans, including Free

#### Request body

```json theme={null}
{
  "name": "Early bird",
  "type": "percentage",
  "amount": "10",
  "is_active": true
}
```

| Field | Required | Description |
| - | - | - |
| `name` | Yes | Max 255 characters |
| `type` | Yes | `fixed_amount`, `percentage` or `bundle` |
| `amount` | Unless `type` is `bundle` | Greater than `0`, at most two decimals; at most `100` on `percentage`. **Prohibited** on a bundle |
| `bundle_quantity` | On `bundle` only | Integer, greater than `free_quantity`. **Prohibited** on other types |
| `free_quantity` | On `bundle` only | Integer, greater than `0`. **Prohibited** on other types |
| `is_active` | No | Defaults to `true` |

#### 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

Partial: a field you do not send keeps the value it has.

The exception is the pair `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

Soft deletes the discount **and with it every code that hands it out, on every event**. A
code whose discount is gone can no longer be applied to a cart.

Orders that already used the discount keep what they were sold with.

#### 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

Every code that hands out this discount, on **every** event of the company. This is the
list `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](#list-discount-codes) below.

#### Query parameters

| Name | Type | Description |
| - | - | - |
| `page` | integer | Pagination page |

#### Response `200`

Paginated discount codes; see [Discount code fields](#discount-code-fields).

***

### List discount codes

* **Method:** `GET`
* **Path:** `/api/v1/{company}/event/{organizingEvent}/discount-codes`
* **Scope:** `discounts:read` (route group also requires `events:read`)
* **Subscription:** All plans, including Free

The codes of one event, whichever discount each one hands out.

#### Path parameters

| Name | Type | Description |
| - | - | - |
| `company` | string | Company sqid |
| `organizingEvent` | string | Organizing event slug |

#### Query parameters

| Name | Type | Description |
| - | - | - |
| `page` | integer | Pagination page |

#### Response `200`

```json theme={null}
{
  "data": [
    {
      "id": "k2Jd9",
      "code": "EARLY",
      "discount_id": "ZWitU",
      "event_id": "ai-demo-days",
      "ticket_type_slugs": ["general-admission"],
      "max_uses": null,
      "expires_at": null,
      "uses": 3,
      "remaining_uses": null,
      "can_be_used": true,
      "created_at": "2026-10-30T12:00:00.0000+00:00"
    }
  ],
  "links": { "...": "..." },
  "meta": { "current_page": 1, "last_page": 1, "per_page": 15, "total": 1 }
}
```

#### Discount code fields

| Field | Type | Description |
| - | - | - |
| `id` | string | Discount code sqid |
| `code` | string | What the buyer types at checkout. **Stored upper cased** |
| `discount_id` | string | The discount this code hands out |
| `event_id` | string | Event **slug** |
| `ticket_type_slugs` | array | The paid ticket types this code applies to |
| `max_uses` | integer\|null | **Reserved; always `null`** — see [Reserved fields](#reserved-fields) |
| `expires_at` | string\|null | **Reserved; always `null`** — see [Reserved fields](#reserved-fields) |
| `uses` | integer | Times the code was redeemed on an order that is already sold |
| `remaining_uses` | integer\|null | `null` means no limit. Withholds uses held by checkouts still in flight, so it can be lower than `max_uses - uses` |
| `can_be_used` | boolean | Whether the code can be applied to a cart right now |
| `usage` | object | Only on **Show discount code**; see [Usage](#usage) |
| `created_at` | string | ISO 8601 |

***

### Show discount code

* **Method:** `GET`
* **Path:** `/api/v1/{company}/event/{organizingEvent}/discount-codes/{discountCode}`
* **Scope:** `discounts:read`
* **Subscription:** All plans, including Free

Returns the code with its `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

```json theme={null}
{
  "discount_id": "ZWitU",
  "code": "EARLY-BIRD",
  "ticket_type_slugs": ["general-admission", "vip"]
}
```

| Field | Required | Description |
| - | - | - |
| `discount_id` | Yes | A discount sqid of this company |
| `code` | Yes | 3 to 100 characters. Stored and compared upper cased |
| `ticket_type_slugs` | Yes | At least one. Must be **paid** ticket types of this event |

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

Soft deletes the code. The discount behind it is untouched and so is every other code
handing it out; an order that already used this one keeps the discount it was sold with.

#### 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.

| Field | Type | Description |
| - | - | - |
| `uses` | integer | Orders the discount was applied to |
| `quantity` | integer | Tickets discounted across those orders |
| `orders` | integer | Distinct orders |
| `discounted_amount` | string | Money taken off in total, major units |
| `currency` | string | Currency code |

## 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 no `PATCH` 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.

## Related

* [Authentication](https://docs.animo.co/authentication.md)
* [Conventions](https://docs.animo.co/conventions.md)
* [Ticket types](https://docs.animo.co/endpoints/ticket-types.md)
* [Events](https://docs.animo.co/endpoints/events.md)
* [Animo MCP](https://docs.animo.co/mcp.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.