How To Obtain Session Details For All Users

Overview

This article provides a method for obtaining session details, such as the session_id, for all users within a tenant. As a bulk export option is not available, these steps outline how to use the Auth0 Management API to retrieve the data on a per-user basis.

Applies To

  • Sessions
  • Management API

Solution

To obtain session history for all users, a list of all users must first be retrieved. Then, a subsequent request can be made for each user to get their corresponding session details.

  1. Obtain a list of all users by making a request to the Get Users endpoint.
  2. For each userId returned in the list, make a request to the GET /api/v2/users/{userId}/sessions endpoint to list the session details of a user.

NOTE: Auth0 services have built-in rate limiting to protect the platform. The Management API imposes rate limits that must be considered when scripting these calls. For enterprise public cloud tenants, the limit is typically 16 Requests Per Second (RPS), which is shared across all Management API endpoints for the tenant. To avoid being rate-limited, it is important to stay within these limits. More information on specific rate limits is available in the Rate Limit Policy.

When making requests to the Management API, the following rate limit control headers are included in the response. These headers can be used to manage requests programmatically:

  • x-ratelimit-limit: The maximum number of requests available in the current time frame.
  • x-ratelimit-remaining: The number of remaining requests in the current time frame.
  • x-ratelimit-reset: A UNIX timestamp of the expected time when the rate limit will reset.