# API Info

#### Introduction  API for working with core Luna Loyalty Cards objects.

Default API methods address: [https://app.lunaloyaltycards.com/api/v1/\[method\]](https://app.boomerangme.cards/api/v1/%5Bmethod%5D)

Any request can return an error code in the error variable. Common errors for all requests:

| Code | Description                                       |
| ---- | ------------------------------------------------- |
| 1    | Invalid token specified                           |
| 2    | Card with the given serial number is not found    |
| 3    | Card found but not owned by your company          |
| 4    | Not all required request parameters are filled in |

Many queries take or return a card type parameter. List of card types:

| type | Card type                |
| ---- | ------------------------ |
| 0    | Cumulative card (stamps) |
| 1    | Cashback card            |
| 2    | Subscription (stamps)    |
| 3    | Coupon                   |
| 4    | Discount card            |
| 5    | Certificate              |
| 6    | Membership card          |

#### Reference

### List of card templates for your company

The request has no formal input Return values ​​for each pattern:

| Parameter | Description |
| --------- | ----------- |
| id        | Template ID |
| name      | Name        |
| type      | Card type   |

POST: <https://app.lunaloyaltycards.com/api/v1/getTemplates>

* Headers
* Content-Type:application/json
* x-access-token:ghgghhhyee358fjhdhd0

Body

```
{
  "passSerialNumber": "297150-586-203",
  "page": 2
}
```

#### Response

200

* Headers
* Content-Type:application/json

Body

```
[
  {
    "result": 1,
    "rows": [
      {
        "id": 203,
        "date": "2022-08-04 16:56:56",
        "message": "Test3!"
      }
    ]
  }
]
```

### Client creation

Creates a client for a card type. The request takes the following parameters:

| Parameter  | Type              | Description                          |
| ---------- | ----------------- | ------------------------------------ |
| sName      | string, required  | surname                              |
| fName      | string, required  | name                                 |
| phone      | integer           | phone number. Required if no email   |
| email      | string, required  | client email. Mandatory if not phone |
| idTemplate | integer, required | card template ID                     |

Possible errors typical for the request

| code | description                                                                                                                                   |
| ---- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| 5    | A user with this phone number or email is already created for this card type. If this error is present, the request also returns the user ID. |

**Request to create a client:** \
\*\*POST: <https://app.lunaloyaltycards.com/api/v1/createClient**\\> <br>

* Headers
* Content-Type:application/json
* x-access-token:ghgghhhyee358fjhdhd0

Body

```
{
  "sName": "Ivanov",
  "fName": "Peter",
  "phone": 74443334423,
  "idTemplate": 186
}
```

#### Response

200

* Headers
* Content-Type:application/json

Body

```
[
  {
    "result": 1,
    "userID": 133224
  }
]
```

### Search for the client in the card template

Search for a client by phone or email in a given card template

\| Parameter | Type | Description | | phone | integer | phone number. Obligatory if no email is specified | | E-mail | string | Client's Email. Mandatory if not phone | | idTemplate | integer, required | card template ID

POST: <https://app.lunaloyaltycards.com/api/v1/searchClient\\>
&#x20;

* \
  Headers
* Content-Type:application/json
* x-access-token:ghgghhhyee358fjhdhd0

Body

```
{
  "phone": 74443334423,
  "idTemplate": 186
}
```

#### Response

200

* Headers
* Content-Type:application/json

Body

```
[
  {
    "result": 1,
    "userID": 133224
  }
]
```

### Change the client

Changes the client parameters for the card type. The request takes the following parameters as a parameter:

| Parameter  | Type              | Description                          |
| ---------- | ----------------- | ------------------------------------ |
| userID     | integer, required | customer ID                          |
| sName      | string, required  | surname                              |
| fName      | string, required  | name                                 |
| phone      | integer           | phone number. Required if no email   |
| email      | string, required  | client email. Mandatory if not phone |
| idTemplate | integer, required | card template ID                     |

Possible errors typical for the request

| code | description                                                                                                                                   |
| ---- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| 5    | A user with this phone number or email is already created for this card type. If this error is present, the request also returns the user ID. |

POST: <https://app.lunaloyaltycards.com/api/v1/updateClient> <br>

* Headers
* Content-Type:application/json
* x-access-token:ghgghhhyee358fjhdhd0

Body

```
{
  "userID": 4422345,
  "sName": "Ivanov",
  "fName": "Peter",
  "phone": 74443334423,
  "idTemplate": 186
}
```

#### Response

200

* Headers
* Content-Type:application/json

Body

```
[
  {
    "result": 1
  }
]
```

### Creating a card

Creates a card of a given template for a specific client. The request takes the following parameters:

| Parameter  | Type              | Description      |
| ---------- | ----------------- | ---------------- |
| idTemplate | integer, required | card template ID |
| userID     | integer, required | customer ID      |

The client ID can be obtained by creating the client in the createClient method

POST: <https://app.lunaloyaltycards.com/api/v1/createPass> <br>

* \
  Headers
* Content-Type:application/json
* x-access-token:ghgghhhyee358fjhdhd0

Body

```
{
  "idTemplate": 759,
  "userID": 30478
}
```

#### Response

200

* Headers
* Content-Type:application/json

Body

```
[
  {
    "result": 1,
    "serialNumber": "448234-808-346",
    "installURL": "https://app.lunaloyaltycards.com/home/getpassform/759/30478/",
    "installQR": "https://app.lunaloyaltycards.com/home/installQR/759/30478/"
  }
]


```

### Card information

The request takes the passSerialNumber parameter and returns card details.

| Parameter        | Type             | Description               |
| ---------------- | ---------------- | ------------------------- |
| passSerialNumber | string, required | Serial number of the card |

The returned values ​​depend on the type of card. The card type is returned in the type attribute

Depending on the type of card, the structure and values ​​of returned data differ.

| Attribute    | Values ​​                         | Description               |
| ------------ | --------------------------------- | ------------------------- |
| status       | installed, deleted, not installed | Card status               |
| serialNumber | 123-4445-223444                   | Serial number of the card |

Card type 0.

| Attribute     | Values ​​  | Description                                                                                                                                                                                                                                                           |
| ------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| maxStamps     | 10         | The maximum number of stamps on stamps image                                                                                                                                                                                                                          |
| activeStamps  | 3          | Current number of stamps                                                                                                                                                                                                                                              |
| totalStamps   | 13         | The total number of stamps accrued for the entire duration of the card                                                                                                                                                                                                |
| unusedRewards | 1          | Number of unused awards                                                                                                                                                                                                                                               |
| image         | URL        | Path to the image with stamps reflecting the current number of stamps                                                                                                                                                                                                 |
| rewards       | Data array | An array of data with the attributes name, stamps, autoUse. name - the name of the award, stamps - the number of stamps, separated by commas, upon completion of which the award will be credited, autoUse - the automatic writing off of the award at the next visit |

Card type 1.

| Attribute             | Values ​​ | Description                                                        |
| --------------------- | --------- | ------------------------------------------------------------------ |
| amountMoneySpentTotal | 10000     | The total amount of funds recorded on the card                     |
| currentPersentBonus   | 4         | Current cashback percentage, according to which points are awarded |
| amountMoneyBonus      | 400       | Current number of points                                           |

Card type 2.

| Attribute    | Values ​​ | Description                                                                                                           |
| ------------ | --------- | --------------------------------------------------------------------------------------------------------------------- |
| maxStamps    | 10        | The maximum number of stamps on stamps image                                                                          |
| activeStamps | 3         | Current number of stamps                                                                                              |
| numberScores | 9         | The client can receive a certain number of bonus points for each visit, this field shows the current number of points |
| image        | URL       | Path to the stamps image reflecting current number of stamps                                                          |

Card type 4.

| Attribute             | Values ​​ | Description                                    |
| --------------------- | --------- | ---------------------------------------------- |
| amountMoneySpentTotal | 10000     | The total amount of funds recorded on the card |
| currentPersentBonus   | 4         | Current discount percentage                    |

POST: <https://app.lunaloyaltycards.com/api/v1/getPassInfo> <br>

* Headers
* Content-Type:application/json
* x-access-token:ghgghhhyee358fjhdhd0

Body

```
{
  "passSerialNumber": "931520-641-829"
}
```

#### Response

200

* Headers
* Content-Type:application/json

Body

```
[
  {
    "result": 1,
    "type": "0",
    "template": "186",
    "status": "installed",
    "serialNumber": "931520-641-829",
    "maxStamps": "10",
    "activeStamps": "5",
    "totalStamps": "25",
    "unusedRewards": "1",
    "image": "https://app.lunaloyaltycards.com/assets/passImages/186/app/5.png",
    "rewards": [
      {
        "name": "10 штампов = 1 чашка кофе бесплатно!"
      }
    ],
    "reward": [
      {
        "stamps": null,
        "autoUse": "0"
      }
    ]
  }
]
```

### Check the existence of the card using the phone number

The query takes the parameters phone and idTemplate and returns 0 (does not exist) or 1 (exists) in the result parameter

| Attribute  | Type              | Description             |
| ---------- | ----------------- | ----------------------- |
| idTemplate | integer, required | ID of the card template |
| phone      | integer, required | phone number            |

POST: <https://app.lunaloyaltycards.com/api/v1/checkPassExistsByPhone><br>

* \
  Headers
* Content-Type:application/json
* x-access-token:ghgghhhyee358fjhdhd0

Body

```
{
  "idTemplate": 759,
  "phone": 15554325011
}
```

#### Response

200

* Headers
* Content-Type:application/json

Body

```
[
  {
    "result": 1
  }
]
```

### Card information using the cardholder's phone number

The query takes parameters phone and idTemplate and returns card data in the same format as the getPassInfo method

| Attribute  | Type              | Description      |
| ---------- | ----------------- | ---------------- |
| idTemplate | integer, required | card template ID |
| phone      | integer, required | phone number     |

POST: <https://app.lunaloyaltycards.com/api/v1/getPassInfoByPhone><br>

* Headers
* Content-Type:application/json
* x-access-token:ghgghhhyee358fjhdhd0

Body

```
{
  "idTemplate": 759,
  "phone": 15554325011
}
```

#### Response

200

* Headers
* Content-Type:application/json

Body

```
[
  {
    "result": 1,
    "type": "0",
    "template": "759",
    "status": "not installed",
    "serialNumber": "448234-808-346",
    "maxStamps": "10",
    "activeStamps": "0",
    "totalStamps": "0",
    "unusedRewards": "0",
    "image": "https://app.lunaloyaltycards.com/assets/passImages/759/app/0.png",
    "rewards": [
      {
        "name": "Описание награды",
        "stamps": null,
        "autoUse": "0"
      }
    ]
  }
]
```

### Customer card information using phone number

Retrieves all cards within all templates available to your company by phone number and returns information on them.

| Attribute | Type              | Description  |
| --------- | ----------------- | ------------ |
| phone     | integer, required | phone number |

POST: <https://app.lunaloyaltycards.com/api/v1/getClientPassesByPhone>

* Headers
* Content-Type:application/json
* x-access-token:ghgghhhyee358fjhdhd0

Body

```
{
  "phone": 15554325011
}
```

#### Response

200

* Headers
* Content-Type:application/json

Body

```
[
  {
    "sName": "Жуков",
    "fName": "Михаил",
    "dateOfBirth": null,
    "phone": "+1 (555) 432-50-11",
    "email": null,
    "Field0": null,
    "Field1": null,
    "Field2": null,
    "Field3": null,
    "Field4": null,
    "Field5": null,
    "result": 1,
    "passes": [
      {
        "serialNumber": "222099-902-290",
        "type": "0",
        "template": "186",
        "status": "deleted"
      },
      {
        "serialNumber": "355281-965-539",
        "type": "0",
        "template": "261",
        "status": "not installed"
      },
      {
        "serialNumber": "256771-734-103",
        "type": "1",
        "template": "400",
        "status": "deleted"
      },
      {
        "serialNumber": "667327-188-199",
        "type": "3",
        "template": "427",
        "status": "installed"
      },
      {
        "serialNumber": "374808-313-433",
        "type": "0",
        "template": "428",
        "status": "deleted"
      },
      {
        "serialNumber": "281093-930-290",
        "type": "4",
        "template": "698",
        "status": "deleted"
      },
      {
        "serialNumber": "390908-502-504",
        "type": "0",
        "template": "702",
        "status": "not installed"
      },
      {
        "serialNumber": "251205-852-319",
        "type": "0",
        "template": "703",
        "status": "installed"
      },
      {
        "serialNumber": "486518-807-793",
        "type": "5",
        "template": "704",
        "status": "installed"
      },
      {
        "serialNumber": "931222-371-290",
        "type": "1",
        "template": "718",
        "status": "installed"
      },
      {
        "serialNumber": "522874-974-483",
        "type": "2",
        "template": "744",
        "status": "installed"
      },
      {
        "serialNumber": "973343-939-382",
        "type": "2",
        "template": "755",
        "status": "not installed"
      },
      {
        "serialNumber": "448234-808-346",
        "type": "0",
        "template": "759",
        "status": "not installed"
      }
    ]
  }
]
```

### Customer card information via email

The email retrieves all cards within all templates available to your company and returns information on them.

| Attribute | Type             | Description    |
| --------- | ---------------- | -------------- |
| email     | string, required | customer email |

POST: <https://app.lunaloyaltycards.com/api/v1/getClientPassesByEmail>

* Headers
* Content-Type:application/json
* x-access-token:ghgghhhyee358fjhdhd0

Body

```
{
  "email": "test@test.com"
}
```

#### Response

200

* Headers
* Content-Type:application/json

Body

```
[
  {
    "sName": "Жуков",
    "fName": "Михаил",
    "dateOfBirth": null,
    "phone": "+1 (555) 432-50-11",
    "email": null,
    "Field0": null,
    "Field1": null,
    "Field2": null,
    "Field3": null,
    "Field4": null,
    "Field5": null,
    "result": 1,
    "passes": [
      {
        "serialNumber": "222099-902-290",
        "type": "0",
        "template": "186",
        "status": "deleted"
      },
      {
        "serialNumber": "355281-965-539",
        "type": "0",
        "template": "261",
        "status": "not installed"
      },
      {
        "serialNumber": "256771-734-103",
        "type": "1",
        "template": "400",
        "status": "deleted"
      },
      {
        "serialNumber": "667327-188-199",
        "type": "3",
        "template": "427",
        "status": "installed"
      },
      {
        "serialNumber": "374808-313-433",
        "type": "0",
        "template": "428",
        "status": "deleted"
      },
      {
        "serialNumber": "281093-930-290",
        "type": "4",
        "template": "698",
        "status": "deleted"
      },
      {
        "serialNumber": "390908-502-504",
        "type": "0",
        "template": "702",
        "status": "not installed"
      },
      {
        "serialNumber": "251205-852-319",
        "type": "0",
        "template": "703",
        "status": "installed"
      },
      {
        "serialNumber": "486518-807-793",
        "type": "5",
        "template": "704",
        "status": "installed"
      },
      {
        "serialNumber": "931222-371-290",
        "type": "1",
        "template": "718",
        "status": "installed"
      },
      {
        "serialNumber": "522874-974-483",
        "type": "2",
        "template": "744",
        "status": "installed"
      },
      {
        "serialNumber": "973343-939-382",
        "type": "2",
        "template": "755",
        "status": "not installed"
      },
      {
        "serialNumber": "448234-808-346",
        "type": "0",
        "template": "759",
        "status": "not installed"
      }
    ]
  }
]
```

### Sending informational push notifications to clients who installed the cards

Sending a push notification to one client

| Attribute        | Type             | Description                                   |
| ---------------- | ---------------- | --------------------------------------------- |
| pushSegment      | string, required | the value of this parameter must be oneClient |
| passSerialNumber | string, required | serial number of the client card              |
| messageText      | string, required | push notification text                        |

Sending push notifications to all clients who installed cards of a certain template

| Attribute   | Type             | Description                                    |
| ----------- | ---------------- | ---------------------------------------------- |
| pushSegment | string, required | the value of this parameter must be allClients |
| idTemplate  | string, required | ID of the template of the card                 |
| messageText | string, required | push notification text                         |
| page        | page             | integer, required                              |

When sending push notifications to all clients it is necessary to use the page attribute, because sending takes some time and has to be done in parts. Up to 10 messages are sent with each call. After successful sending, the method returns the numberOfRowsSelected parameter. If it is 10, you must increase page by 1 and call the method again until the value of the numberOfRowsSelected parameter is less than 10.

The messageText attribute may contain variables that will be replaced by corresponding values. All variables in the message text are distinguished by special characters in double curly braces {{variable name}}. For example {{clientFName}}

A list of supported variables:

| Variable          | Description                                                                    |
| ----------------- | ------------------------------------------------------------------------------ |
| clientFName       | clientName                                                                     |
| clientSName       | clientSurname                                                                  |
| clientDateOfBirth | date of birth                                                                  |
| clientPhone       | clientPhone                                                                    |
| clientEmail       | clientEmail                                                                    |
| passCurrentStamps | current number of stamps on the client card (card type 0 and 2)                |
| passTotalStamps   | total number of stamps accumulated over time (card type 0)                     |
| passUnusedRewards | current number of unused rewards (card type 0)                                 |
| passPoints        | current bonus points (card type 1)                                             |
| passPersent       | current cashback percentage or current discount percentage (card type 1 and 4) |

**Request to send a push notification to one client**\
POST: <https://app.lunaloyaltycards.com/api/v1/sendInfoPush>

```
[
  {
    "result": 1
  }
]
```

Body

* Headers
* Content-Type:application/json

200

#### Response

```
{
  "pushSegment": "oneClient",
  "passSerialNumber": "931520-641-829",
  "messageText": "Test!"
}
```

Body

* \
  Headers
* Content-Type:application/json
* x-access-token:ghgghhhyee358fjhdhd0

\
\
**Request to send push notifications to all clients**\
POST: <https://app.lunaloyaltycards.com/api/v1/sendInfoPush>

* \
  Headers
* Content-Type:application/json
* x-access-token:ghgghhhyee358fjhdhd0

Body

```
{
  "pushSegment": "allClients",
  "idTemplate": 261,
  "messageText": "Test!"
}
```

#### Response

200

* Headers
* Content-Type:application/json

Body

```
[
  {
    "numberOfRowsSelected": 10,
    "result": 1
  }
]
```

### Get the history of information push notifications by card

| Attribute        | Type             | Description                                                                                             |
| ---------------- | ---------------- | ------------------------------------------------------------------------------------------------------- |
| passSerialNumber | string, required | customer card serial number                                                                             |
| page             | number           | page number. Since the query returns no more than 10 messages, it is used to select the following ones. |

**Request for history of informational push notifications**\
\
POST: <https://app.lunaloyaltycards.com/api/v1/getInfoPushList>

* \
  Headers
* Content-Type:application/json
* x-access-token:ghgghhhyee358fjhdhd0

Body

```
{
  "passSerialNumber": "297150-586-203",
  "page": 2
}
```

#### Response

200

* Headers
* Content-Type:application/json

Body

```
[
  {
    "result": 1,
    "rows": [
      {
        "id": 203,
        "date": "2022-08-04 16:56:56",
        "message": "Test3!"
      }
    ]
  }
]
```

### Template card status information

By template ID and retrieves information about the clients and their card statuses according to the type of selection.

| Attribute     | Type              | Description                                                                                                                                                                                                                                                                   |
| ------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| idTemplate    | integer, required | template ID                                                                                                                                                                                                                                                                   |
| selectionMode | string, required  | Selection type. PassNotCreated - returns all clients with unissued cards. PassInstalled - all clients with cards installed and currently valid. passNotInstalled - all clients with issued, but not installed cards. passDeleted - all clients with issued but deleted cards. |
| page          | number            | page number. Since the query returns no more than 100 clients, it serves to select the following ones.                                                                                                                                                                        |

[**Request to retrieve data**](https://boomerangmeeng.docs.apiary.io/reference/0/template-card-status-information/request-to-retrieve-data)

POST: <https://app.lunaloyaltycards.com/api/v1/getTemplateClientPasses\\>
\
Headers

* Content-Type:application/json
* x-access-token:ghgghhhyee358fjhdhd0

Body

```
{
  "idTemplate": 261,
  "page": 1,
  "selectionMode": "passInstalled"
}
```

#### Response

200

* Headers
* Content-Type:application/json

Body

```
[
  {
    "result": 1,
    "rows": [
      {
        "userID": "30362",
        "SName": "333444",
        "Fname": "1222",
        "Email": null,
        "Phone": "+76588522555",
        "serialNumber": "111026-586-857"
      },
      {
        "userID": "30363",
        "SName": "Tttyyy",
        "Fname": "Tttyy",
        "Email": null,
        "Phone": "+73522555555",
        "serialNumber": "368528-869-798"
      },
      {
        "userID": "30365",
        "SName": "We rrr",
        "Fname": "1233333",
        "Email": null,
        "Phone": "+72525555225",
        "serialNumber": "722341-454-139"
      },
      {
        "userID": "30366",
        "SName": "34534545",
        "Fname": "Михаил",
        "Email": null,
        "Phone": "+73534645756",
        "serialNumber": "999466-749-397"
      },
      {
        "userID": "30367",
        "SName": "124234",
        "Fname": "1123",
        "Email": null,
        "Phone": "+72335344645",
        "serialNumber": "880097-940-406"
      },
      {
        "userID": "30368",
        "SName": "34345",
        "Fname": "34546",
        "Email": null,
        "Phone": "+72434645657",
        "serialNumber": "819484-155-633"
      },
      {
        "userID": "30369",
        "SName": "45657",
        "Fname": "34546",
        "Email": null,
        "Phone": "+74456456456",
        "serialNumber": "283556-123-615"
      },
      {
        "userID": "30370",
        "SName": "35345",
        "Fname": "3424",
        "Email": null,
        "Phone": "+74564564564",
        "serialNumber": "762967-109-431"
      },
      {
        "userID": "30371",
        "SName": "345345345",
        "Fname": "234234234",
        "Email": null,
        "Phone": "+73464645665",
        "serialNumber": "953506-481-187"
      },
      {
        "userID": "30372",
        "SName": "456456",
        "Fname": "w34545",
        "Email": null,
        "Phone": "+74564575675",
        "serialNumber": "761364-498-824"
      },
      {
        "userID": "30372",
        "SName": "456456",
        "Fname": "w34545",
        "Email": null,
        "Phone": "+74564575675",
        "serialNumber": "603062-929-278"
      },
      {
        "userID": "30372",
        "SName": "456456",
        "Fname": "w34545",
        "Email": null,
        "Phone": "+74564575675",
        "serialNumber": "180247-499-464"
      },
      {
        "userID": "30372",
        "SName": "456456",
        "Fname": "w34545",
        "Email": null,
        "Phone": "+74564575675",
        "serialNumber": "240120-209-420"
      },
      {
        "userID": "30375",
        "SName": "120",
        "Fname": "120",
        "Email": null,
        "Phone": "+71201201201",
        "serialNumber": "805129-984-128"
      }
    ]
  }
]
```

### Information on card operations

The request takes the following parameters: passSerialNumber and page (optional). Returns the last 50 card transactions.

| Attribute        | Type             | Description                                                                                                  |
| ---------------- | ---------------- | ------------------------------------------------------------------------------------------------------------ |
| passSerialNumber | string, required | Serial number of the card                                                                                    |
| page             | number           | Page number. Because the request returns no more than 50 last operations, it serves to select the next page. |

**Request to receive data**

POST: <https://app.lunaloyaltycards.com/api/v1/getPassOperations><br>

* Headers
* Content-Type:application/json
* x-access-token:ghgghhhyee358fjhdhd0

Body

```
{
  "passSerialNumber": "931520-641-829"
}
```

#### Response

200

* Headers
* Content-Type:application/json

Body

```
[
  {
    "rows": [
      {
        "date": "2020-12-24 14:15:05",
        "operation": "1",
        "value": "3"
      },
      {
        "date": "2020-12-24 14:14:58",
        "operation": "1",
        "value": "2"
      },
      {
        "date": "2020-12-23 16:30:46",
        "operation": "2",
        "value": "1"
      },
      {
        "date": "2020-10-15 09:53:56",
        "operation": "3",
        "value": "1"
      },
      {
        "date": "2020-10-15 09:53:56",
        "operation": "1",
        "value": "1"
      },
      {
        "date": "2020-10-15 09:53:50",
        "operation": "1",
        "value": "9"
      },
      {
        "date": "2020-10-15 09:53:44",
        "operation": "3",
        "value": "1"
      },
      {
        "date": "2020-10-15 09:53:44",
        "operation": "1",
        "value": "7"
      },
      {
        "date": "2020-10-15 09:53:39",
        "operation": "1",
        "value": "1"
      },
      {
        "date": "2020-10-15 09:53:33",
        "operation": "1",
        "value": "1"
      }
    ]
  }
]
```

### Information about the client who installed the card

The request takes the passSerialNumber parameter.

| Parameter        | Type             | Description               |
| ---------------- | ---------------- | ------------------------- |
| passSerialNumber | string, required | Serial number of the card |

Returned parameters

| Parameter   | Description                                                                                      |
| ----------- | ------------------------------------------------------------------------------------------------ |
| sName       | Client surname                                                                                   |
| fName       | Client name                                                                                      |
| dateOfBirth | Date of birth                                                                                    |
| phone       | Phone number                                                                                     |
| Field0-5    | Values ​​of additional fields, if they were in the card issue form and the client filled them in |

[**Request to receive data**](https://boomerangmeeng.docs.apiary.io/reference/0/information-about-the-client-who-installed-the-card/request-to-receive-data)\
POST: <https://app.lunaloyaltycards.com/api/v1/getClientInfo>

* Headers
* Content-Type:application/json
* x-access-token:ghgghhhyee358fjhdhd0

Body

```
{
  "passSerialNumber": "931520-641-829"
}
```

#### Response

200

* Headers
* Content-Type:application/json

Body

```
[
  {
    "sName": "Михаил",
    "fName": null,
    "dateOfBirth": null,
    "phone": "+7 (568) 414-36-98",
    "email": null,
    "Field0": null,
    "Field1": null,
    "Field2": null,
    "Field3": null,
    "Field4": null,
    "Field5": null
  }
]
```

### Get client list by card template

The query takes idTemplate and page (optional) parameters. It returns 10 clients registered in the given card template.

| Parameter  | Type              | Description                                                                                            |
| ---------- | ----------------- | ------------------------------------------------------------------------------------------------------ |
| idTemplate | integer, required | card template ID                                                                                       |
| page       | number            | page number. Since the query returns no more than 10 clients, it is used to select the following ones. |

Returned parameters

| Parameter   | Description                                                                                      |
| ----------- | ------------------------------------------------------------------------------------------------ |
| id          | customer ID                                                                                      |
| sName       | client's last name                                                                               |
| fName       | customer name                                                                                    |
| dateOfBirth | date of birth                                                                                    |
| phone       | phone number                                                                                     |
| Field0-5    | values of additional fields, if they were in the card release form and the client filled them in |

**Request to get data**\
POST: <https://app.lunaloyaltycards.com/api/v1/getClientsList\\> <br>

* Headers
* Content-Type:application/json
* x-access-token:ghgghhhyee358fjhdhd0

Body

```
{
    "idTemplate": 759,
}
```

#### Response

200

* Headers
* Content-Type:application/json

Body

```
[
  {
    "result": 1,
    "rows": [
      {
        "id": 30478,
        "fName": "Михаил",
        "sName": "Жуков",
        "phone": "79084264035",
        "email": null,
        "dateOfBirth": null,
        "Field0": null,
        "Field1": null,
        "Field2": null,
        "Field3": null,
        "Field4": null,
        "Field5": null
      }
    ]
  }
]
```

### Card information update

This request depends on the type of card and includes general and special parameters. The request always takes the passSerialNumber parameter.

| Parameter        | Type             | Description               |
| ---------------- | ---------------- | ------------------------- |
| passSerialNumber | string, required | Serial number of the card |

Parameters for card type 0.

| Parameter    | Type              | Description               |
| ------------ | ----------------- | ------------------------- |
| numberStumps | integer, required | Number of credited stamps |

Parameters for card type 1.

| Parameter | Type              | Description     |
| --------- | ----------------- | --------------- |
| action    | string, required  | Action type     |
| sum       | integer, required | Scope of action |

Possible values ​​of action

| Value                 | Description                                 |
| --------------------- | ------------------------------------------- |
| spendPoints           | Writing off points                          |
| accruePoints          | Earning points                              |
| increaseTotalSpentSum | Increase in the total amount of funds spent |
| reduceTotalSpentSum   | Reducing the total amount of funds spent    |

Parameters for card type 2.

When writing off points:

| Parameter | Type              | Value           | Description                      |
| --------- | ----------------- | --------------- | -------------------------------- |
| action    | string, required  | spendPoints     | Action type: writing off points  |
| sum       | integer, required | For example: 12 | The amount of points written off |

When writing off visits:

| Parameter    | Type              | Value          | Description                      |
| ------------ | ----------------- | -------------- | -------------------------------- |
| action       | string, required  | takeStamps     | Action type: write off visits    |
| numberStumps | integer, required | For example: 1 | The amount of visits written off |

When calculating visits:

| Parameter    | Type              | Value          | Description                    |
| ------------ | ----------------- | -------------- | ------------------------------ |
| action       | string, required  | addStamps      | Action type: accrual of visits |
| numberStumps | integer, required | For example: 1 | Accrual of visits              |

Parameters for card type 4.

| Parameter | Type              | Description     |
| --------- | ----------------- | --------------- |
| action    | string, required  | Action type     |
| sum       | integer, required | Scope of action |

Possible values ​​for action

| Value                 | Description                                 |
| --------------------- | ------------------------------------------- |
| increaseTotalSpentSum | Increase in the total amount of funds spent |
| reduceTotalSpentSum   | Reducing the total amount of funds spent    |

Parameters for card type 5.

| Parameter | Type              | Description |
| --------- | ----------------- | ----------- |
| action    | string, required  | action type |
| sum       | integer, required | action type |

Possible values of action

| value        | description      |
| ------------ | ---------------- |
| spendPoints  | decrease balance |
| accruePoints | increase balance |

For all types of cards with an active card expiration date setting in the template.

| Parameter  | Type              | Description                                  |
| ---------- | ----------------- | -------------------------------------------- |
| action     | string, required  | action type                                  |
| expiryDate | integer, required | expiration date of the card (UNIX timestamp) |

Possible values of action

| value             | description              |
| ----------------- | ------------------------ |
| setExpirationDate | set card expiration date |

**Request to update the card**\
POST: <https://app.lunaloyaltycards.com/api/v1/usePass\\> <br>

* Headers
* Content-Type:application/json

Body

```
{
    "passSerialNumber": "931520-641-829",
    "numberStumps": 2,
}
```

#### Response

200

* Headers
* Content-Type:application/json

Body

```
[
  {
    "result": 1
  }
]
```

### Write off rewards on type 0 cards

With the card serial number it writes off all available rewards.

| Parameter        | Type              | Description                    |
| ---------------- | ----------------- | ------------------------------ |
| passSerialNumber | string, required  | card serial number             |
| numberRewards    | integer, required | number of rewards to write off |

**Card update request**\
POST: <https://app.lunaloyaltycards.com/api/v1/useReward\\> <br>

* Headers
* Content-Type:application/json

Body

```
{
  "passSerialNumber": "931520-641-829",
  "numberRewards": 1
}
```

#### Response

200

* Headers
* Content-Type:application/json

Body

```
[
  {
    "result": 1
  }
]
```

<br>


---

# Agent Instructions: 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://help.lunaloyaltycards.com/api-info.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.
