> 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/contacts/append-loyalty-data.md).

# Append Loyalty data

Store Loyalty Interaction details as you send contact data to us

### **Overview**

Airship can store Loyalty data for each contact. This is stored as a card entity against the contact, and each card can have different details such as Card balance, card points, etc.

A must be part of a Scheme, which is a grouping for the cards. Each card must also be unique within a Scheme, as if we see a duplicate reference - we will update the original card details.

### **Overview**

Airship can store Loyalty data for each contact.

<table><thead><tr><th width="254">Field</th><th>Notes</th></tr></thead><tbody><tr><td><code>transaction_datetime</code></td><td>Date time of interaction<br><em>Required field</em></td></tr><tr><td><code>unit_id</code></td><td><p>The unit_id representing the physical location for which this Loyalty interaction relates. If provided, a PoP will also be generated for the specified transaction_datetime <br></p><p><em>Optional field</em></p></td></tr><tr><td><code>reference</code></td><td><p>The unique loyalty reference, which relates to the entity which identifies the balance / points (i.e. Card number, or customer identifier) </p><p></p><p><em>Required field</em></p></td></tr><tr><td><code>pin</code></td><td><p>If applicable, the pin associated to the card</p><p></p><p><em>Optional field</em></p></td></tr><tr><td><code>card_points</code></td><td><p>If the card has a points balance, the amount of points on that card </p><p></p><p><em>Optional field</em></p></td></tr><tr><td><code>card_balance</code></td><td><p>If the card has a cash value, the value that is on that card</p><p>A card can have a mixture of Points and Balance</p><p></p><p><em>Optional field</em></p></td></tr><tr><td><code>active</code></td><td><p>If the card is active, then active = true.</p><p>If the card has been suspended, then active = false</p><p></p><p>The flag will always default to active if not specified</p><p></p><p><em>Optional field</em></p></td></tr><tr><td><code>provider_id</code></td><td><p>Unique ID for the integration partner. If you are a new integrator, please contact our support team to get a new ID setup</p><p><br><em>Required field</em></p></td></tr><tr><td><code>purchase_value</code></td><td>If the card was purchased, the value which the card was sold for<br><br><em>Optional field</em></td></tr><tr><td><code>next_expiry_amount</code></td><td>If the card has any points or balance which are due to expire, the next amount which will be removed from the card<br><br><em>Optional field</em></td></tr><tr><td><code>next_expiry_date</code></td><td>If the card has any points / balance which are due to expire - the date they are due to expire<br><br><em>Optional field</em></td></tr></tbody></table>

### Example Payload

```
 {
   "account_id": 3,
   "email": "johnsmith@gmail.com",
   //...etc...
 },
 "membership_cards": [
    {
      "reference": "ABC-001-XYZ",
      "scheme_reference": "Staff Loyalty Scheme",
      "transaction_datetime": "2021-04-27 20:50:00",
      "unit_id": 67,
      "pin": 123456,
      "points": 100,
      "balance": 0,
      "active": true,
      "provider_id": 5,
      "purchase_value": 0,
      "next_expiry_amount": 0,
      "next_expiry_date": "2022-01-02"
    }
  ]
 }
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.airship.co.uk/basics/contacts/append-loyalty-data.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
