Getting started
Introduction
REST API under /v1. Integrators authenticate with an opaque API token. Identities are created and paired in the admin dashboard; tokens send only within their scope.
Base URL (local default): https://whatsapp.tag.mw/v1
Consent & risk
Getting started
Authentication
Authorization: Bearer <api_token_or_admin_jwt>| Principal | Behavior |
|---|---|
ALL_IDENTITIES | Token may send using any identity (pass identity_id when required). |
SINGLE_IDENTITY | Bound to one identity; identity_id may be omitted on send. |
| Admin JWT | Keycloak admin role — full dashboard + identity/token management. |
What a typical send token can call
POST /v1/messages, GET /v1/messages, GET /v1/messages/{id}, and (when scoped) pair/status/qr on its identity. Token create/revoke and identity CRUD are admin-only.Getting started
Rate limiting
Global and per-token RPM apply. Per-identity velocity, min send spacing, warm-up daily ceilings, and identical-body fan-out caps also reject at create.
| Code | Meaning |
|---|---|
QUOTA | Daily/monthly/warm-up ceiling exhausted — nothing enqueued. |
BROADCAST_LIMIT | Same body to too many distinct recipients this hour. |
RATE_LIMIT | Per-identity velocity or send spacing. |
DUPLICATE | Identical (identity, to, text) too recently. |
SEND_DISABLED | Identity send_enabled is false or paused. |
Conventions
Lists & pagination
{
"data": [ /* … */ ],
"pagination": {
"total": 0,
"page": 1,
"page_size": 50,
"has_more": false
}
}Conventions
Errors
{
"code": "QUOTA",
"message": "Daily send limit exceeded"
}Permanent transport rejects return 400 SEND_REJECTED with no outbox row. Transient transport failures may return 202 with status QUEUED.
Conventions
Idempotency
Pass Idempotency-Key on POST /v1/messages. Same key + same body → original response; different body → 409 IDEMPOTENCY_CONFLICT.
Endpoints
Health
/v1/healthPublic/v1/readyPublic/ready checks database and Redis connectivity.
Endpoints
Identities
Admin manages lines in the dashboard. Pairing and status are also available to scoped tokens.
/v1/identitiesAdmin/v1/identitiesAdmin/v1/identities/{id}Admin/v1/identities/{id}Admincurl -X POST https://whatsapp.tag.mw/v1/identities \
-H "Authorization: Bearer $ADMIN_JWT" \
-H "Content-Type: application/json" \
-d '{
"name": "OTP line",
"phone_number": "265991234567",
"daily_limit": 50
}'Pair / QR / status
/v1/identities/{id}/pairAdmin or token/v1/identities/{id}/qrAdmin or token/v1/identities/{id}/statusAdmin or tokenPair cooldown
CONNECTED, send_enabled is turned on automatically (unless the line is blocked). Linked sessions stay offline by default; set mark_online if contacts should see the line as online. LOGGED_OUT means the device was unlinked — scan QR again.Block / unblock
/v1/identities/{id}/blockAdmin/v1/identities/{id}/unblockAdminEndpoints
Messages
/v1/messagesAPI token or adminSingle recipient only. to must be digits-only E.164 (8–15 digits). text max length ~4096.
curl -X POST https://whatsapp.tag.mw/v1/messages \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"to": "265997654321",
"text": "Your code is 123456",
"origin": "api"
}'| HTTP | Meaning |
|---|---|
201 | Sent immediately (status SENT). |
202 | Queued for retry or scheduled (transient transport / send_at) — never over-quota. |
429 | QUOTA / BROADCAST_LIMIT / RATE_LIMIT — no row created. |
List, detail, queued
/v1/messagesAPI token or admin/v1/messages/{id}API token or admin/v1/messages/queuedAdminTokens only see messages they created. Queued outbox listing is admin-only.
Endpoints
Tokens
/v1/tokensAdmin/v1/tokensAdmin/v1/tokens/{id}/revokeAdmincurl -X POST https://whatsapp.tag.mw/v1/tokens \
-H "Authorization: Bearer $ADMIN_JWT" \
-H "Content-Type: application/json" \
-d '{
"name": "otp-service",
"scope": "SINGLE_IDENTITY",
"identity_id": 1
}'Secret shown once
Endpoints
Workspace settings
Admin-only workspace config: email-gateway integration, ops alert toggles, and production knobs (retention, circuit, pair cap, default limits). The API token is write-only and stored encrypted.
/v1/workspace/settingsAdmin/v1/workspace/settingsAdmin/v1/workspace/settings/test-emailAdminOps alerts