Skip to content
Esc
navigateopen⌘Jpreview
Dashboard

Create TOTP device

Creates an unverified totp device

POST/{apiBasePath}/totp/device
Authorization
AuthorizationBearer token · headerrequired
Returned as the "st-access-token" header from sign-in and refresh endpoints and present on requests that update the access token payload
or
sAccessTokenAPI key · cookierequired
This is an HTTPOnly cookie, set by sign-in and refresh endpoints and present on requests that update the access token
Path parameters
apiBasePathstringrequired
Its value depends on the apiBasePath set by the user
Header parameters
ridstring
The TOTP recipe ID
anti-csrftoken
This will only be here if enabled by the user.
Request body
application/json
deviceNamestring
Responses
200Information about the created (unverified) device. Based on the this, the user can add the device to their TOTP app and verify it.
One of:
object
statusstatusOK
Success status indicator
Allowed:OK
deviceNamestring
qrCodeStringstring
secretstring
object
statusstring
Allowed:DEVICE_ALREADY_EXISTS_ERROR
generalErrorResponse
statusstring
Error status code
Allowed:GENERAL_ERROR
messagestring
Error message
403A claim validation error happened during factor setup
One of:
object
messagestring
Error message
claimValidationErrorsobject[]
List of claim validation errors
Show properties
Array of object
idstring
The claim ID
reasonobject
The reason for the validation error
object
messagestring
Error message
claimValidationErrorsobject[]
List of claim validation errors
Show properties
Array of object
idstring
The claim ID
reasonstring
The reason for the validation error
404Resource not found error
string
500Internal server error
string
Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X POST "/auth/totp/device" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "deviceName": "asdf123"
}'
Response
{
  "status": "OK",
  "deviceName": "asfd123",
  "qrCodeString": "otpauth://totp/Supertokens:[email protected]?secret=JBSWY3DPEHPK3PXP&issuer=Supertokens",
  "secret": "JBSWY3DPEHPK3PXP"
}

API reference

API schema and response details