⚡ API Reference

Dokumentasi API OpenWA.

Semua endpoint REST + JSON. Base URL: https://openwa.click. Auth: x-api-key: owa_… header (lihat /panduan).

Daftar Isi

Session & QR

Kelola koneksi WhatsApp per session. Session = 1 nomor WA.

GET/api/sessionsList sessions

Ambil daftar semua session dan statusnya (open / connecting / disconnected).

cURL
curl -X GET https://openwa.click/api/sessions \
  -H "x-api-key: owa_YOUR_KEY"
POST/api/sessionsCreate session

Buat session baru (butuh scan QR berikutnya).

Body
{ "id": "marketing" }
cURL
curl -X POST https://openwa.click/api/sessions \
  -H "x-api-key: owa_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "id": "marketing" }'
DELETE/api/sessionsLogout session

Hapus session + auth data.

Body
{ "id": "marketing" }
cURL
curl -X DELETE https://openwa.click/api/sessions \
  -H "x-api-key: owa_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "id": "marketing" }'
GET/api/status?session=mainStatus

Status session sekarang + apakah QR tersedia.

cURL
curl -X GET https://openwa.click/api/status"?session=main" \
  -H "x-api-key: owa_YOUR_KEY"
GET/api/qr?session=mainQR PNG

PNG QR code (scan via WA → Linked Devices). 404 kalau belum tersedia atau sudah connected.

cURL
curl -X GET https://openwa.click/api/qr"?session=main" \
  -H "x-api-key: owa_YOUR_KEY"

Kirim Pesan

Kirim text, media, atau mention grup.

POST/api/sendKirim text (atau mention grup)

Untuk kontak atau grup. Mentions: array phone, atau ['all'] untuk @semua di grup.

🔒 scope: send
Body
{
  "session": "main",
  "to": "628123456789",
  "message": "Halo dari OpenWA",
  "mentions": ["all"]
}
Response
{ "ok": true, "id": "<message_id>", "session": "main" }
cURL
curl -X POST https://openwa.click/api/send \
  -H "x-api-key: owa_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "session": "main", "to": "628123456789", "message": "Halo dari OpenWA", "mentions": ["all"]
}'
POST/api/send/mediaKirim media

Kind: image / video / document / audio / sticker. Source: url ATAU base64. Gambar auto-kompres; sticker auto-WebP 512×512.

🔒 scope: send
Body
{
  "session": "main",
  "to": "628123456789",
  "kind": "image",
  "url": "https://example.com/photo.jpg",
  "caption": "Promo hari ini",
  "compress": true
}
cURL
curl -X POST https://openwa.click/api/send/media \
  -H "x-api-key: owa_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "session": "main", "to": "628123456789", "kind": "image", "url": "https://example.com/photo.jpg", "caption": "Promo hari ini", "compress": true
}'
POST/api/status/postPost Status WhatsApp

Kirim status text (story) ke status@broadcast.

🔒 scope: send
Body
{ "session": "main", "text": "Lagi promo!", "backgroundColor": "#10b981" }
cURL
curl -X POST https://openwa.click/api/status/post \
  -H "x-api-key: owa_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "session": "main", "text": "Lagi promo!", "backgroundColor": "#10b981" }'
GET/api/groups?session=mainList grup

Daftar grup yang diikuti session ini. Pakai .id sebagai to= di /api/send.

cURL
curl -X GET https://openwa.click/api/groups"?session=main" \
  -H "x-api-key: owa_YOUR_KEY"

Template & Broadcast

Broadcast massal dengan antrian, jadwal, dan template {{var}}.

POST/api/templatesCreate template

Buat template pesan dengan placeholder {{nama}}.

Body
{ "session": "main", "name": "greeting", "body": "Halo {{nama}}, terima kasih order {{produk}}!" }
cURL
curl -X POST https://openwa.click/api/templates \
  -H "x-api-key: owa_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "session": "main", "name": "greeting", "body": "Halo {{nama}}, terima kasih order {{produk}}!" }'
GET/api/templates?session=mainList templates

Ambil semua template untuk session.

cURL
curl -X GET https://openwa.click/api/templates"?session=main" \
  -H "x-api-key: owa_YOUR_KEY"
PUT/api/templates/[id]Update template

Update nama/body.

Body
{ "name": "new-name", "body": "..." }
cURL
curl -X PUT https://openwa.click/api/templates/[id] \
  -H "x-api-key: owa_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "new-name", "body": "..." }'
DELETE/api/templates/[id]Delete template

Hapus template.

cURL
curl -X DELETE https://openwa.click/api/templates/[id] \
  -H "x-api-key: owa_YOUR_KEY"
POST/api/broadcastQueue broadcast

Jadwalkan broadcast. Worker jalan tiap 5s, jeda acak 3–12s antar kirim, cap 300/hari/nomor.

Body
{
  "session": "main",
  "name": "promo oktober",
  "templateId": "tpl_xxx",
  "scheduledAt": "2026-04-21T09:00:00Z",
  "recipients": [
    { "phone": "628111", "vars": { "nama": "Budi", "produk": "Batik" } }
  ]
}
cURL
curl -X POST https://openwa.click/api/broadcast \
  -H "x-api-key: owa_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "session": "main", "name": "promo oktober", "templateId": "tpl_xxx", "scheduledAt": "2026-04-21T09:00:00Z", "recipients": [ { "phone": "628111", "vars": { "nama": "Budi", "produk": "Batik" } } ]
}'
GET/api/broadcast?session=mainList broadcasts

