description
Get sessions of the authenticated user.
Get Current User Sessions
Retrieves all sessions of the authenticated user making the request. It supports the #pagination parameters.
URL
Requires Auth
HTTP Method
/api/v1/sessions/list
yes
GET
Headers
Argument Example Required Description X-User-Idmyuser-nameRequired The authenticated user ID. X-Auth-Tokenmyauth-tokenRequired Auth token.
Argument Example Required Description filterwindows Optional Filter sessions list using regex
curl -- location 'http://localhost:3000/api/v1/sessions/list' \
-- header 'X-Auth-Token: 4uBKb3a7jl28SM1uIAiXnqGvg9CBre9FA8cWxp8AaA6' \
-- header 'X-User-Id: rbAXPnMktTFbNpwtJ'
{
"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
}
Any of the following errors can occur on the endpoint.
Authorization : Requires an authentication token for the request to be made.
{% tabs %}
{% tab title="Authorization" %}
{
"status" : " error" ,
"message" : " You must be logged in to do this."
}
{% endtab %}
{% endtabs %}
Version
Description
5.0.0
Added