OTP Codes Service

Free email OTP login for your website

Send a 6-digit code to a user's email, verify it, and get a signed token your server can trust. No phone numbers, no SMS bills, no passwords.

Developer dashboard

Log in with your email. We send you a code, so there is no password to remember. New emails are signed up automatically.

Logged in as

Your apps

Create an app

Docs: start to finish

1. How it works

  1. The user types their email on your site. Your site calls /v1/otp/send.
  2. We email: "Your account verification code for YourPlatform is 123456." The code is valid for 5 minutes and works once.
  3. The user types the code. Your site calls /v1/otp/verify. If it is right, you get a signed token.
  4. Your server checks the token and logs the user in. Never trust the browser alone.

2. Get your keys

Log in above and create an app. You get three values:

3. Send a code

POST {{HOST}}/v1/otp/send
X-Public-Key: pk_...        (browser)   or   Authorization: Bearer sk_...   (server)
Content-Type: application/json

{ "email": "user@example.com" }

200 { "request_id": "uuid", "expires_in": 300, "resend_after": 60 }

To send again, call the same endpoint (or /v1/otp/resend). The older code stops working.

4. Verify the code

POST {{HOST}}/v1/otp/verify
{ "request_id": "uuid-from-send", "email": "user@example.com", "code": "123456" }

200 { "verified": true, "email": "user@example.com", "token": "eyJ...", "expires_in": 600 }

5. Check the token on your server

The token is a JWT signed with ES256. Check it with our public keys, no extra call to us needed. Check issuer, audience (your App ID) and expiry.

// npm i jose
import { createRemoteJWKSet, jwtVerify } from 'jose';
const jwks = createRemoteJWKSet(new URL('{{HOST}}/.well-known/jwks.json'));

export async function emailFromToken(token) {
  const { payload } = await jwtVerify(token, jwks, {
    issuer: 'otp-codes-service',
    audience: 'YOUR_APP_ID'          // the App ID from your dashboard
  });
  return payload.sub;                // the verified email
}

6. Full browser example

const API = '{{HOST}}/v1/otp', PK = 'pk_your_public_key';
const call = (p, b) => fetch(API + p, { method: 'POST',
  headers: { 'content-type': 'application/json', 'x-public-key': PK }, body: JSON.stringify(b) }).then(r => r.json());

const { request_id } = await call('/send', { email });
// ...user types the code...
const r = await call('/verify', { request_id, email, code });
if (r.token) await fetch('/my-backend/login', { method: 'POST', body: JSON.stringify({ token: r.token }) });

7. Server-side example (curl)

curl -X POST {{HOST}}/v1/otp/send \
  -H "Authorization: Bearer sk_your_secret_key" -H "content-type: application/json" \
  -d '{"email":"user@example.com"}'

8. Errors

Status / codeMeaning
400 invalid_email, invalid_inputBad request body.
400 invalid_codeWrong, expired or already used code.
401 unauthorizedMissing or unknown key.
403 origin_not_allowedThe public key was used from a website not in your list.
429 cooldownWait 60 seconds between codes for the same email.
429 rate_email / rate_ip / rate_appHourly limit per email (5) or per IP (30), or your daily app limit (100) was reached.
429 too_many_attempts5 wrong tries. Request a new code.
502 email_failedThe email could not be sent. Try again.

9. Limits and security