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

# Discount codes

> Query, create, and update event discount codes

## swoogo\_get\_discount\_codes

List discount codes for an event, or retrieve a single code by ID. Returns the code string, type, discount amount, and capacity.

### Parameters

| Parameter          | Type    | Required       | Description                                               |
| ------------------ | ------- | -------------- | --------------------------------------------------------- |
| `discount_code_id` | integer | No             | Get a single code by ID (no `event_id` needed)            |
| `event_id`         | integer | Yes (for list) | Event to list codes for                                   |
| `code`             | string  | No             | Filter by code string (partial match)                     |
| `type`             | string  | No             | `percentage`, `absolute`, or `specific`                   |
| `search`           | string  | No             | Raw Swoogo search filter                                  |
| `fields`           | string  | No             | Comma-separated fields to return                          |
| `expand`           | string  | No             | Include related objects (`alternates`, `registrantCount`) |
| `page`             | integer | No             | Page number (default: 1)                                  |
| `per_page`         | integer | No             | Results per page (default: 20, max: 1000)                 |
| `sort`             | string  | No             | Sort field (prefix `-` for descending)                    |

### Example prompts

* *"Find discount codes containing EARLY for event 12345"*
* *"How many times has discount code 456 been used?"*

***

## swoogo\_create\_discount\_code

Create a discount code for an event.

### Parameters

| Parameter                  | Type    | Required | Description                                                                    |
| -------------------------- | ------- | -------- | ------------------------------------------------------------------------------ |
| `event_id`                 | integer | Yes      | Event to create the code for                                                   |
| `code`                     | string  | Yes      | Unique code string. Cannot contain `<`, `>`, `\`, or `"`                       |
| `type`                     | string  | Yes      | `percentage`, `absolute`, or `specific`                                        |
| `percentage_discount`      | number  | No       | Percentage off (0-100). Required for `percentage` type                         |
| `absolute_discount`        | number  | No       | Fixed amount off. Required for `absolute` type                                 |
| `apply_to_all`             | boolean | No       | Apply to all line items (default: true)                                        |
| `capacity`                 | integer | No       | Maximum number of uses                                                         |
| `notes`                    | string  | No       | Internal notes                                                                 |
| `min_group_size`           | integer | No       | Minimum group size required to use the code                                    |
| `registrants_per_use`      | integer | No       | Maximum registrants per group booking                                          |
| `all_registrants_in_group` | boolean | No       | All group members must use the same code                                       |
| `sold_out_message`         | string  | No       | Message shown when capacity is reached                                         |
| `additional_fields`        | object  | No       | Any other discount fields (for example `applicable_line_items`, `custom_fees`) |

### Example prompts

* *"Create a 20% discount code EARLY20 for event 12345"*
* *"Add a \$50 off code limited to 100 uses"*

***

## swoogo\_update\_discount\_code

Update an existing discount code. Only the fields you provide are changed.

### Parameters

| Parameter                  | Type    | Required | Description                             |
| -------------------------- | ------- | -------- | --------------------------------------- |
| `discount_code_id`         | integer | Yes      | Code to update                          |
| `code`                     | string  | No       | New code string                         |
| `type`                     | string  | No       | `percentage`, `absolute`, or `specific` |
| `percentage_discount`      | number  | No       | New percentage off (0-100)              |
| `absolute_discount`        | number  | No       | New fixed amount off                    |
| `apply_to_all`             | boolean | No       | New apply-to-all setting                |
| `capacity`                 | integer | No       | New maximum uses                        |
| `notes`                    | string  | No       | New internal notes                      |
| `min_group_size`           | integer | No       | New minimum group size                  |
| `registrants_per_use`      | integer | No       | New registrants per group booking       |
| `all_registrants_in_group` | boolean | No       | New group code requirement              |
| `sold_out_message`         | string  | No       | New sold-out message                    |
| `additional_fields`        | object  | No       | Any other discount fields to update     |

<Info>Alternate codes (those with a `parent_id` greater than 0) inherit some settings from their parent and cannot update those fields directly.</Info>

### Example prompts

* *"Raise the capacity of discount code 456 to 500"*
* *"Change EARLY20 to 25% off"*
