palbaseDocs

Palbase Auth API · API

POST/auth/mfa/enroll

Begin MFA enrollment

Begin MFA enrollment for the authenticated user. type=totp returns the secret, otpauth URL, QR code (base64 PNG), and a one-time set of recovery codes (only on the user's first MFA enrollment). type=email marks email OTP as enrolled and returns {status: enrolled} — email must already be verified. An account whose email address is not confirmed is refused (403 email_unconfirmed): no sign-in method is added to it until its address is confirmed, as its owner, proving the address, takes the account as it was opened.

Called by a signed-in user of your app, with their token and the publishable key.

Request body

type"totp" | "email" · requiredFactor type to enroll. SMS uses its own dedicated `/auth/mfa/sms/enroll` endpoint.
curl
curl -X POST "https://<your-ref>.palbase.studio/auth/mfa/enroll" \
  -H "apikey: $PALBASE_PUBLISHABLE_KEY" \
  -H "authorization: Bearer $USER_ACCESS_TOKEN" \
  -H "content-type: application/json" \
  -d '{"type":"totp"}'

Responses

200Enrollment started — TOTP returns secret/QR/recovery codes; email returns status=enrolled

400Validation failed or required field missing

401Missing, invalid, or expired credentials

409Conflict with current resource state (duplicate, race)

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation MfaEnroll of auth's contract.