API query of DEP assigned serial numbers

Valued Contributor

I’m wondering if there is any way via the API to read all the computer serial numbers that are DEP assigned in our JSS? I don’t care about the enrollment status, that's an existing search criteria.

I want to create an EA script that will compare the current machine serial number to the list of DEP assigned serials in the JSS, the result of that will give me search criteria of assigned or un-assigned.