Get Current User Sessions

Get sessions of the authenticated user.

Headers

Query Parameter

Example Call

curl --location 'http://localhost:3000/api/v1/sessions/list' \
--header 'X-Auth-Token: 4uBKb3a7jl28SM1uIAiXnqGvg9CBre9FA8cWxp8AaA6' \
--header 'X-User-Id: rbAXPnMktTFbNpwtJ'

Example Result

Success

{
    "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
}

Error

Any of the following errors can occur on the endpoint.

  • Authorization: Requires an authentication token for the request to be made.

{
    "status": "error",
    "message": "You must be logged in to do this."
}

Change Log

Last updated

Rocket.Chat versions receive support for six months after release.