Skip to content

API Overview

All API requests should be made to:

http://your-server:8080/api

The primary authentication mechanism is httpOnly session cookies. Logging in (POST /api/auth/login) sets whm_access and whm_refresh cookies — the login response does not contain a token in its body. Browser clients are authenticated automatically by these cookies on every subsequent request.

For server-to-server integrations, send an API key in the X-API-Key header instead:

Terminal window
X-API-Key: whm_<your-api-key>

A Authorization: Bearer <token> header is also accepted as a fallback, but cookies and API keys are the recommended methods.

See Authentication for details on the cookie flow, and API Keys for programmatic access.

All responses are returned in JSON format with the following structure:

{
"status": "success",
"data": {
// Response data
}
}
{
"status": "error",
"message": "Error description",
"data": null
}
CodeDescription
200Success — including successful creates. The API does not return 201.
400Bad Request — invalid parameters or body
401Unauthorized — missing/invalid cookie or API key
403Forbidden — Insufficient permissions, or a CSRF token mismatch
404Not Found
409Conflict — e.g. a duplicate name, or a contact that already has an active transfer
429Too Many Requests — rate limited
500Internal Server Error
501Not Implemented — feature not configured on this deployment
503Service Unavailable — a required subsystem (e.g. calling) is disabled or unreachable

Rate limiting is off by default. It is enabled with rate_limit.enabled = true in config.toml, which turns on two independent layers:

LayerDefaultKeyed by
Auth endpoints (login, register, refresh, SSO)10 / 10 / 30 / 10 per 60sClient IP
All /api routesapi_max_requests = 200 per api_window_seconds = 60Authenticated user ID, falling back to IP

Both are Redis fixed-window counters and fail open — if Redis is unreachable, requests are allowed through.

When a limit is exceeded the response is 429 with a Retry-After header holding the seconds until the window resets:

Retry-After: 42

Mutating requests (POST, PUT, DELETE, PATCH) authenticated by the whm_access cookie must also send the value of the whm_csrf cookie back in an X-CSRF-Token header — a mismatch returns 403 CSRF token mismatch. Requests authenticated with an X-API-Key or Authorization header skip this check entirely, so server-to-server clients need no CSRF token.

List endpoints support pagination using page and limit query parameters:

Terminal window
GET /api/contacts?page=1&limit=50

page defaults to 1. limit defaults to 50 and is capped at 100 — a value outside 1–100 silently falls back to 50. (Conversation notes are the one exception: default 30, max 100.)

Paginated responses use the resource name (plural) as the data key and include the total count, current page, and page size:

{
"status": "success",
"data": {
"contacts": [...],
"total": 100,
"page": 1,
"limit": 50
}
}

The list key matches the resource being queried. The exact keys are:

EndpointKey
/api/contactscontacts
/api/templatestemplates
/api/campaignscampaigns
/api/flowsflows
/api/chatbot/flowsflows
/api/chatbot/keywordsrules
/api/chatbot/ai-contextscontexts
/api/canned-responsescanned_responses
/api/custom-actionscustom_actions
/api/rolesroles
/api/teamsteams
/api/tagstags
/api/api-keysapi_keys
/api/audit-logsaudit_logs
/api/call-logscall_logs
/api/call-transferscall_transfers
/api/ivr-flowsivr_flows
/api/organizations/membersmembers

There is no total_pages field — derive page count from total and limit.

Authentication

Register, login, and manage tokens. View →

Users

User management (Admin only). View →

Organizations

Organization and member management. View →

Contacts

Manage contacts and assignments. View →

Messages

Send and receive messages. View →

Templates

Manage message templates. View →

Flows

WhatsApp Flows management. View →

Chatbot

Chatbot configuration. View →

Webhooks

Receive real-time updates. View →

Analytics

Dashboard and message analytics. View →

Roles

Roles and permission management. View →

Teams

Organize agents into teams. View →

Canned Responses

Reusable quick replies. View →

Custom Actions

Configure external integrations. View →

Calling

Call logs, IVR flows, and transfers. View →