> ## Documentation Index
> Fetch the complete documentation index at: https://developer.rocket.chat/llms.txt
> Use this file to discover all available pages before exploring further.

# Get All User Sessions

> <div style="text-align: center; margin: 1rem 0 1rem 0;"><img src="https://raw.githubusercontent.com/RocketChat/Rocket.Chat-Open-API/main/images/premium.svg" alt="Premium tag" style="display: block; margin: auto;"></div>

Retrieve the sessions of all users on the workspace. This endpoint requires 2FA.
Permission required: `view-device-management`

### Changelog
| Version      | Description |
| ------------ | ------------|
|5.0.0         | Added       |

## OpenAPI

````json GET /api/v1/sessions/list.all
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Settings"
  },
  "servers": [
    {
      "url": "https://apiexplorer.support.rocket.chat"
    }
  ],
  "paths": {
    "/api/v1/sessions/list.all": {
      "parameters": [],
      "get": {
        "summary": "Get All User Sessions",
        "operationId": "get-api-v1-sessions-list.all",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sessions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "sessionId": {
                            "type": "string"
                          },
                          "userId": {
                            "type": "string"
                          },
                          "device": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "longVersion": {
                                "type": "string"
                              },
                              "os": {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "version": {
                                    "type": "string"
                                  }
                                }
                              },
                              "version": {
                                "type": "string"
                              }
                            }
                          },
                          "host": {
                            "type": "string"
                          },
                          "ip": {
                            "type": "string"
                          },
                          "loginAt": {
                            "type": "string"
                          },
                          "_user": {
                            "type": "object",
                            "properties": {
                              "username": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            }
                          },
                          "_id": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "count": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  }
                },
                "examples": {
                  "Success": {
                    "value": {
                      "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": "test.test",
                            "name": "test test"
                          },
                          "_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": "test",
                            "username": "test.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"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    },
                    "errorType": {
                      "type": "string"
                    },
                    "details": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "codeGenerated": {
                          "type": "boolean"
                        },
                        "availableMethods": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {}
                          }
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "TOTP Error": {
                    "value": {
                      "success": "false",
                      "error": "TOTP Required [totp-required]",
                      "errorType": "totp-required",
                      "details": {
                        "method": "password",
                        "codeGenerated": "false",
                        "availableMethods": []
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/authorizationError"
          },
          "403": {
            "$ref": "#/components/responses/forbiddenError"
          }
        },
        "description": "<div style=\"text-align: center; margin: 1rem 0 1rem 0;\"><img src=\"https://raw.githubusercontent.com/RocketChat/Rocket.Chat-Open-API/main/images/premium.svg\" alt=\"Premium tag\" style=\"display: block; margin: auto;\"></div>\n\nRetrieve the sessions of all users on the workspace. This endpoint requires 2FA.\nPermission required: `view-device-management`\n\n### Changelog\n| Version      | Description |\n| ------------ | ------------|\n|5.0.0         | Added       |",
        "tags": [
          "Device Management"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-User-Id"
          },
          {
            "$ref": "#/components/parameters/X-Auth-Token"
          },
          {
            "schema": {
              "type": "string"
            },
            "example": "windows",
            "in": "query",
            "name": "filter",
            "description": "Filter sessions list using regex."
          },
          {
            "$ref": "#/components/parameters/offset"
          },
          {
            "$ref": "#/components/parameters/count"
          },
          {
            "$ref": "#/components/parameters/sort"
          },
          {
            "$ref": "#/components/parameters/x-2fa-code"
          },
          {
            "$ref": "#/components/parameters/X-2fa-method"
          }
        ]
      }
    }
  },
  "components": {
    "responses": {
      "authorizationError": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "Authorization Error": {
                "value": {
                  "status": "error",
                  "message": "You must be logged in to do this."
                }
              }
            }
          }
        }
      },
      "forbiddenError": {
        "description": "Forbidden",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean"
                },
                "error": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "Permission Error": {
                "value": {
                  "success": "false",
                  "error": "User does not have the permissions required for this action [error-unauthorized]"
                }
              }
            }
          }
        }
      }
    },
    "parameters": {
      "X-User-Id": {
        "name": "X-User-Id",
        "in": "header",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "CkCPNctrgCDfmWLqC",
        "description": "The user ID."
      },
      "X-Auth-Token": {
        "name": "X-Auth-Token",
        "in": "header",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "1Dd4iN_ClKn5jl-xPC36snQ4s9Zd5GZnXCQuCNSKcVE",
        "description": "The authentication token."
      },
      "offset": {
        "name": "offset",
        "in": "query",
        "required": "false",
        "schema": {
          "type": "integer"
        },
        "example": "50",
        "description": "Number of items to \"skip\" in the query, i.e. requests return count items, skipping the first offset items. Refer to the [official documentation](https://developer.rocket.chat/apidocs/query-parameters#pagination) to learn more."
      },
      "count": {
        "name": "count",
        "in": "query",
        "required": "false",
        "schema": {
          "type": "integer"
        },
        "example": "50",
        "description": "How many items to return. Refer to the [official documentation](https://developer.rocket.chat/apidocs/query-parameters#pagination) to learn more."
      },
      "sort": {
        "name": "sort",
        "in": "query",
        "required": "false",
        "schema": {},
        "description": "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](https://developer.rocket.chat/apidocs/query-parameters#pagination) to learn more."
      },
      "x-2fa-code": {
        "name": "x-2fa-code",
        "in": "header",
        "schema": {
          "type": "string"
        },
        "description": "The 2FA code. This parameter is required if 2FA is enabled in your workspace. See the <a href=\"https://developer.rocket.chat/apidocs/introduction-to-two-factor-authentication\" target=\"_blank\">Introduction to Two-Factor Authentication</a> document for details."
      },
      "X-2fa-method": {
        "name": "x-2fa-method",
        "in": "header",
        "schema": {
          "type": "string"
        },
        "description": "Enter the method with which you get the 2FA code. It can be `email`, `totp`, or `password`. This parameter is required if 2FA is enabled in your workspace."
      }
    }
  }
}
````

