POST https://www.otp.dearprime.in/docs/api/v1/send-otp
Creates a one-time passcode, stores only a peppered hash of it, and delivers it over email, SMS or both.
| Field | Type | Required | Notes |
|---|---|---|---|
| api_key | string | Yes* | *Or the X-API-Key header. |
| string | Conditional | Valid email address. Required if mobile is absent. | |
| mobile | string | Conditional | Digits with optional country code. Required if email is absent. |
| purpose | string | No | Short label such as login, signup, reset. Defaults to verification. |
Supply both email and mobile to send the same code on both channels under one request ID.
{
"api_key": "YOUR_API_KEY",
"email": "user@example.com",
"mobile": "919812345678",
"purpose": "login"
}
{
"success": true,
"message": "OTP sent successfully",
"request_id": "REQ_8F2A1C4B9D",
"expires_in": 300,
"channels": { "email": "sent", "sms": "sent" }
}
Store request_id against the user session - it is required to verify the code. expires_in is in seconds.
| Code | HTTP | Meaning |
|---|---|---|
| VALIDATION_ERROR | 422 | Missing or invalid destination / purpose. |
| RESEND_COOLDOWN | 429 | A code was already sent to this destination recently. |
| QUOTA_EXCEEDED | 429 | Daily or monthly quota reached. |
| DELIVERY_FAILED | 502 | No channel accepted the message. |