Enhanced OTP API v1
Advanced one-time password solution with customizable PINs, templates, and fintech-grade security
Authentication
Use Basic Auth with your API credentials encoded in base64:
Get your API credentials from your Sendexa dashboard
Authorization: Basic base64(api_key:api_secret)Get your API credentials from your Sendexa dashboard
New Enhanced Features
Now supports custom PIN lengths (4-10), alphanumeric codes, template messages, and fintech-grade security
POST
/v1/otp/request
Enhanced
Description
Generate and deliver customizable OTPs with support for variable PIN lengths, alphanumeric codes, custom templates, and flexible expiration times.
- Custom PIN lengths from 4 to 10 characters
- Support for numeric, alphanumeric, and alphabetic codes
- Template messages with
{code},{amount},{duration}placeholders - Configurable expiration from 1 minute to 24 hours
- Rate limited to prevent spam
Request Body
{"phone": "0555539152", // Required: Ghana phone number"from": "YourBrand", // Required: Sender ID name"message": "Your code is {code}, expires in {amount} {duration}", // Optional: Custom template"pinLength": 4, // Optional: 4-10 characters (default: 6)"pinType": "NUMERIC", // Optional: NUMERIC, ALPHANUMERIC, ALPHABETIC"expiry": { // Optional: Expiry configuration"amount": 12, // 1-1440"duration": "minutes" // "minutes" or "hours"},"maxAmountOfValidationRetries": 3, // Optional: Max verification attempts (default: 3)"metadata": { // Optional: Additional context"userId": "12345","transactionType": "withdrawal"}}
Response
{"success": true,"message": "OTP sent successfully","data": {"id": "clxyz123abc","phone": "233559400612","channel": "SMS","pinLength": 4,"pinType": "NUMERIC","expiry": {"amount": 12,"duration": "minutes","expiresAt": "2024-01-15T10:32:00.000Z"},"maxValidationAttempts": 3,"metadata": {"userId": "12345","transactionType": "withdrawal"}}}
Examples
# Enhanced OTP with custom configurationcurl -X POST 'https://api.sendexa.co/v1/otp/request' \-H 'Content-Type: application/json' \-H 'x-api-key: YOUR_API_KEY' \-d '{"phone": "0555539152","from": "YourBrand","message": "Your verification code is {code}, it expires in {amount} {duration}","pinLength": 4,"pinType": "NUMERIC","expiry": {"amount": 12,"duration": "minutes"},"maxAmountOfValidationRetries": 3}'