OTP · 2FA · Phone Verification

OTP Verification API

Verify phone numbers and secure logins with one-time codes delivered via SMS, WhatsApp, or email. Built-in expiry, retry limiting, and fraud protection.

Key Features

Multi-channel delivery

Send OTP codes via SMS, WhatsApp, or email. Automatically fall back to the next channel if delivery fails.

Built-in fraud protection

Rate limiting per phone number, max attempt enforcement, and code expiry — all handled by the API so you don't have to.

Configurable code length & expiry

Choose 4–8 digit codes with custom TTL from 1–30 minutes. Set max verification attempts per session.

Idempotent sessions

Each OTP session has a session token. Safely retry the verify endpoint without risk of double-verification.

Code Example

const session = await client.verify.send({
  to: '+14155552671',
  channel: 'sms',       // 'sms' | 'whatsapp' | 'email'
  codeLength: 6,
  expiresIn: 300,        // seconds
})

// User submits code
const result = await client.verify.check({
  sessionToken: session.sessionToken,
  code: userInput,
})

if (result.valid) {
  // Phone number verified ✓
}