Get Current User Sessions

Prev Next
Get
/api/v1/sessions/list
Premium tag

Retrieves all sessions of the authenticated user making the request.

Changelog

Version Description
5.0.0 Added
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. Refer to the official documentation to learn more.

Example50
count
integer

How many items to return. Refer to the official documentation to learn more.

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}. Refer to the official documentation to learn more.

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