For this purpose you can use the following call in for Sandbox:
https://sandbox.piano.io/api/v3/publisher/user/search?api_token=<API_TOKEN>&aid=<AID>&consent_checked=true&selected_consents_map=<CONSENT_ID_1>&selected_consents_map=<CONSENT_ID_2>&consent_has_data=true&registered_from=1507121529&registered_until=1507567408
The available base URLs for Production are listed here.
Here’s a breakdown of the parameters:
api_token - your API token
aid - your application ID
consent_has_data - identifies that the filter for consent fields must be used
consent_checked - identifies that you’re looking for users who checked/unchecked the consents (values true/false)
selected_consents_map - a list of consent_id values for which you’re making a search.
You can find those IDs by making a request to:
https://sandbox.piano.io/api/v3/publisher/consent/list?api_token=<API_TOKEN>&aid=<AID>
Note that they are different from the field_id.
registered_from - timestamp of start criteria for creation date
registered_until - timestamp of end criteria for creation date
You can also use publisher/export/create/userExport with the same parameters.