1. Memulai
Semua endpoint memakai base URL server Anda, format JSON, dan method HTTP.
LOKAL: http://localhost:3000
POST /api/accounts— buat akunPOST /api/accounts/:id/pair— ambil kode pairing (atau scan QR)- Masukkan kode di WhatsApp → status jadi online
POST /api/accounts/:id/send— kirim pesan
2. Format Response
Semua endpoint selalu membalas JSON dengan pola:
Sukses
{
"ok": true,
"data": { ... }
}
Gagal
{
"ok": false,
"error": "pesan error"
}
HTTP status: 200 sukses · 400 input salah · 404 tidak ditemukan · 409 konflik (mis. belum online) · 502 gagal dari server WhatsApp.
3. Endpoint Akun
/api/accounts
Daftar semua nomor beserta status & statistiknya.
▸ Contoh
curl https://chat.binariscorp.co.id/api/accounts
▸ Response
{
"ok": true,
"data": [{
"id": "wa_mw0g9t9arf40m",
"label": "Sales",
"status": "online",
"phone": "6281234567890",
"name": "Budi",
"stats": { "sent": 12, "received": 5 },
"pairing": null,
"lastError": null
}]
}
/api/accounts
Tambah nomor baru. Koneksi langsung dimulai (status QR/pairing siap).
| Field | Tipe | Wajib | Keterangan |
|---|---|---|---|
| label | string | tidak | Nama akun, contoh: "Sales" |
▸ Contoh input
curl -X POST https://chat.binariscorp.co.id/api/accounts \
-H "Content-Type: application/json" \
-d '{"label":"Sales"}'
▸ Response
{
"ok": true,
"data": {
"id": "wa_mw0g9t9arf40m",
"label": "Sales",
"status": "qr",
"stats": { "sent": 0, "received": 0 }
}
}
/api/accounts/:id
Detail satu akun. :id = id dari daftar akun.
▸ Contoh
curl https://chat.binariscorp.co.id/api/accounts/wa_mw0g9t9arf40m
/api/accounts/:id/qr
QR code login (data URL PNG) — hanya saat status qr/connecting.
▸ Contoh
curl https://chat.binariscorp.co.id/api/accounts/wa_mw0g9t9arf40m/qr
/api/accounts/:id/pair
Minta kode pairing 8 digit (alternatif scan QR).
| Field | Tipe | Wajib | Keterangan |
|---|---|---|---|
| phone | string | ya | Nomor internasional tanpa +, contoh: 6281234567890 |
▸ Contoh input
curl -X POST https://chat.binariscorp.co.id/api/accounts/wa_mw0g9t9arf40m/pair \
-H "Content-Type: application/json" \
-d '{"phone":"6281234567890"}'
▸ Response
{
"ok": true,
"data": { "code": "AB12CD34", "phone": "6281234567890" }
}
Masukkan kode di HP: WhatsApp → Perangkat Tertaut → Tautkan dengan nomor telepon.
/api/accounts/:id/start
|
/api/accounts/:id/stop
Start ulang / hentikan koneksi akun.
▸ Contoh
curl -X POST https://chat.binariscorp.co.id/api/accounts/wa_mw0g9t9arf40m/start
curl -X POST https://chat.binariscorp.co.id/api/accounts/wa_mw0g9t9arf40m/stop
/api/accounts/:id/logout
|
DELETE
/api/accounts/:id
Logout (hapus sesi WA) / hapus akun beserta sesinya.
▸ Contoh
curl -X POST https://chat.binariscorp.co.id/api/accounts/wa_mw0g9t9arf40m/logout
curl -X DELETE https://chat.binariscorp.co.id/api/accounts/wa_mw0g9t9arf40m
/api/stats
|
GET
/api/health
Ringkasan (total/online/offline/terkirim) dan health check server.
▸ Contoh
curl https://chat.binariscorp.co.id/api/stats
{
"ok": true,
"data": {
"total": 2, "online": 1, "offline": 1,
"pending": 0, "sent": 15, "received": 8
}
}
4. Endpoint Pesan
/api/accounts/:id/send
Kirim pesan teks, gambar, PDF, dokumen, video, atau audio. Akun harus online.
| Field | Tipe | Wajib | Keterangan |
|---|---|---|---|
| to | string | ya | Nomor tujuan: 6281234567890 atau id grup (120363...@g.us) |
| text | string | ya* | Isi pesan / caption file |
| media | object | tidak | Lampiran file (lihat bawah) |
*wajib diisi jika tidak ada media.
a) Teks saja
▸ Contoh input
curl -X POST https://chat.binariscorp.co.id/api/accounts/wa_mw0g9t9arf40m/send \
-H "Content-Type: application/json" \
-d '{
"to": "6289876543210",
"text": "Halo, ini pesan dari API"
}'
b) File via URL (image / PDF / dokumen)
| Field media | Tipe | Keterangan |
|---|---|---|
| url | string | URL file (http/https) |
| fileName | string | Nama file (opsional, ambil dari URL) |
| mimetype | string | Contoh: application/pdf (opsional, auto-detect) |
▸ Contoh input — kirim PDF
curl -X POST https://chat.binariscorp.co.id/api/accounts/wa_mw0g9t9arf40m/send \
-H "Content-Type: application/json" \
-d '{
"to": "6289876543210",
"text": "Ini laporannya ya",
"media": { "url": "https://contoh.com/files/laporan.pdf" }
}'
▸ Contoh input — kirim gambar
curl -X POST https://chat.binariscorp.co.id/api/accounts/wa_mw0g9t9arf40m/send \
-H "Content-Type: application/json" \
-d '{
"to": "6289876543210",
"text": "Lihat foto ini",
"media": { "url": "https://contoh.com/images/foto.jpg" }
}'
c) File via base64
▸ Contoh input
curl -X POST https://chat.binariscorp.co.id/api/accounts/wa_mw0g9t9arf40m/send \
-H "Content-Type: application/json" \
-d '{
"to": "6289876543210",
"text": "Dokumen terlampir",
"media": {
"base64": "data:application/pdf;base64,JVBERi0xLjQK...",
"fileName": "laporan.pdf",
"mimetype": "application/pdf"
}
}'
d) Tanpa caption (kirim file saja)
▸ Contoh input
curl -X POST https://chat.binariscorp.co.id/api/accounts/wa_mw0g9t9arf40m/send \
-H "Content-Type: application/json" \
-d '{
"to": "6289876543210",
"media": { "url": "https://contoh.com/files/bukti.zip" }
}'
Jenis file otomatis: image/* → pesan gambar · video/* → video · audio/* → audio · lainnya (pdf/doc/xlsx/zip) → dokumen. Maks 64MB.
▸ Response sukses
{
"ok": true,
"data": {
"to": "6289876543210@s.whatsapp.net",
"sentAt": "2026-11-04T08:00:00.000Z",
"media": true
}
}
5. Status Akun
Kirim pesan hanya bisa saat status online, selain itu API membalas error 409 — Akun tidak sedang online.
6. Contoh Lengkap (dari nol sampai kirim)
# 1) Buat akun
ID=$(curl -s -X POST https://chat.binariscorp.co.id/api/accounts \
-H "Content-Type: application/json" \
-d '{"label":"Sales"}' | grep -o '"id":"[^"]*"' | cut -d'"' -f4)
echo $ID
# 2) Ambil kode pairing
curl -X POST https://chat.binariscorp.co.id/api/accounts/$ID/pair \
-H "Content-Type: application/json" \
-d '{"phone":"6281234567890"}'
# → {"data":{"code":"AB12CD34"}} — masukkan kode di HP
# 3) Cek status sampai online
curl https://chat.binariscorp.co.id/api/accounts/$ID
# 4) Kirim teks
curl -X POST https://chat.binariscorp.co.id/api/accounts/$ID/send \
-H "Content-Type: application/json" \
-d '{"to":"6289876543210","text":"Halo!"}'
# 5) Kirim PDF
curl -X POST https://chat.binariscorp.co.id/api/accounts/$ID/send \
-H "Content-Type: application/json" \
-d '{"to":"6289876543210","text":"Lampiran","media":{"url":"https://contoh.com/laporan.pdf"}}'
WhatsApp API Dashboard — dokumentasi endpoint v1