# Assign devices

### Assign LoRaWAN device to a building

*Request URL:*

```
POST /controllers/lorawan-assign/{Serial number}/{buidling ID}
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
    "app_key":"A0685DFA*******************19A"
}
```

*Response:*

```
{
    "controller_reassign": {
        "id": 103***,
        "controller_id": 32***,
        "building_id": 1076,
        "floor_id": null,
        "space_id": null,
        "room_id": null,
        "created_at": "2024-04-03 12:58:06",
        "deleted_at": null
    },
    "_links": {
        "self": {
            "href": "/v1/controllers/lorawan-assign/XJP*********M/1076"
        }
    }
}
```

### Assign LoRaWAN device to a space/floor/room

*Request URL:*

```
POST /controllers/lorawan-assign/{Serial number}/{buidling ID}/{type("room","floor", "space"/{asset ID}
```

example:

```
POST /controllers/lorawan-assign/HEHV702648RAT/526/room/1705
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
    "app_key":"A0685DFA*******************19A"
}
```

*Response:*

```
{
    "controller_reassign": {
        "id": 7791,
        "controller_id": 70264,
        "building_id": 526,
        "floor_id": 18***,
        "space_id": 1***,
        "room_id": 1705,
        "created_at": "2026-01-14 15:10:33",
        "deleted_at": null
    },
    "_links": {
        "self": {
            "href": "/v1/controllers/lorawan-assign/HEHV702648RAT/526/room/1705"
        }
    }
}
```
