> 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/redeem-voucher-code.md).

# Redeem voucher code

### Overview

In the scenarios where Airship is the gatekeeper for voucher codes, an unredeemed single use voucher can be marked as 'Redeemed' within Airship, so any subsequent [Voucher Checks](/basics/vouchers/check-voucher-code.md) return the status of 'Redeemed', or attempted Redemptions return an 'Already Redeemed' style message.

### Example Request

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

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

{% 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`           | 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.                                                                                                                                                                                                                                                                              |
| `unit_id`              | Airship has predefined locations or "units" to store contacts for different physical locations. The units object represents which location which the voucher code was redeemed at. You can fetch a list of units for your account using the `account/units`endpoint.                                                                                                                                                                  |
| `unique_code_group_id` | <p>Optional (providing the voucher codes are set to <code>unique by account</code> within Airship)</p><p></p><p>The unique voucher code group which the voucher is associated with. As the same voucher code can exist in different code groups (be issued in different campaigns at different points in time) - the UCGID enables us to narrow down which campaign the voucher belongs to  when codes are not unique by account.</p> |
| `unique_code`          | The unique voucher code which you are attempting to redeem.                                                                                                                                                                                                                                                                                                                                                                           |
| `redemption_date`      | <p>Optional<br><br>The date time that the voucher was redeemed. If this is not included, the current date time of the request will be used</p>                                                                                                                                                                                                                                                                                        |

### Basic Payload example

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

```json
{
    "account_id": 2,
    "unit_id": 10252,
    "unique_code_group_id": 44125,
    "unique_code": "AB03-23RTT0",
    "redemption_date": "2022-07-13 12:30:04"
}
```

{% endtab %}

{% tab title="200 Response" %}

```json
{
    "id": 62123846,
    "unique_code": "AB03-23RTT0",
    "unique_code_group_id": "44125",
    "contact_id": "5162520",
    "redeemed_at_unit_id": 10252,
    "redeemed_at_datetime": "2021-11-02T16:29:05.558280Z",
    "unique_code_status": "Redeemed"
}
```

{% endtab %}

{% tab title="422 Response" %}

1. Voucher already redeemed

```json
{
    "message": "The given data was invalid.",
    "errors": {
        "unique_code": [
            "This unique code has already been redeemeed."
        ]
    }
}
```

2\. Invalid Unit ID

```json
{
    "message": "The given data was invalid.",
    "errors": {
        "unit_id": [
            "Unit ID 5234 does not exist or has been deleted on this account"
        ]
    }
}
```

3\. Invalid Unique Code Group ID

```json
{
    "message": "The given data was invalid.",
    "errors": {
        "unique_code_group_id": [
            "This unique code group id doesn't exist"
        ]
    }
}
```

4\. Invalid account ID

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

{% endtab %}
{% endtabs %}

### Results

Once a voucher has successfully been redeemed, if it is assigned to a contact - then you will be able to check if the voucher has been redeemed in Airship.

![](/files/xqBrh6hR7QTHlTNhhm4g)

Once a voucher is redeemed, you should see the Redemption date (based on the date/time the call was made) and Redeemed at unit populated (based on the Unit ID provided in the redemption call).


---

# 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/redeem-voucher-code.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.
