> For the complete documentation index, see [llms.txt](https://developers.airship.co.uk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.airship.co.uk/basics/vouchers/create-unique-code-group.md).

# Create Unique Code Group

### Overview

Unique Code Groups are containers for vouchers, they are typically related to a specific campaign or promotion and the group will contain all unique voucher codes for that specific campaign or promotion.

When creating a unique code group, no unique vouchers will be generated. This is a manual process that will require Airship customer success to generate them.

### Example Request

{% tabs %}
{% tab title="POST" %}

```
https://api.airship.co.uk/v1/unique_code/group
```

{% endtab %}
{% endtabs %}

### Configuration

#### Headers

| Field                           | Notes                                                                                                                                                                          |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Authentication` (bearer token) | The authentication token is linked to the account that you are searching bookings in. If you are unsure of what your Authentication token is, ask our support team to confirm. |

#### Body

| Field        | Notes                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `account_id` | <p>The account ID represents the account that you are searching bookings in. If you are unsure of what your account ID is, ask our support team to confirm.<br></p>                                                                                                                                                                                                                                                                      |
| `unit_id`    | <p>Airship has predefined locations or "units" to store contacts for different physical locations. The units object represents which location which the voucher code group to be created against. You can fetch a list of units for your account using the <code>account/units</code>endpoint. </p><p>Typically code groups are created against the Head Office account, but check with Airship Customer Services if you are unsure.</p> |
| `name`       | A text descriptive name is required against the code group. The unique code group name must be unique against the Account > Unit. An error will be returned if the group name already exists.                                                                                                                                                                                                                                            |

### Example Payload

{% tabs %}
{% tab title="Request" %}

```json
{
    "account_id": 2,
    "unit_id": 14212,
    "name": "test group"
}
```

{% endtab %}

{% tab title="200 Response" %}

```json
{
    "id": 10616
}
```

{% endtab %}

{% tab title="422 Response" %}

1. Duplicate group name

```json
{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "Sorry, You've all ready used this name on another unique code group in this unit."
        ]
    }
}
```

2\. Invalid unit ID

```json
{
    "message": "The given data was invalid.",
    "errors": {
        "unit_id": [
            "Unit ID 2 does not exist or has been deleted on this account"
        ],
        "name": [
            "In order to add a name the unit id must also be correct"
        ]
    }
}
```

3\. Invalid account ID

```json
{
    "message": "The given data was invalid.",
    "errors": {
        "account_id": [
            "You do not have access to this account"
        ]
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.airship.co.uk/basics/vouchers/create-unique-code-group.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
