Dokumentasi API WA Gateway
Kirim dan terima pesan WhatsApp lewat REST API — satu API Key per device.
Semua endpoint REST API publik diakses lewat https://api.jarswa.com.
Untuk mengelola akun, device, dan paket kuota, gunakan dashboard di
https://jarswa.com.
Autentikasi
Tiap device punya API Key sendiri (lihat di halaman Device pada dashboard). Sertakan di setiap request lewat header berikut:
Authorization: Bearer {api_key_device}
Kalau kuota pesan device kamu habis, endpoint kirim pesan akan menolak request dengan status
402 Payment Required. Beli paket kuota untuk device tersebut lewat dashboard untuk melanjutkan.
Kirim Pesan
POST https://api.jarswa.com/send-message
| Field | Tipe | Keterangan |
|---|---|---|
to | string | Nomor tujuan, format 62812xxxxxxx |
text | string | Isi pesan |
curl -X POST https://api.jarswa.com/send-message \
-H "Authorization: Bearer wagw_live_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"to":"6281234567890","text":"Halo dari WA Gateway!"}'
Response sukses:
{ "success": true, "remainingQuota": 4899 }
Status Device
GET https://api.jarswa.com/device-status
curl https://api.jarswa.com/device-status \
-H "Authorization: Bearer wagw_live_xxxxxxxx"
{ "success": true, "status": "connected" }
Ambil QR
GET https://api.jarswa.com/qr
Dipakai kalau kamu mau tampilkan ulang QR code di sistem sendiri (di luar dashboard WA Gateway).
curl https://api.jarswa.com/qr \
-H "Authorization: Bearer wagw_live_xxxxxxxx"
Cek Kuota
GET https://api.jarswa.com/quota
curl https://api.jarswa.com/quota \
-H "Authorization: Bearer wagw_live_xxxxxxxx"
{ "success": true, "remaining": 4899, "nearestExpiry": "2026-08-12T00:00:00.000Z" }
Riwayat Pesan
GET https://api.jarswa.com/message-history
curl https://api.jarswa.com/message-history \
-H "Authorization: Bearer wagw_live_xxxxxxxx"
Webhook Pesan Masuk
Kalau kamu isi Webhook URL di pengaturan device pada dashboard, setiap pesan
masuk akan otomatis di-forward ke URL itu lewat POST, format JSON:
{
"deviceId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"from": "6281234567890@s.whatsapp.net",
"type": "conversation",
"body": "Halo, ini pesan masuk",
"pushName": "Nama Pengirim",
"timestamp": 1755000000000
}
Format Error
Semua error dari API mengikuti format yang sama:
{ "success": false, "message": "Penjelasan error dalam Bahasa Indonesia" }
| Kode | Arti |
|---|---|
| 401 | API Key tidak valid / tidak disertakan |
| 402 | Kuota pesan habis |
| 404 | Device tidak ditemukan |
| 409 | Device belum terhubung (belum scan QR) |
| 429 | Batas maksimal device tercapai |