# Device

## Get all devices

> \## Device Resource Fields\
> \
> \| Field |\
> \| :--- |\
> \| \`id\` |\
> \| \`belongs\_to\_\_application\` |\
> \| \`belongs\_to\_\_user\` |\
> \| \`actor\` |\
> \| \`device\_name\` |\
> \| \`is\_of\_\_device\_type\` |\
> \| \`uuid\` |\
> \| \`is\_running\_\_release\` |\
> \| \`is\_pinned\_on\_\_release\` |\
> \| \`should\_be\_running\_\_release\` |\
> \| \`note\` |\
> \| \`local\_id\` |\
> \| \`status\` |\
> \| \`overall\_status\` |\
> \| \`is\_online\` |\
> \| \`last\_connectivity\_event\` |\
> \| \`is\_connected\_to\_vpn\` |\
> \| \`last\_vpn\_event\` |\
> \| \`ip\_address\` |\
> \| \`mac\_address\` |\
> \| \`public\_address\` |\
> \| \`os\_version\` |\
> \| \`os\_variant\` |\
> \| \`supervisor\_version\` |\
> \| \`should\_be\_managed\_by\_\_release\` |\
> \| \`is\_managed\_by\_\_service\_instance\` |\
> \| \`provisioning\_progress\` |\
> \| \`provisioning\_state\` |\
> \| \`download\_progress\` |\
> \| \`is\_web\_accessible\` |\
> \| \`longitude\` |\
> \| \`latitude\` |\
> \| \`location\` |\
> \| \`custom\_longitude\` |\
> \| \`custom\_latitude\` |\
> \| \`is\_locked\_until\_\_date\` |\
> \| \`is\_accessible\_by\_support\_until\_\_date\` |\
> \| \`created\_at\` |\
> \| \`is\_active\` |\
> \| \`api\_heartbeat\_state\` |\
> \| \`memory\_usage\` |\
> \| \`memory\_total\` |\
> \| \`storage\_block\_device\` |\
> \| \`storage\_usage\` |\
> \| \`storage\_total\` |\
> \| \`cpu\_temp\` |\
> \| \`cpu\_usage\` |\
> \| \`cpu\_id\` |\
> \| \`is\_undervolted\` |\
> \
> \
> \---\
> \
> \`GET /v7/device\`\
> \
> \
> \### Usage Variations\
> \
> \--- \
> \#### Get all devices by fleet\
> \`GET /v7/device?$filter=belongs\_to\_\_application eq '\<FLEET ID>'\`\
> \
> \--- \
> \#### Get multiple devices by UUID\
> \`GET /v7/device?$filter=uuid in ('\<UUID1>','\<UUID2>','\<UUID3>')\`

```json
{"openapi":"3.0.0","info":{"title":"Balena API Spec","version":"7.0.0"},"servers":[{"url":"https://api.balena-cloud.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/v7/device":{"get":{"tags":["Device"],"summary":"Get all devices","description":"## Device Resource Fields\n\n| Field |\n| :--- |\n| `id` |\n| `belongs_to__application` |\n| `belongs_to__user` |\n| `actor` |\n| `device_name` |\n| `is_of__device_type` |\n| `uuid` |\n| `is_running__release` |\n| `is_pinned_on__release` |\n| `should_be_running__release` |\n| `note` |\n| `local_id` |\n| `status` |\n| `overall_status` |\n| `is_online` |\n| `last_connectivity_event` |\n| `is_connected_to_vpn` |\n| `last_vpn_event` |\n| `ip_address` |\n| `mac_address` |\n| `public_address` |\n| `os_version` |\n| `os_variant` |\n| `supervisor_version` |\n| `should_be_managed_by__release` |\n| `is_managed_by__service_instance` |\n| `provisioning_progress` |\n| `provisioning_state` |\n| `download_progress` |\n| `is_web_accessible` |\n| `longitude` |\n| `latitude` |\n| `location` |\n| `custom_longitude` |\n| `custom_latitude` |\n| `is_locked_until__date` |\n| `is_accessible_by_support_until__date` |\n| `created_at` |\n| `is_active` |\n| `api_heartbeat_state` |\n| `memory_usage` |\n| `memory_total` |\n| `storage_block_device` |\n| `storage_usage` |\n| `storage_total` |\n| `cpu_temp` |\n| `cpu_usage` |\n| `cpu_id` |\n| `is_undervolted` |\n\n\n---\n\n`GET /v7/device`\n\n\n### Usage Variations\n\n--- \n#### Get all devices by fleet\n`GET /v7/device?$filter=belongs_to__application eq '<FLEET ID>'`\n\n--- \n#### Get multiple devices by UUID\n`GET /v7/device?$filter=uuid in ('<UUID1>','<UUID2>','<UUID3>')`"}}}}
```

## Get device by ID

> \`GET /v7/device(\<ID>)\`\
> \
> \
> \### Usage Variations\
> \
> \--- \
> \#### Get the device overall\_status field\
> \`GET /v7/device(\<ID>)?$select=overall\_status\`\
> \
> The overall\_status field is returned only when explicitly requested with $select.\
> \
> \--- \
> \#### Get the release currently running on a device\
> \`GET /v7/device(\<ID>)?$select=is\_running\_\_release\`\
> \
> \--- \
> \#### Get the release a device is pinned to\
> \`GET /v7/device(\<ID>)?$select=is\_pinned\_on\_\_release\`\
> \
> Note: is\_pinned\_on\_\_release will be null/not set if the device isn't pinned to any release, in which case the device will be tracking the release of the application it belongs to.

```json
{"openapi":"3.0.0","info":{"title":"Balena API Spec","version":"7.0.0"},"servers":[{"url":"https://api.balena-cloud.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/v7/device({ID})":{"get":{"tags":["Device"],"summary":"Get device by ID","description":"`GET /v7/device(<ID>)`\n\n\n### Usage Variations\n\n--- \n#### Get the device overall_status field\n`GET /v7/device(<ID>)?$select=overall_status`\n\nThe overall_status field is returned only when explicitly requested with $select.\n\n--- \n#### Get the release currently running on a device\n`GET /v7/device(<ID>)?$select=is_running__release`\n\n--- \n#### Get the release a device is pinned to\n`GET /v7/device(<ID>)?$select=is_pinned_on__release`\n\nNote: is_pinned_on__release will be null/not set if the device isn't pinned to any release, in which case the device will be tracking the release of the application it belongs to.","parameters":[{"name":"ID","in":"path","required":true}]}}}}
```

## Delete device

> \`DELETE /v7/device(\<ID>)\`

```json
{"openapi":"3.0.0","info":{"title":"Balena API Spec","version":"7.0.0"},"servers":[{"url":"https://api.balena-cloud.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/v7/device({ID})":{"delete":{"tags":["Device"],"summary":"Delete device","description":"`DELETE /v7/device(<ID>)`","parameters":[{"name":"ID","in":"path","required":true}]}}}}
```

## Pin device to a specific release by ID

> \`PATCH /v7/device(\<ID>)\`\
> \
> \*\*Request Body:\*\*\
> \`\`\`json\
> {\
> &#x20;   "is\_pinned\_on\_\_release": \<RELEASE ID>\
> }\
> \`\`\`\
> \
> \
> \### Usage Variations\
> \
> \--- \
> \#### Rename device\
> \`PATCH /v7/device(\<ID>)\`\
> \
> \*\*Request Body:\*\*\
> \`\`\`json\
> {\
> &#x20;   "device\_name": \<NEW NAME>\
> }\
> \`\`\`\
> \
> \--- \
> \#### Add note to a device\
> \`PATCH /v7/device(\<ID>)\`\
> \
> \*\*Request Body:\*\*\
> \`\`\`json\
> {\
> &#x20;   "note": \<NEW NOTE>\
> }\
> \`\`\`\
> \
> \--- \
> \#### Move device to another fleet\
> \`PATCH /v7/device(\<ID>)\`\
> \
> \*\*Request Body:\*\*\
> \`\`\`json\
> {\
> &#x20;   "belongs\_to\_\_application": \<FLEET ID>\
> }\
> \`\`\`\
> \
> \--- \
> \#### Deactivate an offline device (CHARGEABLE)\
> \`PATCH /v7/device(\<ID>)\`\
> \
> \*\*Request Body:\*\*\
> \`\`\`json\
> {\
> &#x20;   "is\_active": false\
> }\
> \`\`\`

````json
{"openapi":"3.0.0","info":{"title":"Balena API Spec","version":"7.0.0"},"servers":[{"url":"https://api.balena-cloud.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/v7/device({ID})":{"patch":{"tags":["Device"],"summary":"Pin device to a specific release by ID","description":"`PATCH /v7/device(<ID>)`\n\n**Request Body:**\n```json\n{\n    \"is_pinned_on__release\": <RELEASE ID>\n}\n```\n\n\n### Usage Variations\n\n--- \n#### Rename device\n`PATCH /v7/device(<ID>)`\n\n**Request Body:**\n```json\n{\n    \"device_name\": <NEW NAME>\n}\n```\n\n--- \n#### Add note to a device\n`PATCH /v7/device(<ID>)`\n\n**Request Body:**\n```json\n{\n    \"note\": <NEW NOTE>\n}\n```\n\n--- \n#### Move device to another fleet\n`PATCH /v7/device(<ID>)`\n\n**Request Body:**\n```json\n{\n    \"belongs_to__application\": <FLEET ID>\n}\n```\n\n--- \n#### Deactivate an offline device (CHARGEABLE)\n`PATCH /v7/device(<ID>)`\n\n**Request Body:**\n```json\n{\n    \"is_active\": false\n}\n```","parameters":[{"name":"ID","in":"path","required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}
````

## Get device by UUID

> \`GET /v7/device(uuid='\<UUID>')\`\
> \
> \
> \### Usage Variations\
> \
> \--- \
> \#### Get the target release of a device\
> \`GET /v7/device(uuid='\<UUID>')?$select=should\_be\_running\_\_release\`\
> \
> This will be the release that the device is pinned to, or the target release of the fleet for non-pinned devices.

```json
{"openapi":"3.0.0","info":{"title":"Balena API Spec","version":"7.0.0"},"servers":[{"url":"https://api.balena-cloud.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/v7/device(uuid='{UUID}')":{"get":{"tags":["Device"],"summary":"Get device by UUID","description":"`GET /v7/device(uuid='<UUID>')`\n\n\n### Usage Variations\n\n--- \n#### Get the target release of a device\n`GET /v7/device(uuid='<UUID>')?$select=should_be_running__release`\n\nThis will be the release that the device is pinned to, or the target release of the fleet for non-pinned devices.","parameters":[{"name":"UUID","in":"path","required":true}]}}}}
```

## Pin device to a specific release by UUID

> \`PATCH /v7/device(uuid='\<UUID>')\`\
> \
> \*\*Request Body:\*\*\
> \`\`\`json\
> {\
> &#x20;   "is\_pinned\_on\_\_release": \<RELEASE ID>\
> }\
> \`\`\`\
> \
> \
> \### Usage Variations\
> \
> \--- \
> \#### Mark a device to be updated to a specific supervisor release\
> \`PATCH /v7/device(uuid='\<UUID>')\`\
> \
> \*\*Request Body:\*\*\
> \`\`\`json\
> {\
> &#x20;   "should\_be\_managed\_by\_\_release": \<SUPERVISOR RELEASE ID>\
> }\
> \`\`\`\
> \
> To request a list of available supervisor versions, check the respective documentation page for the supervisor release resource.

````json
{"openapi":"3.0.0","info":{"title":"Balena API Spec","version":"7.0.0"},"servers":[{"url":"https://api.balena-cloud.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/v7/device(uuid='{UUID}')":{"patch":{"tags":["Device"],"summary":"Pin device to a specific release by UUID","description":"`PATCH /v7/device(uuid='<UUID>')`\n\n**Request Body:**\n```json\n{\n    \"is_pinned_on__release\": <RELEASE ID>\n}\n```\n\n\n### Usage Variations\n\n--- \n#### Mark a device to be updated to a specific supervisor release\n`PATCH /v7/device(uuid='<UUID>')`\n\n**Request Body:**\n```json\n{\n    \"should_be_managed_by__release\": <SUPERVISOR RELEASE ID>\n}\n```\n\nTo request a list of available supervisor versions, check the respective documentation page for the supervisor release resource.","parameters":[{"name":"UUID","in":"path","required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}
````
