Get Current User Sessions
    • Dark
      Light
    • PDF

    Get Current User Sessions

    • Dark
      Light
    • PDF

    Article summary

    Get
    /api/v1/sessions/list
    Premium tag

    Retrieves all sessions of the authenticated user making the request.

    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
    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 Example
    {
      "sessions": [
        {
          "sessionId": "QoYYFw2t9oKks2niG",
          "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-23T16:33:45.202Z",
          "_id": "QoYYFw2t9oKks2niG"
        },
        {
          "sessionId": "WJ2giBwm4B9mcojFi",
          "userId": "rbAXPnMktTFbNpwtJ",
          "device": {
            "type": "mobile",
            "name": "Chrome",
            "longVersion": "112.0.0.0",
            "os": {
              "name": "Android",
              "version": "10"
            },
            "version": "112.0.0"
          },
          "host": "localhost:3000",
          "ip": "172.20.0.2",
          "loginAt": "2023-05-23T12:43:52.023Z",
          "_id": "WJ2giBwm4B9mcojFi"
        }
      ],
      "total": 2,
      "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
    _id
    string
    total
    integer
    count
    integer
    offset
    integer
    success
    boolean
    401

    Unauthorized

    Authorization Error
    {
      "status": "error",
      "message": "You must be logged in to do this."
    }
    object
    status
    string
    message
    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.