Improve this doc
Detailed information for resources

balenaCloud API Resources

Note: We recently renamed applications to fleets and are in the process of updating our API resources. Application resources continue to function correctly and can be used to work with fleets. Find out more about the changes here.

Available fields

id
created_at
service_install
value
name

Examples

Get all service variables for a device by UUID

curl -X GET \
"https://api.balena-cloud.com/v7/device_service_environment_variable?\$filter=service_install/any(si:si/device/any(d:d/uuid%20eq%20'<DEVICE_UUID>'))" \
-H  "Content-Type: application/json"  \
-H "Authorization: Bearer <AUTH_TOKEN>" 

Get all service variables for a device by UUID, including the service name

curl -X GET \
"https://api.balena-cloud.com/v7/device_service_environment_variable?\$filter=service_install/any(si:si/device/any(d:d/uuid%20eq%20'<DEVICE_UUID>'))&\$expand=service_install(\$expand=installs__service(\$select=id,service_name))" \
-H  "Content-Type: application/json"  \
-H "Authorization: Bearer <AUTH_TOKEN>" 

Get all service variables for a device by ID

curl -X GET \
"https://api.balena-cloud.com/v7/device_service_environment_variable?\$filter=service_install/device%20eq%20<DEVICE ID>" \
-H  "Content-Type: application/json"  \
-H "Authorization: Bearer <AUTH_TOKEN>" 

Create a device service variable

curl -X POST \
"https://api.balena-cloud.com/v7/device_service_environment_variable" \
-H  "Content-Type: application/json"  \
-H "Authorization: Bearer <AUTH_TOKEN>" \
--data '{
    "service_install": "<SERVICE INSTALL ID>",
    "name": "<NAME>",
    "value": "<VALUE>"
}'

Update a device service variable

curl -X PATCH \
"https://api.balena-cloud.com/v7/device_service_environment_variable(<ID>)" \
-H  "Content-Type: application/json"  \
-H "Authorization: Bearer <AUTH_TOKEN>" \
--data '{
    "value": "<NEW VALUE>"
}'

Remove a device service variable

curl -X DELETE \
"https://api.balena-cloud.com/v7/device_service_environment_variable(<ID>)" \
-H  "Content-Type: application/json"  \
-H "Authorization: Bearer <AUTH_TOKEN>"