# LoRaWAN FUOTA

{% file src="/files/Nr3oWsTOUOchZCGhTHpc" %}

{% hint style="info" %}
Avaliable regions:

0 - EU868

1 - AS923

2 - AU915

3 - US915
{% endhint %}

## Fetch available firmwares for update

*Request URL:*

```
GET /lorawan/fuota/fetch/firmwares/{device_type}
```

*Headers:*

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

*Response:*

```
{
    "_embedded": {
        "lorawan": [
            {
                "firmware_version": "4.2",
                "region": 0,
                "_links": {
                    "self": {
                        "href": "/v1/lorawan/fuota/fetch/firmwares/vicki_lorawan"
                    }
                }
            },
            {
                "firmware_version": "4.1",
                "region": 0,
                "_links": {
                    "self": {
                        "href": "/v1/lorawan/fuota/fetch/firmwares/vicki_lorawan"
                    }
                }
            }
        ]
    },
    "total": 2,
    "_links": {
        "self": {
            "href": "/v1/lorawan/fuota/fetch/firmwares/vicki_lorawan"
        }
    }
}
```

## Initiate FUOTA

*Request URL:*

```
POST /lorawan/fuota/initiate
```

*Headers:*

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

*Body*:

```
{
    "serial_numbers":["XJPC327253WXM"],
    "version": 4.2,
    "region": 0,
    "fast_fuota": false // true/false
}
```

*Response:*

```
{
    "_embedded": {
        "lorawan": [
            {
                "status": "pending",
                "initiatedTime": "2024-02-06 11:33:42",
                "currentVersion": 41,
                "updatingToVersion": "4.2",
                "region": 0,
                "serial_number": "XJPC327253WXM",
                "_links": {
                    "self": {
                        "href": "/v1/lorawan/fuota/initiate"
                    }
                }
            }
        ]
    },
    "total": 1,
    "_links": {
        "self": {
            "href": "/v1/lorawan/fuota/initiate"
        }
    }
}
```

## Fetch FUOTA progress

*Request URL:*

```
GET /lorawan/fuota/fetch/{serial_number}
```

*Headers:*

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

*Response:*

```
{
    "lorawan": {
        "status": "updating",
        "updatingToVersion": "4.2",
        "currentVersion": 41,
        "lastPacketTime": "2024-02-06T14:15:59.569798008Z",
        "progress": 1,
        "region": 0,
    },
    "_links": {
        "self": {
            "href": "/v1/lorawan/fuota/fetch/5XJ267721HBLP"
        }
    }
}
```

## Fetch FUOTA progress bulk

*Request URL:*

```
POST /lorawan/fuota/fetch/bulk
```

*Headers:*

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

*Body*:

<pre><code>{
<strong>    "serial_numbers":["5XJ267721HBLP","XJPC327253WXM"]
</strong>}
</code></pre>

*Response:*

```
{
    "_embedded": {
        "lorawan": [
            {
                "status": "updating",
                "updatingToVersion": "4.2",
                "currentVersion": 41,
                "lastPacketTime": "2024-02-06T14:16:13.880127039Z",
                "progress": 1,
                "region": 0,
                "serial_number": "5XJ267721HBLP",
                "_links": {
                    "self": {
                        "href": "/v1/lorawan/fuota/fetch/bulk"
                    }
                }
            },
            {
                "status": "updating",
                "updatingToVersion": "4.2",
                "currentVersion": 41,
                "lastPacketTime": "2024-02-06T14:12:13.880127039Z",
                "progress": 16,
                "region": 0,
                "serial_number": "XJPC327253WXM",
                "_links": {
                    "self": {
                        "href": "/v1/lorawan/fuota/fetch/bulk"
                    }
                }
            }
        ]
    },
    "total": 2,
    "_links": {
        "self": {
            "href": "/v1/lorawan/fuota/fetch/bulk"
        }
    }
}
```

## Stop FUOTA progress bulk

*Request URL:*

```
POST /lorawan/fuota/stop
```

*Headers:*

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

*Body*:

```
{
    "serial_numbers":["5XJ267721HBLP"]
}
```

*Response:*

```
{
    "_embedded": {
        "lorawan": [
            {
                "status": "stopped",
                "stoppedTime": "2024-02-06 16:18:26",
                "currentVersion": 42,
                "serial_number": "5XJ267721HBLP",
                "_links": {
                    "self": {
                        "href": "/v1/lorawan/fuota/stop"
                    }
                }
            }
        ]
    },
    "total": 1,
    "_links": {
        "self": {
            "href": "/v1/lorawan/fuota/stop"
        }
    }
}
```


---

# 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://docs.mclimate.eu/mclimate-api-documentation/functions/lorawan-fuota.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.
