Messaging API

SMS & WhatsApp OTP API

Send OTPs via SMS and WhatsApp for secure user authentication.

Request Example
<?php $ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL => "https://app.way2api.com/api/v1/otp/send", CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer YOUR_API_KEY", "Content-Type: application/json" ], CURLOPT_POSTFIELDS => json_encode([ "mobile" => "+14155552671", "channel" => "sms" ]) ]); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); $data = json_decode($response, true); print_r($data);
const response = await fetch("https://app.way2api.com/api/v1/otp/send", { method: "POST", headers: { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" }, body: JSON.stringify({ "mobile": "+14155552671", "channel": "sms" }) }); if (!response.ok) { throw new Error(`HTTP error: ${response.status}`); } const data = await response.json(); console.log(data);
curl -X POST https://app.way2api.com/api/v1/otp/send \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{\"mobile\": \"+14155552671\", \"channel\": \"sms\"}'
$.ajax({ url: "https://app.way2api.com/api/v1/otp/send", type: "POST", contentType: "application/json", headers: { "Authorization": "Bearer YOUR_API_KEY" }, data: JSON.stringify({ "mobile": "+14155552671", "channel": "sms" }), success: function(data) { console.log(data); }, error: function(xhr) { console.error(xhr.responseJSON); } });
const { data } = await axios.post( "https://app.way2api.com/api/v1/otp/send", {"mobile": "+14155552671", "channel": "sms"}, { headers: { "Authorization": "Bearer YOUR_API_KEY" } } ); console.log(data);
import requests response = requests.post( "https://app.way2api.com/api/v1/otp/send", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" }, json={ "mobile": "+14155552671", "channel": "sms" } ) print(response.status_code) print(response.json())
Response Example
200 OK Success Response
{
    "status": "success",
    "message": "OTP sent successfully",
    "otp_id": "otp_a1b2c3d4",
    "channel": "sms",
    "expires_in": 300
}
4xx Error Response
{
    "status": "error",
    "code": 400,
    "message": "Invalid mobile number. Provide a valid phone number with country code (e.g. +14155552671)."
}
Common Response Codes
Code Meaning
200 OK — Request successful
400 Bad Request — Missing or invalid parameters
401 Unauthorized — Invalid or missing API key
429 Too Many Requests — Rate limit exceeded
500 Server Error — Try again later
Ready to integrate?

Start with free trial API calls. No credit card required.

Get API Key — Free Browse All APIs
Way2API Way2API
Contact Way2API

Login