POST/sign_in_tokens

Create sign-in token

Creates a new sign-in token and associates it with the given user. By default, sign-in tokens expire in 30 days. You can optionally supply a different duration in seconds using the expires_in_seconds property.

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

4 body fields
user_idstringrequired
The ID of the user that can use the newly created sign in token
org_idstringoptional
The ID of the organization to activate when the user signs in. Organizations must be enabled for the instance, and the user must be a member of the organization.
expires_in_secondsintegeroptional
Optional parameter to specify the life duration of the sign in token in seconds. By default, the duration is 30 days, or 10 minutes when `second_factor_verification` is set.
second_factor_verificationstringoptional
Optional parameter that lets a user with a second factor enabled complete the sign in without being prompted for it. When omitted, redeeming the token completes only the first factor, and the user must still complete their second factor. `fresh`: the second factor is treated as verified at sign in. The session token's `fva` claim reports a second factor age of 0. `stale`: the second factor is treated as unverified. The session token's `fva` claim reports the maximum second factor age of 99999, so any reverification that requires a second factor prompts the user to complete one. Has no effect for users without a second factor enabled. A token created with this parameter signs in a user with a second factor enabled without prompting for it, so `expires_in_seconds` defaults to 10 minutes. We recommend keeping it short.
Allowed:freshstale

4 status codes
200Success
objectstringrequired
Allowed:sign_in_token
idstringrequired
statusstringrequired
Allowed:pendingacceptedrevoked
user_idstringrequired
tokenstringoptional
urlstringoptional
created_atintegerrequired
Unix timestamp of creation.
updated_atintegerrequired
Unix timestamp of last update.
403Authorization invalid
errorsarray<object>required
metaobjectoptional
clerk_trace_idstringoptional
404Resource not found
errorsarray<object>required
metaobjectoptional
clerk_trace_idstringoptional
422Invalid request parameters
errorsarray<object>required
metaobjectoptional
clerk_trace_idstringoptional

Error handling

A 403 is returned: Authorization invalid. A 404 is returned: Resource not found. A 422 is returned: Invalid request parameters.