How to Generate a Bulk Users Export CSV File From the Management API?

Problem statement:

Bulk export user details in CSV format using the Auth0 Management API UI and from Postman.

Solution:

  1. Get the connection_id and domain of the tenant from the Auth0 dashboard
  2. Put them in the body script. Here is a short sample.
{
"connection_id": "connection_id",
"format": "csv",
"limit": 20,
"fields": [{
"name": "user_id"
},
{
"name": "email"
},
{
"name": "user_metadata.country"
} ]
}
  1. Open Auth0 Management API https://auth0.com/docs/api/management/v2 UI or Postman
  2. Get the bear token from Auth0 Dashboard and add them to the Auth0 Management API
  3. Create a Post request with the /api/v2/jobs/users-exports endpoint.
  4. Add the scripts in step 2 to the body and click on Try or Send.
  5. Get the job id from the response
  6. Create a Get request with the /api/v2/jobs/{id} endpoint and click on Try or Send
  7. In the response, the location parameter has the link to the export file.
  8. Click on the link to download the {tenant}.csv.gz file
  9. Unzip the file to get the export csv file.

Note:

  1. If user export is slow for some reason, try restarting the request. Most likely it will go through fine.

Recording:

3 Likes