Represents an authenticated user’s connection to your application. A session is created when a user signs in through AuthKit and contains information about the authentication method, device details, and session status.
Get a list of all active sessions for a specific user.
cURL
| curl "https://api.workos.com/user_management/users/user_01EHZNVPK3SFK441A1RGBFSHRT/sessions" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| import { WorkOS } from '@workos-inc/node'; | |
| const workos = new WorkOS('sk_example_123456789'); | |
| const sessions = await workos.userManagement.listSessions( | |
| 'user_01E4ZCR3C56J083X43JQXF3JK5', | |
| ); |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.user_management.list_sessions(id: "user_01EHZNVPK3SFK441A1RGBFSHRT") |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.user_management.list_sessions(id_="user_01EHZNVPK3SFK441A1RGBFSHRT") |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v9" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| _, err := client.UserManagement().ListSessions(context.Background(), "user_01EHZNVPK3SFK441A1RGBFSHRT") | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos->userManagement()->listSessions(id: "user_01EHZNVPK3SFK441A1RGBFSHRT"); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.userManagement.listSessions("user_01EHZNVPK3SFK441A1RGBFSHRT"); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.UserManagement.ListSessionsAsync("user_01EHZNVPK3SFK441A1RGBFSHRT"); |
| use workos::Client; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::builder() | |
| .api_key("sk_example_123456789") | |
| .client_id("client_123456789") | |
| .build(); | |
| let _result = client | |
| .user_management() | |
| .list_sessions("user_01EHZNVPK3SFK441A1RGBFSHRT") | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "object": "list", | |
| "data": [ | |
| { | |
| "object": "session", | |
| "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", | |
| "impersonator": { | |
| "email": "admin@foocorp.com", | |
| "reason": "Investigating an issue with the customer's account." | |
| }, | |
| "ip_address": "198.51.100.42", | |
| "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", | |
| "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", | |
| "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", | |
| "auth_method": "sso", | |
| "status": "active", | |
| "expires_at": "2026-01-15T12:00:00.000Z", | |
| "ended_at": null, | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "updated_at": "2026-01-15T12:00:00.000Z" | |
| } | |
| ], | |
| "list_metadata": { | |
| "before": "session_01HXYZ123456789ABCDEFGHIJ", | |
| "after": "session_01HXYZ987654321KJIHGFEDCBA" | |
| } | |
| } |
GET/user_management /users /:id /sessions
Parameters
Returns object
Session helpers Continue to the next section
Up next