Integrate OTP delivery and authentication within your external services.
Follow these 3 simple steps to integrate secure OTP operations in your application:
Sign in to the Admin Panel, navigate to **Clients**, create a profile, and copy your unique token.
Send a POST request to `/api/otp/send` with the user's phone number and pass your `x-api-key` header.
Verify the matching user-entered OTP by requesting `/api/otp/verify` with the `otpId` and verification code.
https://otp.campofall.com/api
Identify your client workspace by passing the designated key inside the x-api-key HTTP header.
x-api-key: otp_43701c205d5e09456ebae080981d6216eaec0b4730134bbd
Deliver a standard OTP code to a destination phone number.
POST /api/otp/send
| Header | Required |
|---|---|
x-api-key | Yes |
Content-Type | application/json |
Request Payload:
{
"phoneNumber": "9876543210"
}
Response Payload:
{
"success": true,
"message": "OTP sent successfully",
"otpId": "abc-123-xyz"
}
Verify a matching user-entered OTP session code.
POST /api/otp/verify
| Header | Required |
|---|---|
x-api-key | Yes |
Content-Type | application/json |
Request Payload:
{
"otpId": "abc-123-xyz",
"otpCode": "482916"
}
Response Payload:
{
"success": true,
"message": "OTP verified successfully",
"verified": true
}
View recent logs and history for your client credentials.
GET /api/otp/history
Response Payload:
{
"success": true,
"data": [
{
"phoneNumber": "9876543210",
"status": "verified",
"createdAt": "2026-06-09T..."
}
]
}
Track total verified events and remaining daily allocations.
GET /api/otp/stats
Response Payload:
{
"success": true,
"data": {
"dailyLimit": 100,
"otpUsedToday": 5,
"totalSent": 42,
"totalVerified": 38,
"remainingToday": 95
}
}
const axios = require('axios');
const api = axios.create({
baseURL: 'https://otp.campofall.com/api',
headers: { 'x-api-key': 'YOUR_API_KEY_HERE' }
});
// Send OTP
const sendRes = await api.post('/otp/send', { phoneNumber: '9876543210' });
const otpId = sendRes.data.otpId;
// Verify OTP
const verifyRes = await api.post('/otp/verify', { otpId, otpCode: '482916' });
console.log(verifyRes.data.verified); // true/false
import requests
headers = {'x-api-key': 'YOUR_API_KEY_HERE'}
base = 'https://otp.campofall.com/api'
# Send OTP
r = requests.post(f'{base}/otp/send',
json={'phoneNumber': '9876543210'}, headers=headers)
otp_id = r.json()['otpId']
# Verify OTP
r = requests.post(f'{base}/otp/verify',
json={'otpId': otp_id, 'otpCode': '482916'}, headers=headers)
print(r.json()['verified'])
# Check stats
r = requests.get(f'{base}/otp/stats', headers=headers)
print(r.json()['data'])
<?php
function sendOtp($phone) {
$ch = curl_init('https://otp.campofall.com/api/otp/send');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'x-api-key: YOUR_API_KEY_HERE',
'Content-Type: application/json'
],
CURLOPT_POSTFIELDS => json_encode(['phoneNumber' => $phone]),
CURLOPT_RETURNTRANSFER => true,
]);
return json_decode(curl_exec($ch), true);
}
function verifyOtp($otpId, $otpCode) {
$ch = curl_init('https://otp.campofall.com/api/otp/verify');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'x-api-key: YOUR_API_KEY_HERE',
'Content-Type: application/json'
],
CURLOPT_POSTFIELDS => json_encode([
'otpId' => $otpId, 'otpCode' => $otpCode
]),
CURLOPT_RETURNTRANSFER => true,
]);
return json_decode(curl_exec($ch), true);
}
$send = sendOtp('9876543210');
$verify = verifyOtp($send['otpId'], '482916');
?>
# Send OTP
curl -X POST https://otp.campofall.com/api/otp/send \
-H "x-api-key: YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{"phoneNumber": "9876543210"}'
# Verify OTP
curl -X POST https://otp.campofall.com/api/otp/verify \
-H "x-api-key: YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{"otpId": "FROM_SEND_RESPONSE", "otpCode": "482916"}'
# Get Stats
curl https://otp.campofall.com/api/otp/stats \
-H "x-api-key: YOUR_API_KEY_HERE"