Yes, the User API's can do this, but an easier way would be to use the CLI (Platform API CLI (genesys.cloud)) and run this command:
gc users list --autopaginate | jq -r ".[] | [.name, .id] | @csv" > output.csv
To get it by a queue, you need to use the routing API/CLI and put in the queue GUID.
gc routing queues members list {QUEUEID} --autopaginate | jq -r ".[] | [.name, .id] | @csv" > output.csv