Skip to Content
Clerk logo

Clerk Docs

Ctrl + K
Go to


Retrieves a token for a JWT Template that is defined in the Clerk Dashboard on the JWT Templates(opens in a new tab) page.

In the example below, a token for the session with the ID my-session-id is retrieved and the token is generated using the test JWT Template.

const sessionId = 'my-session-id'; const template = 'test'; const session = await clerkClient.sessions.getToken(sessionId, template);

Required parameters

sessionIdstringThe ID of the session to retrieve a token for.
templatestringThe name of the JWT template from the Clerk Dashboard(opens in a new tab) to generate a new token from.
E.g. 'firebase', 'grafbase', or your custom template's name.

Last updated on November 9, 2023

What did you think of this content?

Clerk © 2024