@extends('root') @section('title', 'API Documentation') @section('content')
Dokumentasi lengkap API untuk Reseller dan Client. Format RESTful dengan autentikasi API Key & Server Key.
WABA SaaS API menyediakan akses programmatik untuk mengelola WhatsApp Business Account (WABA) melalui Meta Graph API. API ini dirancang dengan arsitektur RESTful, menggunakan JSON untuk request dan response.
{{ url('/api') }}| Use Case | Role | Endpoint |
|---|---|---|
| Buat client baru | Reseller | POST /api/v1/clients |
| Kirim pesan template | Client | POST /api/v1/message/send |
| Cek saldo | Client | GET /api/v1/balance |
| Buat template baru | Reseller/Client | POST /api/v1/templates |
| Topup saldo | Client | POST /api/v1/topup/create |
Sistem menggunakan dual-key authentication:
Kedua key harus dikirim melalui HTTP Header pada setiap request:
Authorization: Bearer {server_key}
X-Api-Key: {api_key}
Content-Type: application/json
curl -X POST {{ url('/api/v1/balance') }} \
-H "Authorization: Bearer 9d2c8f1a-4b5e-4c6d-8e9f-0a1b2c3d4e5f|a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6" \
-H "X-Api-Key: 4f8b9c2d-1e3f-4a5b-6c7d-8e9f0a1b2c3d" \
-H "Content-Type: application/json"
Untuk regenerate API Key (Client):
POST {{ url('/api/v1/api-key/regenerate') }}
Headers:
Authorization: Bearer {server_key}
X-Api-Key: {api_key}
Response:
{
"api_key": "new_generated_api_key"
}
Method: POST
Path: /api/v1/clients
Deskripsi: Reseller membuat client baru dan mengikat ke akun reseller.
Authorization: Bearer {server_key}
X-Api-Key: {api_key}
Content-Type: application/json
{
"name": "PT Maju Jaya",
"email": "client@example.com",
"password": "SandiKuat123",
"package": "shared",
"rate_limit_per_minute": 120
}
{
"meta": {
"code": 200,
"status": "success",
"message": "Client berhasil dibuat melalui API"
},
"data": {
"id": 45,
"name": "PT Maju Jaya",
"email": "client@example.com",
"reseller_id": 7,
"balance": "0.0000",
"rate_limit_per_minute": 120,
"is_active": true
}
}
{
"meta": {
"code": 401,
"status": "error",
"message": "API Key atau Server Key tidak valid"
},
"data": null
}
Method: POST
Path: /api/v1/templates
Deskripsi: Buat template baru dan kirim ke Meta untuk approval.
{
"waba_pool_id": 3,
"name": "Order Confirm",
"category": "utility",
"language": "id",
"header_type": "text",
"header_text": "Judul {{1}}",
"body_text": "Halo {{1}}, pesanan {{2}} telah dikirim.",
"footer_text": "Terima kasih",
"buttons": [
{
"type": "URL",
"text": "Lihat Pesanan",
"url": "https://domain.com/order/{{1}}"
}
]
}
{
"meta": {
"code": 200,
"status": "success",
"message": "Template berhasil dibuat dan dikirim ke Meta untuk approval"
},
"data": {
"template": {
"id": 123,
"name": "7_reseller_order_confirm",
"status": "pending"
},
"meta": {
"id": "12345"
}
}
}
Method: POST
Path: /api/reseller/templates/{id}/test-send
Deskripsi: Kirim test template ke nomor WhatsApp tertentu.
id - ID template (integer){
"phone_number": "6281234567890",
"header_params": ["Judul X"],
"body_params": ["Budi", "INV-123"]
}
| Method | Endpoint | Deskripsi | Auth |
|---|---|---|---|
POST |
/api/v1/clients |
Buat client baru | API Key + Server Key |
POST |
/api/v1/templates |
Buat template & kirim ke Meta | API Key + Server Key |
POST |
/api/v1/templates/sync-status |
Sync status template dari Meta | API Key + Server Key |
GET |
/api/v1/templates |
List template | API Key + Server Key |
POST |
/api/reseller/templates/{id}/test-send |
Test send template | API Key + Server Key |
Method: POST
Path: /api/v1/message/send
Deskripsi: Kirim pesan template ke nomor WhatsApp. Pengiriman dilakukan secara sinkron (tanpa queue).
{
"id_template": 12,
"to": "628111223344",
"parameters": ["Budi", "INV-123"]
}
{
"status": "success",
"message_id": "550e8400-e29b-41d4-a716-446655440000",
"price": 376,
"template": "client_12_order_confirm",
"type": "Utility"
}
{
"status": "error",
"message": "Template tidak tersedia untuk client ini"
}
Method: GET
Path: /api/v1/balance
Deskripsi: Cek saldo akun client.
{
"balance": 12500.0
}
Method: GET
Path: /api/v1/templates
Deskripsi: Daftar template yang tersedia untuk client (template sendiri, reseller, atau admin).
{
"data": [
{
"id": 12,
"name": "client_12_order_confirm",
"category": "utility",
"status": "approved",
"language": "id",
"body": "Halo {{1}}, pesanan {{2}} telah dikirim."
}
]
}
Method: POST
Path: /api/v1/topup/create
Deskripsi: Buat transaksi topup saldo melalui Midtrans.
{
"amount": 50000
}
{
"redirect_url": "https://app.midtrans.com/snap/v2/vtweb/...",
"token": "abc123..."
}
| Method | Endpoint | Deskripsi | Auth |
|---|---|---|---|
POST |
/api/v1/message/send |
Kirim template message | API Key + Server Key |
GET |
/api/v1/templates |
List template tersedia | API Key + Server Key |
POST |
/api/v1/templates |
Buat template baru | API Key + Server Key |
GET |
/api/v1/balance |
Cek saldo | API Key + Server Key |
POST |
/api/v1/topup/create |
Buat transaksi topup | API Key + Server Key |
GET |
/api/v1/usage |
Cek usage pesan | API Key + Server Key |
POST |
/api/v1/api-key/regenerate |
Regenerate API key | API Key + Server Key |
GET |
/api/v1/whitelist |
List IP whitelist | API Key + Server Key |
POST |
/api/v1/whitelist |
Tambah IP whitelist | API Key + Server Key |
DELETE |
/api/v1/whitelist/{id} |
Hapus IP whitelist | API Key + Server Key |
| Code | HTTP Status | Message | Penjelasan |
|---|---|---|---|
1001 |
401 | Invalid API Key | API Key tidak valid atau tidak ditemukan |
1002 |
401 | Invalid Server Key | Server Key salah atau tidak cocok dengan API Key |
1003 |
401 | Unauthorized | Kombinasi API Key dan Server Key tidak valid |
2001 |
400 | Missing Parameter | Parameter wajib tidak diisi dalam request |
2002 |
400 | Invalid Parameter | Format atau nilai parameter tidak valid |
2101 |
400 | Language Invalid | Kode bahasa tidak didukung (hanya: id, en_US, en, ar, hi) |
2102 |
400 | Components Invalid | Struktur komponen template tidak sesuai standar Meta |
2201 |
409 | Duplicate Template | Nama template sudah ada di akun WABA |
3001 |
403 | Template Not Allowed | Client tidak memiliki akses ke template ini |
3002 |
403 | Client Inactive | Akun client atau reseller tidak aktif |
4004 |
404 | Not Found | Resource (template, client, dll) tidak ditemukan |
4290 |
429 | Rate Limit Exceeded | Melebihi batas request per menit |
5001 |
500 | Meta API Error | Kesalahan dari Meta Graph API (template/message) |
5002 |
502 | Upstream Error | Kesalahan gateway atau koneksi ke Meta |
5003 |
500 | Internal Error | Kesalahan internal server yang tidak terduga |
rate_limit_per_minute yang dapat dikonfigurasiJika Anda mengalami kendala saat integrasi, hubungi tim support kami.
Hubungi SupportRetry untuk error berikut:
Jangan retry untuk:
| Kategori | Deskripsi | Use Case |
|---|---|---|
UTILITY |
Pesan transaksional | Konfirmasi order, invoice, notifikasi pengiriman |
OTP |
One-Time Password | Verifikasi login, reset password |
MARKETING |
Pesan promosi | Promo produk, newsletter, campaign |
SERVICE |
Pesan layanan | Update akun, notifikasi sistem |
language (harus: id, en_US, en, ar, hi)components sesuai spesifikasi MetaAturan penting untuk payload template:
language harus salah satu: id, en_US, en, ar, hiname harus snake_case lowercase (contoh: client_12_order_confirm)BODY wajib ada{{1}}, {{2}}, dst (harus berurutan)https://+628xx)shared atau dedicated