# Tags Pairing

API for getting device ID using SensePass tags.

This API should be called once on new tag assignment for a register, then the register saves the device ID for the next transactions until un-pairing proccess occur.

### API Interface

## Pair Tag with a register

<mark style="color:green;">`POST`</mark> `https://api.sensepass.com/api/devices/match`

API for getting device ID using SensePass tags.

#### Request Body

| Name                                     | Type       | Description                                                                                                                                                                             |
| ---------------------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| pinCode                                  | string     | SensePass Tag ID - it's located below the QR code, for example: 53K-HMD-786                                                                                                             |
| apiKey<mark style="color:red;">\*</mark> | string     | Location or Merchant API key                                                                                                                                                            |
| deviceId                                 | string     | Optional - Device ID of existing register, will add the tag to this device instead of creating a new device ID                                                                          |
| posName                                  | string     | The name of the register, this value will be shown in merchant dashboard and partners dashboard                                                                                         |
| emvTerminalType                          | string     | <p>create an EMV Terminal for the matched device.<br>choose a type out of sensepass supported devices:<br><br>Dejavoo<br>Clover<br>Adyen<br>Verifone Flex<br>CloudIM<br>KCP<br>VIVA</p> |
| agentConfig                              | JSONObject | key value pair of emv terminal specific settings                                                                                                                                        |

{% tabs %}
{% tab title="200: OK OK" %}
deviceAliasKey is the device ID created for the tag.

```json
{
  "name": "POS",
  "deviceAliasKey": "syi2vm59le3zf7r9og29ezz12xin95vxhewuzdhu0c4cqizeu9d3yvs8rhn60el4eqr4iq6qozrguyw7rgrgqiec6abb9ftygfhvvwl9ar833i1ztnghj7k9zkrvrw5e8ykd2bueemddgcygwci3q12u4fu07ivxm1i7tw50wog7n9mu1pirdj0cg188mbvdf4axxpgc98udh71kxnu9i56yrm207msqrtl0hj44mvoibt4nanvenr06hpq9h9tq",
  "merchantUID": "string",
  "branchUID": "string",
  "pinCode": "string",
  "clientBoxes": [
    "https://pay.sensepass.com/c_EG9RW3DMJ4WDRF7KFN5A0ICSB0UU16"
  ]
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid Input" %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="500: Internal Server Error Internal Error" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

### Examples

#### Creating a new device ID for a tag

```json
{
  "pinCode": "111-222-333",
  "apiKey": "a1b2c3d4e5f6g7h8",
  "posName": "NewYorkBranchPos"
}
```

#### Attaching a tag to existing device ID

```json
{
  "pinCode": "111-222-333",
  "apiKey": "a1b2c3d4e5f6g7h8",
  "posName": "NewYorkBranchPos",
  "deviceId": "rti3vm59le3zf7r9og29ezz12xin95vxhewuzdhu0c4cqizeu9d3yvs8rhn60el4eqr4iq6qozrguyw7rgrgqiec6abb9ftygfhvvwl9ar833i1ztnghj7k9zkrvrw5e8ykd2bueemddgcygwci3q12u4fu07ivxm1i7tw50wog7n9mu1pirdj0cg188mbvdf4axxpgc98udh71kxnu9i56yrm207msqrtl0hj44mvoibt4nanvenr06hpq9h9bg"
}
```

#### Pair Response

```json
{
  "name": "POS",
  "deviceAliasKey": "syi2vm59le3zf7r9og29ezz12xin95vxhewuzdhu0c4cqizeu9d3yvs8rhn60el4eqr4iq6qozrguyw7rgrgqiec6abb9ftygfhvvwl9ar833i1ztnghj7k9zkrvrw5e8ykd2bueemddgcygwci3q12u4fu07ivxm1i7tw50wog7n9mu1pirdj0cg188mbvdf4axxpgc98udh71kxnu9i56yrm207msqrtl0hj44mvoibt4nanvenr06hpq9h9tq",
  "merchantUID": "string",
  "branchUID": "string",
  "pinCode": "string",
  "clientBoxes": [
    "https://pay.sensepass.com/c_EG9RW3DMJ4WDRF7KFN5A0ICSB0UU16"
  ]
}    
```

#### New EMV terminal Creation

```
{
  "apiKey": "a1b2c3d4e5f6g7h8",
  "posName": "NewPosWithTerminal",
  "emvTerminalType": "KCP"
}    
```

#### EMV terminal creation response

```
{
    "name": "NewPosWithTerminal",
    "deviceAliasKey": "syi2vm59le3zf7r9og29ezz12xin95vxhewuzdhu0c4cqizeu9d3yvs8rhn60el4eqr4iq6qozrguyw7rgrgqiec6abb9ftygfhvvwl9ar833i1ztnghj7k9zkrvrw5e8ykd2bueemddgcygwci3q12u4fu07ivxm1i7tw50wog7n9mu1pirdj0cg188mbvdf4axxpgc98udh71kxnu9i56yrm207msqrtl0hj44mvoibt4nanvenr06hpq9h9tq",
    "agentUUID": "xwj88sclyblma09lnu49857gn6iva2"
}    
```
