curl. By the end, you’ll have made real API calls and understand the shape of every response you’ll encounter in production.
The OTP code itself is never returned in API responses — it’s delivered directly to the user through the chosen channel.
1
Get your API key
Every request to the OTP.ID API must include a Bearer API key. To obtain yours:
- Log in to your dashboard at https://otp.id.
- Navigate to Settings → API Keys.
- Copy your key — you’ll pass it in the
Authorizationheader of every request.
otpid_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxKeep it secret. Never commit it to source control or expose it in client-side code.2
Send an OTP via WhatsApp
Call A successful response looks like this:Save the
POST /v3/request to have OTP.ID generate a code and deliver it to your user over WhatsApp. Pass the destination number in E.164 format (digits only, no + prefix) and a brand name that will appear in the message.otp_id — you’ll need it in the next two steps. The expires_at field tells you when the code stops being valid. price is the amount deducted from your balance (in the smallest currency unit), and last_balance is your remaining prepaid balance after this send.3
Verify the OTP
Once your user submits the code they received, call Successful verification — the code matches:Code mismatch — the user entered the wrong code:Other possible values for
POST /v3/verify with the otp_id from the previous step and the code the user entered.A mismatch returns HTTP
200 with verified: false — it is a valid, expected outcome, not an API error. Only check data.verified to decide whether to grant access.reason include "expired" (the OTP window has passed) and "already_verified" (the code was already used).4
Check transaction status
For polling-based flows — or when you want to inspect a past OTP record — call The response includes the full OTP record with its current Common
GET /v3/otp/{otp_id} with the OTP’s ID.status:status values are sent, delivered, verified, expired, and failed. For real-time notifications without polling, configure an otp.verified webhook in your dashboard instead.Next Steps
You’ve completed the full OTP flow. Here’s where to go deeper:- Authentication — understand API key scoping and how to handle auth errors.
- Channels — learn when to use SMS, Email, Missed Call, or WhatsApp Inbound instead of WhatsApp outbound.
- Webhooks — set up the
otp.verifiedevent to receive async verification results. - API Reference — see the full schema for every request and response field.

