Using the Device API
1
Create an API Token
Create an API token using your client credentials to securely access the API.
2
Bind or Unbind a Device
A recording’s ownership is inherited from the user account that owns the device.
Therefore, you must bind a device to a user before uploading any recordings.
- Bind Device
- Unbind Device
Bind a device to a user account. If the device has no association with any account, this API will return a
device_id, an unique identifier under current App.3
Get Device Information
After binding a device, you can use its
device_id to fetch its status and health metrics.4
Execute the Code
To run the full workflow, you can combine the Python snippets into a single script. Create a file named Then, run it from your terminal:You should see
example.py:device_id and health information printed to the console.Monitoring Metrics
When you fetch device information, you can monitor the following metrics.| Metric | Description | Alert Threshold |
|---|---|---|
| Battery Level | Device battery percentage | < 20% |
| Storage Usage | Used storage percentage | > 90% |
| WiFi Signal | WiFi signal strength (dBm) | < -70 dBm |
| Last Update | Time since last status update | > 24 hours |
| Binding Status | Whether device is bound to user | Unbound devices |
Common Error Scenarios
| Operation | Error Code | Cause |
|---|---|---|
| Binding | Device Already Bound | If the device is already bound to another user, you’ll receive a 400 error with detail DEVICE_BOUND |
| Unbinding | Device Not Found | When unbinding, if the device isn’t found, you’ll receive a 400 error with detail DEVICE_NOT_FOUND |
| Monitoring | Device Not Found | If the device doesn’t exist in the system, returns 404 |
| Monitoring | Invalid Status Data | If the status update is malformed, returns 422 validation error |
| Monitoring | Rate Limit Exceeded | If too many status updates are sent, returns 429 |