Skip to content

Auth API Quickstart

Get up and running with MFA enrollment and verification in minutes.

  • A valid SecureAuth account
  • Your Bearer Token (issued from the developer dashboard)
  • A TOTP-compatible authenticator app (e.g., Google Authenticator, Authy)

All requests require an Authorization header containing your Bearer Token.

Authorization: Bearer <YOUR_TOKEN>

Enrolls a user in TOTP-based multi-factor authentication.

POST /v1/mfa/enroll HTTP/1.1
Host: api.secureauth.io
Authorization: Bearer <YOUR_TOKEN>
Content-Type: application/json
{
"user_id": "usr_01HXYZ",
"method": "totp"
}
{
"enrollment_id": "enr_09ABCD",
"totp_uri": "otpauth://totp/SecureAuth:usr_01HXYZ?secret=SECRET32",
"qr_code_url": "https://api.secureauth.io/qr/enr_09ABCD.png"
}
FieldTypeDescription
enrollment_idstringUnique identifier for this enrollment
totp_uristringOTP Auth URI for authenticator apps
qr_code_urlstringURL to the scannable QR code image

Verifies a TOTP code submitted by the user.

POST /v1/mfa/verify HTTP/1.1
Host: api.secureauth.io
Authorization: Bearer <YOUR_TOKEN>
Content-Type: application/json
{
"enrollment_id": "enr_09ABCD",
"totp_code": "123456"
}
{
"verified": true,
"session_token": "sess_XYZ789..."
}
{
"verified": false,
"error": "invalid_totp_code"
}
FieldTypeDescription
enrollment_idstringEnrollment ID returned at enroll step
totp_codestring6-digit code from your authenticator
verifiedbooleantrue if verification succeeded
session_tokenstringSession token issued on success

CodeStatusDescription
invalid_token401Bearer Token is missing or invalid
user_not_found404The specified user_id not found
invalid_totp_code401TOTP code is incorrect or expired
enrollment_not_found404No enrollment matches that ID