Progress: status, sent, failed, total.

cURL
curl -X GET https://openwa.click/api/broadcast"?session=main" \
  -H "x-api-key: owa_YOUR_KEY"
GET/api/broadcast/[id]Broadcast detail

Detail 1 broadcast.

cURL
curl -X GET https://openwa.click/api/broadcast/[id] \
  -H "x-api-key: owa_YOUR_KEY"
DELETE/api/broadcast/[id]Cancel broadcast

Batalkan broadcast pending/running.

cURL
curl -X DELETE https://openwa.click/api/broadcast/[id] \
  -H "x-api-key: owa_YOUR_KEY"

Webhook

Terima event inbound (pesan masuk, ack, edited, deleted, call, group).

PUT/api/webhookSet/update webhook

Set URL penerima event. Event: message, message.edited, message.deleted, message.ack, call.offer, group.update. Kosongkan events untuk forward semua.

Body
{
  "session": "main",
  "url": "https://your-server.com/hook",
  "secret": "s3cr3t",
  "events": "message,message.ack"
}
cURL
curl -X PUT https://openwa.click/api/webhook \
  -H "x-api-key: owa_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "session": "main", "url": "https://your-server.com/hook", "secret": "s3cr3t", "events": "message,message.ack"
}'
GET/api/webhook?session=mainGet webhook + deliveries

Config webhook sekarang + 20 delivery terakhir.

cURL
curl -X GET https://openwa.click/api/webhook"?session=main" \
  -H "x-api-key: owa_YOUR_KEY"
DELETE/api/webhook?session=mainRemove webhook

Matikan webhook.

cURL
curl -X DELETE https://openwa.click/api/webhook \
  -H "x-api-key: owa_YOUR_KEY"

AI Auto-Reply

Balas pesan masuk otomatis pakai XessOne AI (Claude Haiku 4.5).

PUT/api/configAktifkan AI + system prompt

autoReplyAI toggle + systemPrompt untuk karakter AI. replyGroups untuk aktifkan di grup juga.

Body
{
  "session": "main",
  "autoReplyAI": true,
  "replyGroups": false,
  "systemPrompt": "Kamu CS toko batik. Balas ramah, max 2 kalimat, Bahasa Indonesia."
}
cURL
curl -X PUT https://openwa.click/api/config \
  -H "x-api-key: owa_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "session": "main", "autoReplyAI": true, "replyGroups": false, "systemPrompt": "Kamu CS toko batik. Balas ramah, max 2 kalimat, Bahasa Indonesia."
}'
GET/api/config?session=mainGet config

Ambil config session (flag auto-reply, auto-mark-read, auto-reject-call).

cURL
curl -X GET https://openwa.click/api/config"?session=main" \
  -H "x-api-key: owa_YOUR_KEY"
POST/api/ai/testTest AI gateway

Ping XessOne AI tanpa kirim ke WA.

Body
{ "prompt": "Halo", "system": "Balas singkat." }
cURL
curl -X POST https://openwa.click/api/ai/test \
  -H "x-api-key: owa_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "prompt": "Halo", "system": "Balas singkat." }'

Perilaku Session

Toggle auto-mark-read + auto-reject-call.

PUT/api/configSet auto behaviors

Toggle fitur perilaku session.

Body
{ "session": "main", "autoMarkRead": true, "autoRejectCall": true }
cURL
curl -X PUT https://openwa.click/api/config \
  -H "x-api-key: owa_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "session": "main", "autoMarkRead": true, "autoRejectCall": true }'

API Keys (per tim)

Issue key per tim dengan scope & session pinning. Dibutuhkan scope 'admin'.

GET/api/keysList keys (admin)

Preview 6 char terakhir, counter usage, revoke status.

🔒 scope: admin
cURL
curl -X GET https://openwa.click/api/keys \
  -H "x-api-key: owa_YOUR_KEY"
POST/api/keysCreate key (admin)

Key plaintext hanya dikembalikan SEKALI. Scope: admin, send, broadcast, config, ai, media, webhook.

🔒 scope: admin
Body
{ "name": "tim marketing", "scopes": ["send"], "sessionId": "marketing" }
cURL
curl -X POST https://openwa.click/api/keys \
  -H "x-api-key: owa_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "tim marketing", "scopes": ["send"], "sessionId": "marketing" }'
DELETE/api/keys/[id]Revoke key (admin)

Soft-delete (set revoked_at).

🔒 scope: admin
cURL
curl -X DELETE https://openwa.click/api/keys/[id] \
  -H "x-api-key: owa_YOUR_KEY"

MCP Server

Model Context Protocol untuk AI agent (Claude Desktop, Cursor, custom). 9 tools terdaftar.

GET/api/mcpMCP discovery

Info server + daftar tool (tanpa auth, read-only).

cURL
curl -X GET https://openwa.click/api/mcp \
  -H "x-api-key: owa_YOUR_KEY"
POST/api/mcpJSON-RPC 2.0 endpoint

Method: initialize, tools/list, tools/call. Transport: Streamable HTTP.

🔒 scope: admin
Body
{ "jsonrpc": "2.0", "id": 1, "method": "tools/call",
  "params": { "name": "wa_send_text",
    "arguments": { "session": "main", "to": "628111", "message": "Halo" } } }
cURL
curl -X POST https://openwa.click/api/mcp \
  -H "x-api-key: owa_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "wa_send_text", "arguments": { "session": "main", "to": "628111", "message": "Halo" } } }'
Buka PanduanDashboard