It is, by creating segment with REST api. Or by creating a filter with BULK api.
Creating an segment: uri = "/assets/contact/segment";
Create JSON Body with segment criteria etc.
Don't forget to refresh the segment after creation: uri = "/assets/contact/segment/queue/" + segment.id;
Use method post for segment creation and then get to retrieve contacts from segment.