Email OTP sends a short numeric code to the user’s inbox. It works well for mobile flows where clicking a link is awkward and for verification steps inside an existing session.Documentation Index
Fetch the complete documentation index at: https://docs.kavachos.com/llms.txt
Use this file to discover all available pages before exploring further.
Setup
How it works
- User submits their email to
POST /auth/email-otp/send. - KavachOS generates a cryptographically random code and calls your
onSendOtpfunction with the email and code. - User enters the code in your UI and submits to
POST /auth/email-otp/verify. - On success, a session cookie is set.
Send a code
POST /auth/email-otp/send
200 to prevent email enumeration. Codes are rate-limited to one per minute per email address, requests within the window return 429. Build a countdown timer into your UI.
Verify a code
POST /auth/email-otp/verify
maxAttempts failed verifications, the code is invalidated and a new one must be requested.
Options
| Option | Type | Default | Description |
|---|---|---|---|
onSendOtp | (email: string, code: string) => Promise<void> | required | Called with the recipient email and the numeric code |
codeLength | number | 6 | Number of digits in the OTP |
codeTtl | number | 600 | Code lifetime in seconds (default: 10 minutes) |
maxAttempts | number | 5 | Failed attempts before the code is invalidated |
createUserIfNotFound | boolean | true | Auto-create accounts for new emails |