Get All User Sessions
    • Dark
      Light
    • PDF

    Get All User Sessions

    • Dark
      Light
    • PDF

    Article summary

    Get
    /api/v1/sessions/list.all
    Premium tag

    Retrieve the sessions of all users on the workspace. This endpoint requires 2FA. Permission required: view-device-management

    Changelog

    VersionDescription
    5.0.0Added
    Header parameters
    X-User-Id
    stringRequired

    The user ID.

    ExampleCkCPNctrgCDfmWLqC
    X-Auth-Token
    stringRequired

    The authentication token.

    Example1Dd4iN_ClKn5jl-xPC36snQ4s9Zd5GZnXCQuCNSKcVE
    X-2fa-Code
    stringRequired

    The 2FA code from the authentication method. If the method is password, encrypt it as SHA256.

    X-2fa-method
    stringRequired

    The desired method to get the 2FA code. It can be email, totp, or password.

    Query parameters
    filter
    string

    Filter sessions list using regex.

    Examplewindows
    offset
    integer

    Number of items to "skip" in the query, i.e. requests return count items, skipping the first offset items.

    Example50
    count
    integer

    How many items to return.

    Example50
    sort

    List of fields to order by, and in which direction. This is a JSON object, with properties listed in desired order, with values of 1 for ascending, or -1 for descending. For example, {"value": -1, "_id": 1}

    Responses
    200

    OK

    Success
    {
      "sessions": [
        {
          "sessionId": "o94SveQp6fyPsoiNC",
          "userId": "2tTEqR7ZNMJ4HGGNa",
          "device": {
            "type": "browser",
            "name": "Chrome",
            "longVersion": "113.0.0.0",
            "os": {
              "name": "Windows",
              "version": "10"
            },
            "version": "113.0.0"
          },
          "host": "localhost:3000",
          "ip": "172.20.0.2",
          "loginAt": "2023-05-24T00:25:54.234Z",
          "_user": {
            "username": "testroxie",
            "name": "Test"
          },
          "_id": "o94SveQp6fyPsoiNC"
        },
        {
          "sessionId": "BdSrCZXNKCbRi8Eqn",
          "userId": "rbAXPnMktTFbNpwtJ",
          "device": {
            "type": "browser",
            "name": "Chrome",
            "longVersion": "113.0.0.0",
            "os": {
              "name": "Windows",
              "version": "10"
            },
            "version": "113.0.0"
          },
          "host": "localhost:3000",
          "ip": "172.20.0.2",
          "loginAt": "2023-05-24T00:25:52.246Z",
          "_user": {
            "username": "test.test",
            "name": "test test"
          },
          "_id": "BdSrCZXNKCbRi8Eqn"
        },
        {
          "sessionId": "tTouumJMrHMjnedWf",
          "userId": "GonjPyg3gB3Z9ur9s",
          "device": {
            "type": "browser",
            "name": "Chrome",
            "longVersion": "113.0.0.0",
            "os": {
              "name": "Windows",
              "version": "10"
            },
            "version": "113.0.0"
          },
          "host": "localhost:3000",
          "ip": "172.20.0.2",
          "loginAt": "2023-05-23T19:14:29.865Z",
          "_user": {
            "name": "test",
            "username": "test.test"
          },
          "_id": "tTouumJMrHMjnedWf"
        },
        {
          "sessionId": "7ykYEK3KWnk4EeA7s",
          "userId": "2tTEqR7ZNMJ4HGGNa",
          "device": {
            "type": "browser",
            "name": "Chrome",
            "longVersion": "113.0.0.0",
            "os": {
              "name": "Windows",
              "version": "10"
            },
            "version": "113.0.0"
          },
          "host": "localhost:3000",
          "ip": "172.20.0.2",
          "loginAt": "2023-05-23T19:14:28.717Z",
          "_user": {
            "username": "testroxie",
            "name": "Test"
          },
          "_id": "7ykYEK3KWnk4EeA7s"
        },
        {
          "sessionId": "jfD6mnHnrEJdPq9MF",
          "userId": "stjxrXYBWy3EcDugH",
          "device": {
            "type": "browser",
            "name": "Chrome",
            "longVersion": "113.0.0.0",
            "os": {
              "name": "Windows",
              "version": "10"
            },
            "version": "113.0.0"
          },
          "host": "localhost:3000",
          "ip": "172.20.0.2",
          "loginAt": "2023-05-23T15:21:57.188Z",
          "_user": {
            "username": "rocket.agent",
            "name": "Rocket Agent"
          },
          "_id": "jfD6mnHnrEJdPq9MF"
        },
        {
          "sessionId": "2jQnfG74X3EZYL9tj",
          "userId": "rYhzFRd2QZjNwAAXX",
          "device": {
            "type": "browser",
            "name": "Chrome",
            "longVersion": "113.0.0.0",
            "os": {
              "name": "Windows",
              "version": "10"
            },
            "version": "113.0.0"
          },
          "host": "localhost:3000",
          "ip": "172.20.0.2",
          "loginAt": "2023-05-23T15:19:48.723Z",
          "_user": {
            "name": "Rodriq",
            "username": "rodriq"
          },
          "_id": "2jQnfG74X3EZYL9tj"
        },
        {
          "sessionId": "fsfE772s78AmPxGKk",
          "userId": "uZ5JvvioeHK8Coyqe",
          "device": {
            "type": "browser",
            "name": "Firefox",
            "longVersion": "112.0",
            "os": {
              "name": "Windows",
              "version": "10"
            },
            "version": "112.0"
          },
          "host": "localhost:3000",
          "ip": "172.18.0.4",
          "loginAt": "2023-05-16T20:50:33.608Z",
          "_user": {
            "username": "user-0"
          },
          "_id": "fsfE772s78AmPxGKk"
        },
        {
          "sessionId": "W4y9xkjyqFvbjENco",
          "userId": "b66oZ8i9pkeSko33v",
          "device": {
            "type": "browser",
            "name": "Chrome",
            "longVersion": "113.0.0.0",
            "os": {
              "name": "Windows",
              "version": "10"
            },
            "version": "113.0.0"
          },
          "host": "localhost:3000",
          "ip": "172.18.0.4",
          "loginAt": "2023-05-16T12:46:09.469Z",
          "_user": {
            "username": "guester",
            "name": "Guester"
          },
          "_id": "W4y9xkjyqFvbjENco"
        },
        {
          "sessionId": "94yTWFkADGBvE9t7P",
          "userId": "aspKK7FHe7iQgzexX",
          "device": {
            "type": "browser",
            "name": "Firefox",
            "longVersion": "112.0",
            "os": {
              "name": "Windows",
              "version": "10"
            },
            "version": "112.0"
          },
          "host": "localhost:3000",
          "ip": "172.18.0.4",
          "loginAt": "2023-05-11T18:47:13.865Z",
          "_user": {
            "username": "user-00",
            "name": "User 00"
          },
          "_id": "94yTWFkADGBvE9t7P"
        }
      ],
      "total": 13,
      "count": 50,
      "offset": 0,
      "success": true
    }
    Expand All
    object
    sessions
    Array of object
    object
    sessionId
    string
    userId
    string
    device
    object
    type
    string
    name
    string
    longVersion
    string
    os
    object
    name
    string
    version
    string
    version
    string
    host
    string
    ip
    string
    loginAt
    string
    _user
    object
    username
    string
    name
    string
    _id
    string
    total
    integer
    count
    integer
    offset
    integer
    success
    boolean
    400

    Bad Request

    TOTP Error
    {
      "success": false,
      "error": "TOTP Required [totp-required]",
      "errorType": "totp-required",
      "details": {
        "method": "password",
        "codeGenerated": false,
        "availableMethods": []
      }
    }
    Expand All
    object
    success
    boolean
    error
    string
    errorType
    string
    details
    object
    method
    string
    codeGenerated
    boolean
    availableMethods
    Array of object
    object
    401

    Unauthorized

    Authorization Error
    {
      "status": "error",
      "message": "You must be logged in to do this."
    }
    object
    status
    string
    message
    string
    403

    Forbidden

    Permission Error
    {
      "success": false,
      "error": "User does not have the permissions required for this action [error-unauthorized]"
    }
    object
    success
    boolean
    error
    string


    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.