How to register devices
Add devices to an enrollment group, individually or in bulk, so they can bootstrap and be activated.
Prerequisites
- An enrollment group id — see How to create an enrollment group
- A JWT access token with onboarding management permissions
export API="https://api.example.com/api"
export TOKEN="YOUR_ACCESS_TOKEN"
export GROUP_ID="YOUR_ENROLLMENT_GROUP_ID"
Steps
Register one device
curl -X POST "$API/devices/register" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"deviceId": "temp-sensor-001",
"enrollmentGroupId": "'"$GROUP_ID"'",
"metadata": { "hwRev": "C", "batch": "2026-08" }
}'
The response shape depends on the group's attestation type:
{
"deviceId": "temp-sensor-001",
"attestationType": "sharedKey",
"enrollmentGroupId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"secret": "THE_DEVICE_SECRET"
}
secret is returned once, at registration. Capture it — it is the credential the device presents
to GET /get_settings. Certificate groups return certificate and privateKey instead.
Register many devices
The bulk endpoint takes newline-delimited JSON — one registration object per line, not a JSON array:
curl -X POST "$API/devices/register/bulk" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/x-ndjson" \
--data-binary '{"deviceId":"temp-sensor-001","enrollmentGroupId":"'"$GROUP_ID"'"}
{"deviceId":"temp-sensor-002","enrollmentGroupId":"'"$GROUP_ID"'"}
{"deviceId":"temp-sensor-003","enrollmentGroupId":"'"$GROUP_ID"'"}'
The response reports per-line outcomes:
{
"requestId": "0198f3f2-1a2b-7c3d-9e4f-5a6b7c8d9e0f",
"summary": { "total": 3, "created": 3, "failed": 0, "skipped": 0 },
"results": [
{ "line": 1, "deviceId": "temp-sensor-001", "status": "created",
"credentials": { "secret": "THE_DEVICE_SECRET" } }
]
}
A failure on one line does not abort the batch — it appears as an error entry in results. Only
batch-level failures (empty body, oversized batch) return 400.
Each device's secret appears only in this response and cannot be retrieved afterward. Persist
the whole response before doing anything else.
Verify it worked
curl -s "$API/enrollment-groups/$GROUP_ID/devices?limit=50" \
-H "Authorization: Bearer $TOKEN" | jq '.items[].deviceId'
A newly registered device is in state registered: known to onboarding, with no provider client
yet. Activation is a separate step — see How to run a workflow.
Variations
Inspect one device. GET /api/devices/{deviceId} returns its state, enrollment group, and
lastActivationFailure if a run failed against it.
Remove a device from a group. DELETE /api/enrollment-groups/{groupId}/devices/{deviceId}.
Soft delete and restore. DELETE /api/devices/{deviceId} soft-deletes;
POST /api/devices/{deviceId}/restore reverses it. Bulk equivalents exist at
/api/devices/bulk-delete and /api/devices/bulk-restore.
If it doesn't work
409 device_already_registered — the device id exists. Fetch it with
GET /api/devices/{deviceId} to see which group holds it.
409 shared_key_not_provisioned — the group has no shared key yet. Generate one first, see
How to rotate shared keys.
404 enrollment_group_not_found — the group id is wrong or the group was deleted.
400 metadata_too_large — trim the metadata object.
See also
- Onboarding Management API — full schemas
- How to run a workflow — activating a registered device