---
description: >-
  The device API is used for updating device information registered with our IoT
  identity provider.
---

# Device API

## Update Device Public Key Endpoint

Use this endpoint to update the public key of a registered device. To ensure that only a genuine device can update its public key, the device has to authenticate by providing a private key JWT. Furthermore the device has to provide a proof of possession (PoP) object to demonstrate possession of the private key corresponding to the public key it tries to update.

{% hint style="info" %}
For additional details about the JWT and the PoP object visit our [developer guide](https://iothentix.gitbook.io/developer-guide/json-web-token-jwt/update-public-key-jwt).
{% endhint %}

## Renew public key

<mark style="color:green;">`POST`</mark> `coaps://iot-idp.demo.coap-apps.iothentix.io/device/update/pubkey`

#### Request Body

| Name                                             | Type   | Description                               |
| ------------------------------------------------ | ------ | ----------------------------------------- |
| pop<mark style="color:red;">\*</mark>            | String | Proof of Possession object                |
| client\_secret<mark style="color:red;">\*</mark> | String | Signed JWT containing the new public key. |

{% tabs %}
{% tab title="400: Bad Request The request format was incorrect." %}

{% endtab %}

{% tab title="403: Forbidden The private key JWT was invalid." %}

{% endtab %}

{% tab title="500: Internal Server Error Internal error in the IdP infrastructure. " %}

{% endtab %}

{% tab title="201: Created Successful update of the registered public key" %}
```json
{
    "Success": "Public key updated"
}
```
{% endtab %}

{% tab title="405: Method Not Allowed The requested method is not allowed for this resource." %}

{% endtab %}
{% endtabs %}
