[API] Check All Devices Health in Batch


Currently, I can’t find any API that can return List of Devices with its Online/Offline Status. We need to specify Device ID which means if I has 50 Devices, I will need to make 50 API Call to get all Devices Status. Is there a way to get it in 1 API Call? If not, does SmartThings considering to implement this in the future?

The Pros are:

  • Reduce the Load of SmartThings Server.
  • Improve the Total Time of All Devices Status Retrieval for Client.

Thanks in advance.

Best Regards,

Yes, there is, and you can have the device health thrown in too. I’d tell you how but the easiest thing is to install the CLI and, in Windows CMD speak:

smartthings devices --status --health -y

Then see how they do it. Reading the Core SDK code also works.

Hi Graham,

Just realized we have the health action, yeah but that still per device call. Just wondering if we can just send a Location ID using API to do health check to all devices in 1 location, that will be very handy.

That example was the CLI downloading a listing of all the devices for all your Locations, with each device including some extra info, device health, and attribute status. All done with just one call in most cases.

The API pages output so if you have more than 200 (?) devices it shows you how to get the second page.

You can filter by locationId and type and other things if you wish. The debug line makes the CLI show you how it is done.

How is the API calls different than this? I know this get one devices health but a batch would be very helpful.


I tried neither worked.



The easiest way to figure things out is to get the CLI to do something sensible and then see what it is doing. You can’t get just the device health for all the devices but you can get it added to the device listing. Same with the device status.

So if you tried smartthings devices --status --health in debug mode you would discover that the URL is simply https://api.smartthings.com/devices but it takes a query string which in this case is ?includeStatus=true&includeHealth=true.

Try that on version 1 of the API and it won’t show the health or the status. The Core SDK doesn’t use that for the Devices API though. It uses 20170916. So change the accept header to application/vnd.smartthings+json;v=20170916 for this request and bingo.

There is nothing secret about it. Any SmartApp based on the Core SDK would use it automatically. It’s just an alternate version of the API that does things slightly differently in this particular area. It may, or may not, do anything different with other endpoints. It may not even work at all with other endpoints. It has lots of friends, only one of which I have ever used because it was documented on this forum. There is a price to pay for using it though, you have to be vigilant. It is hard to see how the functionality could ever reasonably be withdrawn when it is in the primary SDK but it might be done differently.

Silly question, is there any more data available to be pulled down using that same structure in the API?

Not that I’ve seen anywhere. Most options are about filtering the list. There is an intriguing option for including ‘restricted’ devices in the listing (subject to permission) but I’ve no idea what that refers to.

Sometimes you see more information when you access things individually but I don’t think that happens with devices.