# Lock Thing to IMEI

## Configure a Thing to only work with a specific IMEI

<mark style="color:orange;">`PUT`</mark> `https://console.monogoto.io/thing/update`

#### Headers

| Name                                          | Type   | Description               |
| --------------------------------------------- | ------ | ------------------------- |
| YOUR\_TOKEN<mark style="color:red;">\*</mark> | String | Your authentication token |

#### Request Body

| Name                                    | Type   | Description                            |
| --------------------------------------- | ------ | -------------------------------------- |
| CAS<mark style="color:red;">\*</mark>   | String | Retrieve via **GET Thing Information** |
| ICCID<mark style="color:red;">\*</mark> | String | The ICCID of your SIM                  |
| MASTER\_IMEI\_STATE                     | String | Replace with **true** or **false**     |
| DEVICE\_IMEI                            | String | IMEI of your device                    |

{% tabs %}
{% tab title="200: OK OK" %}

```javascript
{
    Thing undefined successfully saved.
}
```

{% endtab %}

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

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

{% endtab %}

{% tab title="401: Unauthorized Unauthorized" %}

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

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

{% hint style="info" %}
This API call requires the "**cas**" value that confirms the Thing settings to be up to date. The "**cas**" value can be retrieved through [**Get Thing Information**](https://docs.monogoto.io/developer/api/things/how-to-obtain-thing-ip-address).
{% endhint %}

### Example using **cURL**:

```bash
curl -X PUT \
    --url "https://console.monogoto.io/thing/update/" \
    -H "accept: application/json" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer {TOKEN_HERE}" \
    -d "{\"cas\": \"{CAS}\",\"ThingId\": \"/thing/ThingId_ICCID_{ICCID}\",\"LockMasterImei\": {MASTER_IMEI_STATE},\"MasterIMEI\": \"{DEVICE_IMEI}\"}"   
```

{% hint style="info" %}
Please note that the above shown command needs to be replaced with information:

* **{TOKEN\_HERE}** - replace with your token, see [Authentication](https://docs.monogoto.io/developer/api/how-to-obtain-login-token)
* **{CAS}** - replace with your Thing "**cas**" value, retrieved via [Get Thing Information](https://docs.monogoto.io/developer/api/things/how-to-obtain-thing-ip-address)
* **{THING\_ICCID}** - replace with *ThingId\_ICCID\_ABC*, where *ABC* is your thing *ICCID*.
* **{MASTER\_IMEI\_STATE}** - replace with **true** or **false** value, depending on what you want to do:
  * **true** - Enable Master IMEI limitation to allow only our entered device IMEI to get SIM card services
  * **false** - Disable Master IMEI limitation to allow all devices to work with this Thing
* **{DEVICE\_IMEI}** - replace with the device IMEI you want to work with this Thing. *Note that you can send empty value in order to remove Master IMEI value*
  {% endhint %}

Request example:

```bash
curl -X PUT \
    --url "https://console.monogoto.io/thing/update/" \
    -H "accept: application/json" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer eyJhb6IkpXVCJ9.eyJSb2xlIjoiVXN4lclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYWN3NzhhMGQxYmbSI6Im4zgFkbWluIiwiQ3VzdG9tsbCwiVXNlcklkIjoiVklkXzg5Yj5Y2OGEyUtNDQThhLTEzZjA0MzJhZDE3YyINTAzgZmUtZGI51My00ZjRiLTktN2U5Yjc0ZWU1ZThlIiwiaWNzM3MjI5L2MDY3NTE2Mjl9.99aSLzP7kTgK6TZGW-xalrMu0GkW6viunt3XxbNng" \
    -d "{\"cas\": \"1236781245913489491\",\"ThingId\": \" ThingId_ICCID_8912372646888991\",\"LockMasterImei\": true,\"MasterIMEI\": \"86696204060123456\"}"
```

Expected response:

```json
Thing undefined successfully saved.
```

{% openapi src="<https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FXtNpEMk17YOUrC39Cmvr%2FJPU_CustomerAPIV_Without_Test%20it.yaml?alt=media&token=09b74b38-dd09-4edc-8f98-4df792b3c986>" path="/thing/update/" method="put" %}
[JPU\_CustomerAPIV\_Without\_Test it.yaml](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FXtNpEMk17YOUrC39Cmvr%2FJPU_CustomerAPIV_Without_Test%20it.yaml?alt=media\&token=09b74b38-dd09-4edc-8f98-4df792b3c986)
{% endopenapi %}
