Docs

You are viewing an archived version of the docs.Go to latest version

getSessionList()

Retrieves a list of sessions.

const sessions = await clerkClient.sessions.getSessionList();
  • Name
    clientId?
    Type
    string
    Description

    The client ID to retrieve the list of sessions for.

  • Name
    userId?
    Type
    string
    Description

    The user ID to retrieve the list of sessions for.

  • Name
    status?
    Type
    [SessionStatus](/docs/references/javascript/types/session-status)
    Description

    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 });

Feedback

What did you think of this content?

Last updated on