API Reference
REST/JSON API for sending SMS OTPs to Syrian phone numbers.
Introduction
The Aman Gate API lets you send one-time passwords via SMS to Syrian numbers. All requests and responses use application/json. You need an active subscription to send OTPs โ contact sales to subscribe.
Authentication
Every request must include your API token in the Authorization header. Find your token in the Developer section of your dashboard.
๐
Authorization: Token <your_api_token>
Error Codes
| 201 | OTP sent successfully |
| 400 | Validation error โ check request body |
| 401 | Missing or invalid token |
| 402 | No active subscription or quota exceeded |
| 403 | IP not whitelisted |
Send OTP
POST
/api/otp/send/
Send a one-time password to a phone number via SMS
โน๏ธ
Requires an active subscription and an approved message template. Failed deliveries are not charged.
Request Body
| Field | Type | Description |
|---|---|---|
| gsm | string | Phone in international format (e.g. 963911000000) required |
| template_id | integer | ID of an approved message template from your account required |
| code | string | The OTP code to inject into the template (e.g. "482910") required |
| language | integer | 0 = Arabic 1 = English optional ยท default: 1 |
curl -X POST https://aman-gate.com/api/otp/send/ \ -H "Authorization: Token MY_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "gsm": "963911000000", "template_id": 1, "code": "482910", "language": 1 }'
import requests url = "https://aman-gate.com/api/otp/send/" headers = {"Authorization": "Token MY_TOKEN", "Content-Type": "application/json"} payload = { "gsm": "963911000000", "template_id": 1, "code": "482910", "language": 1, # 0 = Arabic, 1 = English } r = requests.post(url, json=payload, headers=headers) if r.status_code == 201: data = r.json() print(f"Sent โ ID={data['id']} status={data['status']}") else: print("Error:", r.json())
async function sendOtp(phone, code, templateId) { const res = await fetch("https://aman-gate.com/api/otp/send/", { method: "POST", headers: { "Authorization": "Token MY_TOKEN", "Content-Type": "application/json", }, body: JSON.stringify({ gsm: phone, template_id: templateId, code: code, language: 1, // 0 = Arabic, 1 = English }), }); const data = await res.json(); if (res.ok) console.log(`Sent โ ID=${data.id}`); else console.error("Error:", data); } sendOtp("963911000000", "482910", 1);
function sendOtp($phone, $code, $templateId, $token) { $ch = curl_init("https://aman-gate.com/api/otp/send/"); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode([ 'gsm' => $phone, 'template_id' => $templateId, 'code' => $code, 'language' => 1, // 0 = Arabic, 1 = English ]), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Token {$token}", "Content-Type: application/json", ], ]); $result = json_decode(curl_exec($ch), true); curl_close($ch); return $result; } // Usage $r = sendOtp("963911000000", "482910", 1, "MY_TOKEN"); echo "Sent โ ID={$r['id']}";
Responses
201 Created โ OTP sent successfully
{
"id": 1427,
"gsm": "963911000000",
"template": 1,
"template_name": "Login OTP",
"template_code": "482910",
"message": "Your verification code is: 482910",
"status": "sent",
"provider_response": "OK",
"created_at": "2025-03-25T03:00:00Z"
}
400 Bad Request โ validation error
{ "gsm": ["This field is required."] }
402 Payment Required โ no subscription / quota exceeded
{ "detail": "No active subscription or insufficient balance." }
Need an API key or have questions? Contact our team.
Contact Sales โ