POST/sessions/{session_id}/tokens

Create a session token

Creates a session JSON Web Token (JWT) for the specified session. You can optionally set expires_in_seconds to override the default token lifetime; the value must be between 30 and 315360000 seconds.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

1 parameter · 1 body field
session_idstringrequired
The unique identifier of the session for which to create a token.

Optional settings for the session token.

expires_in_secondsintegeroptional
Use this parameter to override the default session token lifetime.

3 status codes
200Returns a token object containing the session JWT.
objectstringoptional
Allowed:token
jwtstringoptional
401Returned when authentication is invalid.
errorsarray<object>required
metaobjectoptional
clerk_trace_idstringoptional
404Returned when the session resource is not found.
errorsarray<object>required
metaobjectoptional
clerk_trace_idstringoptional

Error handling

A 401 is returned when authentication is invalid, and a 404 when the session resource is not found. The session_id path parameter must identify an existing session. If supplied, expires_in_seconds must be between 30 and 315360000.