> 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/anonymous-purchase-data/add-anonymous-purchase-data.md).

# Add anonymous purchase data

### Endpoint

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

### Configuration

Along with the account\_id, either the `booking_reference`, `unique_code`,  `card_reference`, `membership_number` or `table_number` is required to associate a purchase to a contact.

| Field                  | Notes                                                                                                                                                                                               |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `account_id`           | <p>Required</p><p></p><p>The account ID represents the account that you are storing this contact to. If you are unsure of what your account ID is, ask our support team to confirm</p>              |
| `booking_reference`    | The unique booking reference associated to the purchase.                                                                                                                                            |
| `unique_code`          | The unique voucher code used on the purchase.                                                                                                                                                       |
| `unique_code_group_id` | <p>Optional<br>Airships unique code group ID associated to the voucher. If the client has re-useable vouchers codes (for different promotions) - this id is required to pass in a unique\_code.</p> |
| `membership_number`    | The customers loyalty / membership number used on the purchase.                                                                                                                                     |
| `card_reference`       | The customers loyalty card number used on the purchase.                                                                                                                                             |
| `table_number`         | The table number which the customer sat at\*                                                                                                                                                        |
| `provider_id`          | This is the partners ID to help identify the source of a purchase. If you need one creating, please contact <support@airship.co.uk>, we'll get one added and provide you an ID                      |

\*The table number has some additional checks in place within Airship. We will look for any customers from the booking integration who;

* Has a booking
* Had that table number associated in the booking extract
* Had a booking seated date on the same day as the purchase date
* Whose booking start time was within 3 hours of the purchase completed time

Operationaly, this requires the customer to be seated at the table defined within the booking platform - or the booking platform to be updated with the seated table number to work.

More detail on the purchases history which can be passed can be found [here](/basics/contacts/append-purchase-history.md).

### Basic payload example

```json
{
    "account_id": 3,
    "booking_reference": "5G83-234G-23TG",
    "unique_code": "BD34G53",
    "unique_code_group_id": 45121,
    "membership_number": "76398763-42T",
    "card_reference": "1234abc5678",
    "table_number": "44",
    "purchases": [
        {
            "transaction_reference": "77FF-24FF-234F-7",
            "unit_id": 8775,
            "provider_id": 2,
            "created_at": "2021-06-01 00:00:00",
            "items": [
                {
                    "description": "Bacon Cheeseburger",
                    "sku": "abc_8913",
                    "quantity": 1,
                    "value": 7,
                    "tags": [
                        "Burger",
                        "Main course"
                    ]
                },
                {
                    "description": "Garlic Bread",
                    "sku": "5621",
                    "quantity": 2,
                    "value": 8.40,
                    "tags": [
                        "Sides"
                    ]
                }
            ]
        }
    ]
}
```


---

# 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/anonymous-purchase-data/add-anonymous-purchase-data.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.
