Get a list of users created after a particular date

Problem statement

  • We need a list of users who were created after a particular date for reporting purposes

Solution

There are two ways to go about this:

  1. List users with Management API Get Users endpoint

You can search for users using the GET /api/v2/users Management API endpoint with a filter. Here is an example:

https://example.auth0.com/api/v2/users?q=created_at:[2023-07-10T00:00:00.000Z TO 2023-07-18T00:00:00.000Z}

One limitation here is that this endpoint can return only up to 1000 users.

  1. Perform a bulk user export and filter the users

This method has the advantage that there is no 1000 user limit. The steps are:

  1. Perform a bulk user export via Management API or User Import-Export extension.
  2. Download and unzip the export file.
  3. Use a script or shell command to filter the users with the property you need.

Here is an example one-liner to get users created after a certain date:

cat example.json | jq -s '.' | jq '[.[] | select(.created_at > "2023-07-12T00:00:00.000Z")]'

In the above example, example.json is the export file, and it assumes you have the jq tool installed.