POST/users/{user_id}/verify_totp

Verify a TOTP or backup code for a user

Verify that the provided TOTP or backup code is valid for the user. Verifying a backup code will result it in being consumed (i.e. it will become invalid). Useful for custom auth flows and re-verification.

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

1 parameter · 1 body field
user_idstringrequired
The ID of the user for whom to verify the TOTP
codestringrequired
The TOTP or backup code to verify

5 status codes
200The provided TOTP or backup code was correct.
verifiedbooleanoptional
code_typestringoptional
Allowed:totpbackup_code
400The user does not have TOTP configured for their account.
404The user does not exist.
422The provided TOTP or backup code was incorrect.
500Request was not successful
errorsarray<object>required
metaobjectoptional
clerk_trace_idstringoptional

Error handling

A 400 is returned: The user does not have TOTP configured for their account. A 404 is returned: The user does not exist. A 422 is returned: The provided TOTP or backup code was incorrect. A 500 is returned: Request was not successful.