Getting only currently-deployed services via the API

Hi everyone,

When I call the /v5/service_install?$filter=device%20eq%20’<device_id>’ API, I get a list of all the services that have ever run on the device. I would like to get a list of all the services that are currently deployed on the device in the current app version. How can I do that?

A way to achieve this is by starting from the service resource and filter based on the images that the target device has running image installs for.
If you are using the node balena-sdk you can achieve that by doing something like:

await sdk.pine.get({
	resource: 'service',
	options: {
        $filter: {
            is_built_by__image: {
                image_install: {
                    $any: {
                        $alias: 'ii',
                        $expr: {
                            ii: {
                                device: targetDeviceId,
                                status: 'Running',

In case that you prefer a plain API query, the equivalent one would be:

/v5/service?$filter=is_built_by__image/image_install/any(ii:(ii/device eq 1709675) and (ii/status eq 'Running'))

Let us know whether that fits the needs of your use case.

Kind regards,

Thank you very much @thgreasi, that fit the bill perfectly!