Skip to content

Quickstart ​

  1. Sign up at otpera.com. The Free plan needs no card.
  2. Open Dashboard → WhatsApp and scan the QR code from WhatsApp on your phone (Linked devices → Link a device).

2. Create an API key ​

Dashboard → API keys → Create key, with the verifications:write scope. The key (otp_live_…) is shown once. Store it in your server's environment, e.g. OTPERA_API_KEY.

Check it works:

bash
curl https://api.otpera.com/api/v1/ping \
  -H "Authorization: Bearer $OTPERA_API_KEY"

3. Send a code ​

bash
curl -X POST https://api.otpera.com/api/v1/verifications \
  -H "Authorization: Bearer $OTPERA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ "to": "+201012345678", "purpose": "signup", "locale": "en" }'
js
const res = await fetch('https://api.otpera.com/api/v1/verifications', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.OTPERA_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID(),
  },
  body: JSON.stringify({ to: '+201012345678', purpose: 'signup', locale: 'en' }),
});
const { data } = await res.json(); // keep data.id; the code is never returned
php
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Str;

$res = Http::withToken(config('services.otpera.key'))
    ->withHeaders(['Idempotency-Key' => (string) Str::uuid()])
    ->post('https://api.otpera.com/api/v1/verifications', [
        'to' => '+201012345678',
        'purpose' => 'signup',
        'locale' => 'en',
    ]);

$verificationId = $res->json('data.id');

The user receives a 6-digit code on WhatsApp. Save data.id against the user's session.

4. Check the code ​

bash
curl -X POST https://api.otpera.com/api/v1/verifications/$VERIFICATION_ID/check \
  -H "Authorization: Bearer $OTPERA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "code": "482913" }'
json
{
  "data": {
    "id": "8b0c…",
    "valid": true,
    "status": "verified",
    "reason": null,
    "attemptsRemaining": 4
  }
}

valid: true means the phone number is verified. See the full OTP verification API for resends, limits and statuses.

otpera.com · WhatsApp order confirmation & OTP