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 http(s)://THINGSBOARD_HOST/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
curl -s -X POST -H "Content-Type: application/json" -d '{"deviceName":"DEVICE_NAME","provisionDeviceKey":"PUT_PROVISION_KEY_HERE","provisionDeviceSecret":"PUT_PROVISION_SECRET_HERE"}' "http://$THINGSBOARD_HOST/api/v1/provision"

Response:

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

Use credentialsValue as the access token for subsequent HTTP 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
curl -s -X POST -H "Content-Type: application/json" -d '{"deviceName":"DEVICE_NAME","provisionDeviceKey":"PUT_PROVISION_KEY_HERE","provisionDeviceSecret":"PUT_PROVISION_SECRET_HERE","credentialsType":"ACCESS_TOKEN","token":"DEVICE_ACCESS_TOKEN"}' "http://$THINGSBOARD_HOST/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.