> 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/search-contact/search-contact-by-voucher.md).

# Search contact by voucher

### Overview

Any contact that has a unique voucher code assigned can be searched for using the get /Contact endpoint. An account ID, voucher code and voucher code group must be provided to ensure the relevant contact is returned.

This is currently used to identify a contact by a unique voucher code, and the POS / Order and pay provider will then apply a basket to that contact using the [Append booking data](/basics/contacts/append-booking-data.md)&#x20;

### Example Request

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

```
https://api.airship.co.uk/v1/contacts
```

{% 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.                                                                                                               |
| `code`       | The unique voucher code which you are searching for.                                                                                                                                                                                                                   |
| `ucgid`      | 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 code is being searched for. |

### **Basic payload example**

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

```json
{
  "account_id": 2,
  "voucher_code_data": 
    {
      "code": "PL1022393E",
      "ucgid": 523
    }
}
```

{% endtab %}

{% tab title="200 Response" %}

```json
{
    "allow_sms": false,
    "allow_email": true,
    "allow_call": false,
    "allow_snail_mail": false,
    "udfs": [],
    "units": [
        {
            "id": 14458,
            "name": "Head Office",
            "groups": [
                {
                    "id": 126832,
                    "name": "Football visitor"
                },
                {
                    "id": 126842,
                    "name": "Christmas Competition entry"
                }
            ]
        },
        {
            "id": 14478,
            "name": "London venue",
            "groups": [
                {
                    "id": 126778,
                    "name": "WIFI"
                }
            ]
        }
    ],
    "feedback": "https://api.airship.co.uk/v1/contact/51616336/feedback",
    "bookings": "https://api.airship.co.uk/v1/contact/51616336/bookings",
    "purchases": "https://api.airship.co.uk/v1/contact/51616336/purchases",
    "proof_of_presence": "https://api.airship.co.uk/v1/contact/51616336/pops",
    "id": 51616336,
    "gender": "M",
    "title": "Mr",
    "first_name": "John",
    "last_name": "Smith",
    "dob": "1984-11-27",
    "building_name": "",
    "building_num_street": "2 Test Way",
    "locality": "",
    "postcode": "L1 1AA",
    "city": "London",
    "country": "United Kingdom",
    "county": "",
    "mobile_number": "447816000001",
    "home_number": "",
    "preferred_method_id": "0",
    "work_number": "",
    "email": "John.Smith@airship.co.uk",
    "source_id": "134747",
    "membership_number": "",
    "membership_type": ""
}
```

{% endtab %}

{% tab title="422 Response" %}
A 422 response can be given in the following scenarios;

1. Account ID is incorrect

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

2\. Unique code group ID is incorrect

```json
{
    "message": "The given data was invalid.",
    "errors": {
        "ucgid": [
            "This ucgid does not exist"
        ]
    }
}
```

{% 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, and the optional `goal` query parameter:

```
GET https://developers.airship.co.uk/basics/search-contact/search-contact-by-voucher.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
