Skip to Content
Clerk logo

Clerk Docs

Ctrl + K
Go to clerk.com

getSessionList()

Retrieves a list of sessions.

const sessions = await clerkClient.sessions.getSessionList();

Required parameters

NameTypeDescription
clientId?stringThe client ID to retrieve the list of sessions for.
userId?stringThe user ID to retrieve the list of sessions for.
status?[SessionStatus](/docs/references/javascript/types/session-status)The status of the session.

Example

getSessionList({ clientId, userId })

Retrieve a list of sessions for a specific clientId and userId:

const clientId = 'my-client-id'; const userId = 'my-user-id'; const sessions = await clerkClient.sessions.getSessionList({ clientId, userId });

getSessionList({ clientId, sessionId, status })

Retrieve a list of sessions with a specific status:

const clientId = 'my-client-id'; const userId = 'my-user-id'; const status = 'revoked' // retrieves a list of 'revoked' sessions for a specific clientId and userId const sessions = await clerkClient.sessions.getSessionList({ clientId, sessionId, status });

Last updated on February 21, 2024

What did you think of this content?

Clerk © 2024