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:
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.