The GET /api/v2/users endpoint allows you to retrieve a list of users. Using this endpoint, you can:
  • Search based on a variety of criteria
  • Select the fields to be returned
  • Sort the returned results
This endpoint is eventually consistent, and as such, we recommend that you use this endpoint for back office processes such as changing the display name of an existing user.

Request example

To search for users, make a GET request to the /api/v2/users endpoint. The request must include a Management API access token. Pass your search query to the q parameter and set the search_engine parameter to v3. For example, to search for a user whose email is exactly jane@exampleco.com, use q=email:"jane@exampleco.com":
curl --request GET \
  --url 'https://{yourDomain}/api/v2/users?q=email%3A%22jane%40exampleco.com%22&search_engine=v3' \
  --header 'authorization: Bearer {yourMgmtApiAccessToken}'
If successful, you’ll receive a response like this:
[
  {
    "email": "jane@exampleco.com",
    "email_verified": false,
    "username": "janedoe",
    "phone_number": "+199999999999999",
    "phone_verified": false,
    "user_id": "auth0|5457edea1b8f22891a000004",
    "created_at": "",
    "updated_at": "",
    "identities": [
      {
        "connection": "Initial-Connection",
        "user_id": "5457edea1b8f22891a000004",
        "provider": "auth0",
        "isSocial": false
      }
    ],
    "app_metadata": {},
    "user_metadata": {},
    "picture": "",
    "name": "",
    "nickname": "",
    "multifactor": [
      ""
    ],
    "last_ip": "",
    "last_login": "",
    "logins_count": 0,
    "blocked": false,
    "given_name": "",
    "family_name": ""
  }
]

Query examples

Below are some examples of the kinds of queries you can make with the .
Use caseQuery
Search for all users whose name contains “john”name:*john*
Search all users whose name is exactly “jane”name:“jane”
Search for all user names starting with “john”name:john*
Search for user names that start with “jane” and end with “smith”name:jane*smith
Search for all users whose email is exactly “john@exampleco.comemail:“john@exampleco.com
Search for all users whose email is exactly “john@exampleco.com” or “jane@exampleco.com” using ORemail:(“john@exampleco.com” OR “jane@exampleco.com”)
Search for users without verified emailemail_verified:false OR NOT exists:email_verified
Search for users who have the user_metadata field named full_name with the value of “John Smith”user_metadata.full_name:“John Smith”
Search for users from a specific connectionidentities.connection:“google-oauth2”
Search for all users that have never logged in(NOT exists:logins_count OR logins_count:0)
Search for all users who logged in before 2018last_login:[* TO 2017-12-31]
Search for all users whose last login was in December 2017last_login:[2017-11 TO 2017-12], last_login:[2017-12-01 TO 2017-12-31]
Search for all users with logins count >= 100 and <= 200logins_count:[100 TO 200]
Search for all users with logins count >= 100logins_count:[100 TO *]
Search for all users with logins count > 100 and < 200logins_count:{100 TO 200}
Search for all users whose email domain is “exampleco.com”email.domain:“exampleco.com”

Limitations

  • The endpoint returns a maximum of 50 users, even if more users match your query.
  • If you need to return more than 50 users, use the page parameter to show more pages of results. Each page contains 50 users. For example, you can specify &page=2 to show results 51-100, specify &page=3 to show results 101-150, and so on. However, this endpoint never returns a total of more than 1000 users with the same search criteria, even with paging.
  • There is a 1 MB per-user limit on user data that can be indexed, queried, and returned by the user search endpoint. For more information on how this affects custom metadata larger than 1MB, see Metadata Field Names and Data Types. The get user endpoint must be used to retrieve all user attributes for oversized user profiles.
  • By default, the GET /api/v2/users endpoint returns results in a deterministic order so the same query yields the same logically ordered results each time. This behavior is controlled by the primary_order query parameter:
    • primary_order=true (default): results across identical queries are consistently ordered.
    • primary_order=false: results are returned in a non-deterministic order, which can enhance performance for complex queries.
  • If your application does not require consistent ordering of search results and your queries are short enough not to rely on pagination, set primary_order=false to improve query performance.
  • If you need a complete export of all of your users, use the export job or the User Import / Export extension.
  • If you get the error 414 Request-URI Too Large this means that your query string is larger than the supported length. In this case, refine your search.
We do not recommend that you use this endpoint for:

Learn more