You can use RisPort70, which is part of the Serviceability API. Here's a link to the API.
https://developer.cisco.com/docs/sxml/#!risport70-api-reference/risport70-api-reference
You want to use selectCmDevice (or selectCmDeviceExt, which queries across all nodes) to perform a search that returns the information you want.
You can approach this a number of ways. You can identify the device and specify Status as "Any", in which case it will return information about your specific device and tell you whether or not the device is registered. Or you can use a wildcard to look at all devices and specify "Registered" as the Status. Then you'll get a list of registered devices and see if your device appears in that list. Or combine the search criteria any other way to get your desired result.