...
To delete a device bound to a gateway, you first unbind the device from all gateways it's bound to, then delete it from the registry.
Console
Unbind the device from every gateway it's bound to.
In the Device details page, click Delete.
API
After unbinding the device from all gateways it's bound to, use the device delete method to delete the device.
...
To delete a gateway, you first unbind its devices and then delete the gateway from the registry.
Console
Go back to the Gateway details page and click Delete.
API
After unbinding all devices from the gateway, use the device delete method to delete the gateway, specifying the gateway’s ID you want to delete.
...