Skip to Content
You are viewing a beta version of Clerk Docs
Visit the latest docs
Clerk logo

Clerk Docs

Ctrl + K
Go to clerk.com

getClient()

Retrieves a single Client by its ID, if the ID is valid.

function getClient: (clientId: string) => Promise<Client>;

getClient() parameters

NameTypeDescription
clientIdstringThe ID of the client to retrieve.

getClient() example

const clientId = 'client_2b6J9fCrQt0KRCCtFu7WCIQvSfd'; const response = await clerkClient.clients.getClient(clientId); console.log(response); /* _Client { id: 'client_2b6J9fCrQt0KRCCtFu7WCIQvSfd', sessionIds: [ 'sess_2b6M8I4VZ1wMtgXGQeDe3SJD3cG' ], sessions: [ [_Session] ], signInId: null, signUpId: null, lastActiveSessionId: 'sess_2b6M8I4VZ1wMtgXGQeDe3SJD3cG', createdAt: 1705529444202, updatedAt: 1705530913279 } */

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint GET/clients/{client_id}. See the BAPI reference(opens in a new tab) for more details.

Last updated on December 29, 2023

What did you think of this content?

Clerk © 2024