API documentation
Send WhatsApp verification codes and notifications from your own numbers with a single HTTP request.
Quick start
- Create an account and verify it with the code.
- Link a WhatsApp number from “WhatsApp numbers” by scanning a QR code.
- Create an API key from “API keys” (shown once — keep it safe).
- Send your first message with one POST request (ready-made examples below).
Base URL: https://whats.aqwasoft.com/api/v1
Authentication
Every request carries your API key in the Authorization header. Never put the key in browser or app code — use it from your server only.
Authorization: Bearer aqw_live_xxxxxxxxxxxxxxxxxxxx
Alternative: the X-Api-Key header with the same value.
Send a message POST /api/v1/messages
The message is queued and the call returns immediately (202) with its id and status queued; it is sent within seconds.
| Field | Required | Description |
|---|---|---|
to | ✓ | Recipient in international format with the country code (with or without +). |
body | ✓ | Message text up to 4096 characters (the field message is also accepted). |
type | — | text (default) for notifications, or otp for verification codes — prioritized, and they expire if delayed. |
use Illuminate\Support\Facades\Http;
$res = Http::withToken(env('AQWA_API_KEY'))
->acceptJson()
->post(env('AQWA_API_URL').'/messages', [
'to' => '9665XXXXXXXX', // الرقم الدولي
'body' => "رمز التحقق: {$code}",
'type' => 'otp', // أو text للإشعارات
]);
if ($res->status() === 429) {
$wait = $res->header('Retry-After'); // انتظر قبل المحاولة
}
$messageId = $res->json('data.id'); // msg_…
$ch = curl_init('https://whats.aqwasoft.com/api/v1/messages');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer '.getenv('AQWA_API_KEY'),
'Content-Type: application/json',
'Accept: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'to' => '9665XXXXXXXX',
'body' => 'تم تأكيد طلبك رقم 1048',
'type' => 'text',
]),
]);
$data = json_decode(curl_exec($ch), true);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE); // 202 عند القبول
const res = await fetch(`${process.env.AQWA_API_URL}/messages`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.AQWA_API_KEY}`,
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify({ to: '9665XXXXXXXX', body: `رمز التحقق: ${code}`, type: 'otp' }),
});
if (res.status === 429) {
const wait = res.headers.get('Retry-After'); // ثوانٍ قبل المحاولة
}
const { data } = await res.json(); // data.id , data.status
import os, requests
res = requests.post(
f"{os.environ['AQWA_API_URL']}/messages",
headers={"Authorization": f"Bearer {os.environ['AQWA_API_KEY']}", "Accept": "application/json"},
json={"to": "9665XXXXXXXX", "body": "تذكير بموعدك غدًا", "type": "text"},
timeout=15,
)
if res.status_code == 429:
wait = int(res.headers.get("Retry-After", "60"))
message_id = res.json()["data"]["id"]
curl -X POST https://whats.aqwasoft.com/api/v1/messages \
-H "Authorization: Bearer $AQWA_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"to":"9665XXXXXXXX","body":"رمز التحقق: 482913","type":"otp"}'
Response (202):
{
"success": true,
"data": {
"id": "msg_01j9zq4k2r5t8y1u3i6o9p2a4s",
"to": "9665XXXXXXXX",
"type": "otp",
"status": "queued",
"error": null,
"created_at": "2026-09-27T10:15:01+03:00",
"sent_at": null,
"delivered_at": null,
"read_at": null,
"expires_at": "2026-09-27T10:20:01+03:00"
}
}
The legacy path POST /api/v1/send still works the same way.
Message status GET /api/v1/messages/{id}
Look it up by its msg_… id (you only see your own messages), or enable webhooks to receive changes automatically.
queued → processing → sent ✓ → delivered ✓✓ → read ✓✓
| status | Description |
|---|---|
queued | Queued, will be sent within seconds. |
processing | Being sent right now. |
sent | Handed to WhatsApp (✓). |
delivered | Reached the recipient’s phone (✓✓) — with delivered_at. |
read | Read by the recipient (blue ✓✓) — with read_at. Not reported if they turned off read receipts. |
failed | Failed — the reason is in error (e.g. not_on_whatsapp or no_connected_session). |
expired | The OTP expired before it could be sent, so it was not sent. |
$res = Http::withToken(env('AQWA_API_KEY'))
->acceptJson()
->get(env('AQWA_API_URL').'/messages/'.$messageId);
$status = $res->json('data.status'); // queued | sent | failed | expired
$ch = curl_init('https://whats.aqwasoft.com/api/v1/messages/'.$messageId);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer '.getenv('AQWA_API_KEY'), 'Accept: application/json'],
]);
$status = json_decode(curl_exec($ch), true)['data']['status'];
const res = await fetch(`${process.env.AQWA_API_URL}/messages/${messageId}`, {
headers: { 'Authorization': `Bearer ${process.env.AQWA_API_KEY}`, 'Accept': 'application/json' },
});
const { data } = await res.json(); // data.status
res = requests.get(
f"{os.environ['AQWA_API_URL']}/messages/{message_id}",
headers={"Authorization": f"Bearer {os.environ['AQWA_API_KEY']}", "Accept": "application/json"},
timeout=15,
)
status = res.json()["data"]["status"]
curl https://whats.aqwasoft.com/api/v1/messages/{id} \
-H "Authorization: Bearer $AQWA_API_KEY" \
-H "Accept: application/json"
Account check GET /api/v1/account
Check that the key is valid, the account is active and a number is connected — without sending any message. Ideal for a periodic health check in your system.
{
"success": true,
"data": {
"account": {
"type": "subscriber",
"name": "متجر نخلة",
"status": "active"
},
"key": {
"name": "Production server",
"prefix": "aqw_live_Ab12Cd",
"last_used_at": "2026-09-27T10:15:01+03:00"
},
"numbers": {
"connected": 1,
"total": 1
},
"ready": true,
"limits": {
"requests_per_minute": 60,
"otp_cooldown_seconds": 30,
"…": "…"
},
"api_version": "v1"
}
}
ready = false means no WhatsApp number is connected right now: messages will wait in the queue and may fail. Link a number from your panel.
Idempotency (Idempotency-Key)
If the connection drops before you get the response and you retry, the user may receive two codes. Send an Idempotency-Key header with a unique value per operation:
curl -X POST https://whats.aqwasoft.com/api/v1/messages \
-H "Authorization: Bearer $AQWA_API_KEY" \
-H "Idempotency-Key: order-1048-otp" \
-H "Content-Type: application/json" \
-d '{"to":"9665XXXXXXXX","body":"رمز التحقق: 482913","type":"otp"}'
- The same request with the same key within 24 hours returns the first response (same message id) with Idempotent-Replayed: true — nothing is sent twice.
- Same key with a different request → 422 idempotency_conflict. Two concurrent requests → 409 idempotency_in_progress.
- Failed requests are not stored, so you can fix and retry them with the same key. The header is optional and recommended for OTP.
Webhooks
Enable them in your panel (Developers → Webhooks): we POST to your URL on every status change of your messages, with the same message data as the API.
| Events | Description |
|---|---|
message.sent | Handed to WhatsApp. |
message.delivered | Reached the recipient’s phone. |
message.read | Read by the recipient. |
message.failed | Failed (reason in data.error). |
message.expired | The OTP expired before it could be sent. |
Example “delivered” notification:
POST https://your-system.com/webhooks/aqwa
X-Aqwa-Event: message.delivered
X-Aqwa-Delivery: evt_01j9zq4m8h2k7x3v5b6n1c0d9e
X-Aqwa-Signature: t=1790493304,v1=5f2b…
{
"id": "evt_01j9zq4m8h2k7x3v5b6n1c0d9e",
"event": "message.delivered",
"created_at": "2026-09-27T10:15:04+03:00",
"data": {
"id": "msg_01j9zq4k2r5t8y1u3i6o9p2a4s",
"to": "9665XXXXXXXX",
"type": "otp",
"status": "delivered",
"error": null,
"created_at": "2026-09-27T10:15:01+03:00",
"sent_at": "2026-09-27T10:15:02+03:00",
"delivered_at": "2026-09-27T10:15:04+03:00",
"read_at": null,
"expires_at": "2026-09-27T10:20:01+03:00"
}
}
Verifying the signature
X-Aqwa-Signature is t=<time>,v1=<signature>, where the signature = HMAC-SHA256 of “t.raw body” with the signing secret from your panel. Compare with a constant-time function and reject times older than 5 minutes:
// Laravel — routes/api.php
Route::post('/webhooks/aqwa', function (Request $request) {
$body = $request->getContent();
$header = (string) $request->header('X-Aqwa-Signature'); // t=...,v1=...
preg_match('/^t=(\d+),v1=([a-f0-9]{64})$/', $header, $m) || abort(400);
$expected = hash_hmac('sha256', $m[1].'.'.$body, env('AQWA_WEBHOOK_SECRET'));
abort_unless(hash_equals($expected, $m[2]) && abs(time() - (int) $m[1]) < 300, 400);
$event = $request->json('event'); // message.delivered ...
$message = $request->json('data'); // id, to, status, delivered_at ...
// حدّث حالة الرسالة في نظامك هنا (تجاهل event id المكرر)
return response()->noContent(); // 2xx = تم الاستلام
});
// Node.js (Express) — استخدم الجسم الخام كما وصل
app.post('/webhooks/aqwa', express.raw({ type: 'application/json' }), (req, res) => {
const [, t, sig] = /^t=(\d+),v1=([a-f0-9]{64})$/.exec(req.get('X-Aqwa-Signature') || '') || [];
const expected = crypto.createHmac('sha256', process.env.AQWA_WEBHOOK_SECRET)
.update(`${t}.${req.body}`).digest('hex');
if (!sig || !crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected))
|| Math.abs(Date.now() / 1000 - t) > 300) return res.sendStatus(400);
const { event, data } = JSON.parse(req.body);
// حدّث حالة الرسالة في نظامك هنا
res.sendStatus(204);
});
Return any 2xx within 10 seconds. Otherwise we retry after 1 minute, 5 minutes, 30 minutes, 2 hours and 6 hours. An event may arrive more than once — deduplicate by its id.
Rate limits
The platform’s current limits (they protect your number and your recipients from bans). When exceeded: 429 with Retry-After.
- 60 requests per minute per key.
- At least 30 seconds between two OTPs to the same number.
- At most 10 OTPs to the same number within 5 minutes.
- At most 50 OTPs to the same number per day.
- An OTP is not sent if it stays queued longer than 5 minutes (status expired).
- At most 20 regular messages to the same number per hour.
Errors
Every error has the same shape, and error.code is stable so you can handle it in code (the message is for humans and follows Accept-Language):
HTTP/1.1 429 Too Many Requests
Retry-After: 42
X-Request-Id: req_01j9zq4m8h2k7x3v5b6n1c0d9e
{
"success": false,
"error": {
"code": "rate_limited",
"limit": "otp_cooldown",
"message": "\u2026",
"retry_after": 42
},
"request_id": "req_01j9zq4m8h2k7x3v5b6n1c0d9e"
}
| error.code | HTTP code | Description |
|---|---|---|
missing_api_key | 401 | No key was sent. |
invalid_api_key | 401 | The key is wrong or revoked. |
account_inactive | 403 | The account is suspended or not activated. |
not_found | 404 | Unknown path, or the message does not exist (or is not yours). |
idempotency_in_progress | 409 | Another request with the same Idempotency-Key is in progress. |
validation_error | 422 | A field is missing or invalid — details in error.fields. |
idempotency_conflict | 422 | The Idempotency-Key was used for a different request. |
rate_limited | 429 | A limit was hit — error.limit names it; wait retry_after seconds. |
server_error | 500 | Unexpected error — retry, and send us the request_id if it persists. |
Versioning & support
All paths live under /api/v1 and will not change in a way that breaks your integration; incompatible changes come in /api/v2. Every response carries X-Request-Id — include it when you contact us.
OpenAPI file (openapi.json) — Import it into Postman or Insomnia to try every request right away.