Skip to content
Try for free

ThingsBoard Cloud

Choose your data region

Your data stays in the region you choose, for residency and compliance. No credit card required.

Rather run it yourself? Install on your own servers

Provisioning

Device Provisioning lets devices register themselves dynamically without being created manually in the ThingsBoard UI. For a full explanation, see Provisioning.

All provisioning requests are sent to a single endpoint — no access token is required:

POST coap://THINGSBOARD_HOST:5683/api/v1/provision

The request body identifies the device and the provisioning profile configured in ThingsBoard.

ThingsBoard generates and returns an access token for the new device.

Request:

{
"deviceName": "DEVICE_NAME",
"provisionDeviceKey": "PUT_PROVISION_KEY_HERE",
"provisionDeviceSecret": "PUT_PROVISION_SECRET_HERE"
}
Terminal window
coap-client -v 6 -m POST -t "application/json" -e '{"deviceName":"DEVICE_NAME","provisionDeviceKey":"PUT_PROVISION_KEY_HERE","provisionDeviceSecret":"PUT_PROVISION_SECRET_HERE"}' "coap://$THINGSBOARD_HOST:5683/api/v1/provision"

Response:

{
"status": "SUCCESS",
"credentialsType": "ACCESS_TOKEN",
"credentialsValue": "sLzc0gDAZPkGMzFVTyUY"
}

Use credentialsValue as the access token for subsequent CoAP API requests.

The device specifies its own access token during provisioning. ThingsBoard creates the device with the provided token.

Request:

{
"deviceName": "DEVICE_NAME",
"provisionDeviceKey": "PUT_PROVISION_KEY_HERE",
"provisionDeviceSecret": "PUT_PROVISION_SECRET_HERE",
"credentialsType": "ACCESS_TOKEN",
"token": "DEVICE_ACCESS_TOKEN"
}
Terminal window
coap-client -v 6 -m POST -t "application/json" -e '{"deviceName":"DEVICE_NAME","provisionDeviceKey":"PUT_PROVISION_KEY_HERE","provisionDeviceSecret":"PUT_PROVISION_SECRET_HERE","credentialsType":"ACCESS_TOKEN","token":"DEVICE_ACCESS_TOKEN"}' "coap://$THINGSBOARD_HOST:5683/api/v1/provision"

Response:

{
"status": "SUCCESS",
"credentialsType": "ACCESS_TOKEN",
"credentialsValue": "DEVICE_ACCESS_TOKEN"
}
Field Required Description
deviceName No Name of the device to create. A name is auto-generated if omitted.
provisionDeviceKey Yes Provisioning key from the device profile in ThingsBoard.
provisionDeviceSecret Yes Provisioning secret associated with the key.
credentialsType No Set to ACCESS_TOKEN to specify a custom token.
token No The access token to assign when credentialsType is ACCESS_TOKEN.