Developer API Documentation

Welcome to the OTP Gateway developer portal. Our REST APIs allow you to trigger high-speed OTP validations for mobile numbers in India. We support direct SMS routing and WhatsApp delivery options.

Base API URL: https://otpwallah.in/api/v1

Authentication

All API requests must include your API Key in the request header as a Bearer Token.

Authorization: Bearer ak_YOUR_API_KEY

Send SMS OTP

POST /api/v1/send/sms
Request Body Parameters
Parameter Type Required Description
mobile String Yes 10-digit Indian mobile number. e.g. 9876543210
sender_id String No Valid approved sender ID (default: 275)
otp String No Custom OTP value. If omitted, gateway generates a random OTP.
length Integer No Length of generated OTP (4-8 digits, default: 6)
expiry Integer No Expiry duration in minutes (1-60, default: 10)

Send WhatsApp OTP

POST /api/v1/send/whatsapp
Request Body Parameters
Parameter Type Required Description
mobile String Yes 10-digit Indian mobile number. e.g. 9876543210
otp String No Custom OTP value. (default: auto-generated)
length Integer No OTP Length (4-8 digits, default: 6)

Verify OTP

NEW
POST /api/v1/verify

After the user enters the OTP received on their mobile, call this endpoint to verify it. Uses the request_id returned from /send/sms or /send/whatsapp. Works for both SMS and WhatsApp OTPs.

Request Body Parameters
Parameter Type Required Description
request_id String Yes The request_id returned from /send/sms or /send/whatsapp
otp String Yes The OTP code entered by the user

Send Bulk SMS Campaign

POST /api/v1/bulk-sms

Trigger high-speed bulk SMS campaigns to multiple contacts. Estimated costs are deducted upfront from your wallet balance. Invalid or unroutable numbers will be automatically refunded by the provider after delivery report aggregation.

Request Body Parameters
Parameter Type Required Description
title String Yes Campaign title for logging & tracking. (max: 150 chars)
message String Yes The SMS message body. (max: 2000 chars)
contacts Array Yes Array of 10-15 digit mobile numbers. e.g. ["9876543210", "9123456789"] (max: 1000 contacts per campaign)

Code Examples

Send SMS OTP:
curl -X POST https://otpwallah.in/api/v1/send/sms \
  -H "Authorization: Bearer ak_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mobile": "9876543210",
    "length": 6
  }'
Verify OTP:
curl -X POST https://otpwallah.in/api/v1/verify \
  -H "Authorization: Bearer ak_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_id": "sms_550e8400-e29b-41d4-a716-446655440000",
    "otp": "482910"
  }'
Send Bulk SMS Campaign:
curl -X POST https://otpwallah.in/api/v1/bulk-sms \
  -H "Authorization: Bearer ak_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Promo Campaign",
    "message": "Check out our services!",
    "contacts": ["9876543210", "9123456789"]
  }'
Send SMS OTP:
<?php
$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => "https://otpwallah.in/api/v1/send/sms",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => json_encode([
        "mobile" => "9876543210",
        "length" => 6
    ]),
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer ak_YOUR_API_KEY",
        "Content-Type: application/json"
    ],
]);
$response = json_decode(curl_exec($curl), true);
curl_close($curl);
$request_id = $response['request_id'];
Verify OTP:
<?php
$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => "https://otpwallah.in/api/v1/verify",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => json_encode([
        "request_id" => $request_id,
        "otp"        => $_POST['otp']
    ]),
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer ak_YOUR_API_KEY",
        "Content-Type: application/json"
    ],
]);
$verify = json_decode(curl_exec($curl), true);
curl_close($curl);
if ($verify['status']) { /* OTP matched! */ }
?>
Send Bulk SMS Campaign:
<?php
$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => "https://otpwallah.in/api/v1/bulk-sms",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => json_encode([
        "title"    => "Promo Campaign",
        "message"  => "Check out our services!",
        "contacts" => ["9876543210", "9123456789"]
    ]),
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer ak_YOUR_API_KEY",
        "Content-Type: application/json"
    ],
]);
$response = json_decode(curl_exec($curl), true);
curl_close($curl);
if ($response['status']) { /* Campaign sent! */ }
?>
Send SMS OTP:
use Illuminate\Support\Facades\Http;

$response = Http::withToken('ak_YOUR_API_KEY')
    ->post('https://otpwallah.in/api/v1/send/sms', [
        'mobile' => '9876543210',
        'length' => 6,
    ]);

$requestId = $response->json('request_id');
// Store $requestId in session for verification
Verify OTP:
$verify = Http::withToken('ak_YOUR_API_KEY')
    ->post('https://otpwallah.in/api/v1/verify', [
        'request_id' => session('otp_request_id'),
        'otp'        => $request->input('otp'),
    ]);

if ($verify->json('status')) {
    // ✅ OTP matched — proceed with login/action
} else {
    // ❌ show error: $verify->json('message')
}
Send Bulk SMS Campaign:
use Illuminate\Support\Facades\Http;

$response = Http::withToken('ak_YOUR_API_KEY')
    ->post('https://otpwallah.in/api/v1/bulk-sms', [
        'title'    => 'Promo Campaign',
        'message'  => 'Check out our services!',
        'contacts' => ['9876543210', '9123456789'],
    ]);

if ($response->json('status')) {
    // ✅ Campaign sent!
}
Send SMS OTP:
const axios = require('axios');

const { data } = await axios.post('https://otpwallah.in/api/v1/send/sms', {
    mobile: '9876543210',
    length: 6
}, {
    headers: {
        'Authorization': 'Bearer ak_YOUR_API_KEY',
        'Content-Type': 'application/json'
    }
});
const requestId = data.request_id;
Verify OTP:
const result = await axios.post('https://otpwallah.in/api/v1/verify', {
    request_id: requestId,
    otp: userEnteredOtp
}, {
    headers: {
        'Authorization': 'Bearer ak_YOUR_API_KEY',
        'Content-Type': 'application/json'
    }
});

if (result.data.status) {
    console.log('OTP Verified!', result.data.verified_at);
} else {
    console.error('Failed:', result.data.code);
}
Send Bulk SMS Campaign:
const result = await axios.post('https://otpwallah.in/api/v1/bulk-sms', {
    title: 'Promo Campaign',
    message: 'Check out our services!',
    contacts: ['9876543210', '9123456789']
}, {
    headers: {
        'Authorization': 'Bearer ak_YOUR_API_KEY',
        'Content-Type': 'application/json'
    }
});

Error Codes

HTTP Code Message ID / Error Code Description
401 INVALID_API_KEY Bearer key is invalid or has been disabled by the owner.
402 INSUFFICIENT_BALANCE Your wallet account has insufficient funds. Transaction aborted.
422 VALIDATION_FAILED Request parameters are invalid (e.g. mobile doesn't match Indian format).
429 RATE_LIMIT_EXCEEDED Too many requests per minute/day. Throttling applied.