Skip to main content
CBPay can require a one-time verification code (OTP) before sensitive actions: logging in, creating a payout, withdrawing crypto, revealing a card, issuing an API key… The code arrives over SMS or WhatsApp to the account’s phone, and your operator decides which actions require it and over which channel — per account or for the whole organization.
OTP applies only to user sessions (JWT login). pk_ API keys are exempt: they are server-to-server integrations with no human holding a phone on the other side. If your whole operation runs on API keys, this page changes nothing in your integration.
This page covers the per-action OTP flow your integration must handle (otp_required → challenge → verify). Everything the end user manages about their own factors — enabling 2FA, channels (SMS/WhatsApp/email), the authenticator app (TOTP), recovery codes and passkeys — lives in Profile & security.

Registration enrollment and login resume

Mandatory registration 2FA is separate from per-action OTP. After email confirmation, keep the pending_token for up to 30 minutes and choose the authenticator app (TOTP) or phone delivery by SMS or WhatsApp: POST /v1/auth/register/confirm returns 201 pending_2fa_enrollment with factors: ["totp", "sms"] and passkeys_available: false. Password login, OAuth login and invited-member first login use the same pending flow when must_enroll_2fa is active. Refresh and environment handoff reject an unenrolled member. For TOTP, call POST /v1/auth/register/2fa/totp/begin, scan the returned otpauth_uri, then confirm with the six-digit code. The 201 response creates the first session and returns 10 recovery codes once. For SMS or WhatsApp:
The successful 200 response contains phone_masked, the effective channel, steps for the ten-minute verification window, and a note pointing to sms/confirm. The channel is sms by default; use whatsapp to deliver the code through WhatsApp. It never returns the code.
The 201 response contains the first session, the account, steps saying that future sign-ins require an SMS code, and a note. It does not contain recovery codes. The SMS factor is effective only after the phone is verified, regardless of whether enrollment used SMS or WhatsApp. The registration passkey endpoints remain only to guide older clients: both POST /v1/auth/register/2fa/passkey/begin and .../passkey/finish return 410 passkey_not_offered. Passkey login and /v1/me/passkeys remain available. Registration enrollment errors include 400 invalid_channel with the message channel must be sms or whatsapp, 400 invalid_phone with the message phone must be E.164 format: plus sign, country code and number (example +56912345678), 401 invalid_pending_token, 409 phone_required, 409 sms_not_started, 403 otp_invalid, 429 too_many_attempts, 502 otp_send_failed or otp_check_failed, and 409 enrollment_complete.

How it works

The otp_token is single use, bound to your user and to the action it was issued for, and expires with the challenge (10 minutes after the code was sent).
Shortcut: the 403 may already carry challenge_id, phone (masked destination) and expires_at — the gate reuses a live challenge or creates one for you. When present, verify the code directly and retry with X-OTP-Token, skipping the explicit POST /v1/otp/challenges below (which still works as a fallback).

1. Check your policy

GET /v1/otp/settings tells you whether OTP is active and which actions require it:

2. Request the code

Response 201 — the code is already on its way to the account’s phone:
You can pick the delivery channel per challenge — sms, whatsapp, email or totp:
Omit channel and the server resolves it: your member settings first, then the org default, falling back to SMS. The response always tells you which channel fired and its masked destination (phone — a masked number, a masked email, or the literal authenticator_app for TOTP). The check runs against the effective floor — your account’s policy first, then the org default: an explicit channel weaker than the floor fails with 403 channel_locked_by_org instead of being silently upgraded. If the account has no phone: 409 phone_required (set it with PATCH /v1/me). Hourly send limits apply — exceeding them returns 429 too_many_attempts.

3. Verify the code

Wrong code → 401 invalid_code (you get 5 attempts per challenge).

4. Execute the action with the token

The token is consumed on use, even if the action fails afterwards (for example, insufficient funds): retrying requires verifying a new challenge. Your idempotency_key remains the duplicate protection — OTP does not replace it.

Two-step login

If your policy requires OTP on login, POST /v1/auth/login no longer returns the session directly:
The pending_token cannot call the API: it is only exchanged, along with the code, for the real session:
An enrolled TOTP or effective SMS factor is enforced at login. TOTP takes precedence when both factors exist. Passkey login remains available and does not request a second code.

The account’s phone

  • E.164 format (+56912345678), set at registration, through PATCH /v1/me or by your operator.
  • phone_verified flips to true the first time you verify a challenge: it proves the holder has the phone in hand.
  • Changing the phone (action phone_change) validates the code against the previous number — nobody can redirect your codes without holding your current phone.
  • If the phone is linked for the first time (or changed without verification), SMS/WhatsApp challenges stay locked for 4 hours: the anti session-hijacking window. During the cooldown, if you have the authenticator app enrolled or a verified email, the challenge is issued automatically over that stronger factor (the channel comes back in the challenge response); you only get 403 phone_binding_cooldown when no alternative factor exists. A phone set by your operator has no cooldown. You can also lift the cooldown early with POST /v1/me/phone/unlock-cooldown (email/totp token), or your operator can clear it from your profile. Pinning an explicit channel turns the fallback off: channel: sms in cooldown fails with 403 phone_binding_cooldown even with the authenticator app enrolled.
  • The two-step login honors the same rule: with login 2FA over SMS/WhatsApp and the phone in cooldown, the login code is issued over the authenticator app or your login email instead (the effective channel comes back in the login response) — it is never sent to a recently linked, unverified number. Without an alternative factor the login responds 403 phone_binding_cooldown until the cooldown expires.

Errors

FAQ

No. pk_ API keys are exempt by design: automation never goes through OTP. Guard your keys accordingly — issuing a new key CAN require OTP (action api_key_create).
Yes — pass channel (sms, whatsapp, email or totp) when you create the challenge. Omit it and your operator’s configured channel applies per action (per account or for the whole organization — you see it in GET /v1/otp/settings). The check runs against the effective floor — your account’s policy first, then the org default — so a weaker explicit choice fails with 403 channel_locked_by_org instead of being silently upgraded.
Yes. GET /v1/me/sms-2fa shows the masked phone and status. DELETE /v1/me/sms-2fa requires an X-OTP-Token from a security_settings challenge verified over SMS or WhatsApp. The organization floor can block removal with 403 policy_locked_by_org.
Yes, but first prove possession of the previous number with a phone_change OTP. API keys cannot perform this change while SMS 2FA is active; the request fails closed. The new number is not verified until its own verification succeeds.
WhatsApp is supported only for the registration delivery step. After the phone is verified, future sign-ins request the code by SMS. The confirmation endpoint remains the same for both enrollment channels.
Passkeys were removed from the registration wizard only. Use the authenticator app or SMS during registration; passkey login and /v1/me/passkeys continue to work.
The code and challenge last 10 minutes. You get 5 verifications per challenge and an hourly send limit. The resulting otp_token is single use.
No: the token is bound to the exact action the challenge was created for (a payout token does not work for transfer) and is consumed on first use.
No. A consumed token only means you must verify a new challenge; the operation’s idempotency_key still guarantees there are no duplicates.
Passkey login still respects the enrollment gate: when must_enroll_2fa is true, it returns pending_2fa_enrollment; complete registration with TOTP or SMS before receiving a session. A member still marked RegisterPending must confirm the mailbox first.
Last modified on November 7, 2026