Claiming
Device claiming lets an end user securely associate a device with their account after it is already deployed and connected. See Claiming for the full workflow — this page covers only the MQTT transport step where the device publishes the claiming request.
Publish a Claim Request
Section titled “Publish a Claim Request”| Format | Topic |
|---|---|
| Short | v2/c |
| Standard | v1/devices/me/claim |
Both fields are optional:
| Field | Description | Default |
|---|---|---|
secretKey | Secret the user must supply to complete the claim. | Empty string |
durationMs | Time window in milliseconds during which the claim can be completed. | SECURITY_CLAIM_DURATION server setting |
Payload:
{"secretKey": "mySecret", "durationMs": 60000}When the device profile payload type is set to Protobuf, or when using the short Protobuf topic (v2/c/p), encode the payload with this schema. This schema is fixed and cannot be customized in the device profile.
syntax = "proto3";
message ClaimDevice { string secretKey = 1; int64 durationMs = 2;}Publishing to this topic initiates the claiming workflow. ThingsBoard marks the device as claimable and waits for a user to complete the claim (via the dashboard Claim Device widget or the REST API) within the specified duration.
Example
Section titled “Example”mosquitto_pub -d -q 1 -h "$THINGSBOARD_HOST" -p 1883 -t "v2/c" -u "$ACCESS_TOKEN" -m '{"secretKey": "mySecret", "durationMs": 60000}'