Links

List All Sessions

List all sessions on the workspace.
Retrieve the sessions of all users on the workspace. It supports the Pagination parameters.
URL
Requires Auth
HTTP Method
/api/v1/sessions/list.all
yes
GET

Headers

Argument
Example
Required
Description
X-User-Id
myuser-name
Required
The authenticated user ID.
X-Auth-Token
myauth-token
Required
Auth token.
x-2fa-code
148750
Required
The 2fa code.

Query Parameter

Argument
Example
Required
Description
filter
funke
Optional
Filter sessions list using regex

Example Call

curl --location 'http://localhost:3000/api/v1/sessions/list.all?filter=funke' \
--header 'X-Auth-Token: ocFlTSMfowj9tSH1vQV6ANL9SiahkKUK1KhU_PpAUtT' \
--header 'X-User-Id: 2tTEqR7ZNMJ4HGGNa' \
--header 'x-2fa-code: 148750'

Example Result

{
"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": "funke.olasupo",
"name": "Funke Olasupo"
},
"_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": "Funke",
"username": "funke.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
}

Error

Any of the following errors can occur on the endpoint.
  • Authorization: Requires an authentication token for the request to be made.
  • No Permission: Occurs when the authenticated user doesn't have the view-device-management permission.
  • TOTP Required: Requires two-factor authentication for the request to be made.
  • Invalid TOTP: Requires a valid two-factor authentication code.
Authorization
No Permission
TOTP Required
Invalid TOTP
{
"status": "error",
"message": "You must be logged in to do this."
}
{
"success": false,
"error": "User does not have the permissions required for this action [error-unauthorized]"
}
{
"success": false,
"error": "TOTP Required [totp-required]",
"errorType": "totp-required",
"details": {
"method": "totp",
"codeGenerated": false,
"availableMethods": [
"totp"
]
}
}
{
"success": false,
"error": "TOTP Invalid [totp-invalid]",
"errorType": "totp-invalid",
"details": {
"method": "totp",
"codeGenerated": false
}
}

Change Log

Version
Description
5.0.0
Added
Last modified 2mo ago
Deprecation for cloud services and apps is now extended to November 20, 2023. Rocket.Chat versions receive support for six months after release.