Skip to main content

Delete device

Deletes a device of the owner by DevEUI or DevAddr. The device is marked as deleted: get_devices_req and update_device_req no longer find it, and its DevEUI and DevAddr can be taken by a new device.

Request and response: delete_device_req → delete_device_resp.
Access: high access level token only; any device of the owner can be deleted. With a low access level token the server responds with error 1.

Current ONS version

The request schema in the v0.17 description names the command delete_device, but the server accepts only delete_device_req, as in the example.

Request​

Fields not marked as required may be omitted.

FieldTypeDescription
cmdstringdelete_device_req
operation_idstringAny string; the server returns it in the response to match the request and the response
devEuistringdevEui or devAddr is required. Device DevEUI, 16 hex characters in upper case — the server compares case-sensitively
devAddrstringdevEui or devAddr is required. Device DevAddr, 8 hex characters in upper case. If both fields are given, both must match
{
"cmd": "delete_device_req",
"operation_id": "rdk",
"devEui": "7DA50BE8C74CE6DC"
}

Response​

FieldTypeDescription
cmdstringdelete_device_resp
operation_idstringValue from the request
statusuint81 — the device is deleted, 2 — error
error_code, error_textuint8, stringOnly on error, see below
{
"cmd": "delete_device_resp",
"operation_id": "rdk",
"status": 1
}

Errors​

error_codeerror_textWhat happened
1Unauthorized accessThe request came with a low access level token
2Required field is not filledNeither devEui nor devAddr is given
3Node does not existsThe device is not found: the owner has no such device, it is already deleted, its application is deleted, or the DevEUI was passed in lower case

Good to know​

  • Retrying is safe. The server responds to a repeated request with error 3: the device is already deleted.
  • The network server is not told about the deletion. It may keep serving a device that is currently on the air, using the settings from its memory.

See also​