The WhatsApp MCP API is a local Node.js HTTP server that exposes WhatsApp Web messaging through a simple REST interface. It runs on your machine and communicates with a Chrome browser instance via whatsapp-web.js. Because the server is local, no API keys or authentication tokens are required — every endpoint is open on localhost. All responses includeDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/jihvijhojhviihogyuvi/whatsapp-api/llms.txt
Use this file to discover all available pages before exploring further.
access-control-allow-origin: * CORS headers so you can call the API from any browser or local tool.
Base URL
| Variable | Default | Description |
|---|---|---|
WHATSAPP_MCP_HOST | 127.0.0.1 | Bind address for the HTTP server |
WHATSAPP_MCP_PORT | 8790 | TCP port for the HTTP server |
WHATSAPP_AUTH_DIR | ../.wwebjs_auth | Directory where session credentials are stored |
WHATSAPP_CHROME_EXECUTABLE | C:\Program Files\Google\Chrome\Application\chrome.exe | Path to the Chrome binary |
WHATSAPP_HEADLESS | false | Set to true to run Chrome without a visible window |
Endpoint Summary
| Method | Path | Description |
|---|---|---|
GET | / | Health check with server info and WhatsApp status |
GET | /health | Alias for GET / |
GET | /api/status | WhatsApp client connection state |
POST | /api/auth/start | Launch Chrome and start the authentication flow |
POST | /api/pairing-code | Request a phone-number pairing code |
POST | /api/send | Send a WhatsApp text message |
GET | /api/chats | List recent chats sorted by timestamp |
GET | /api/messages | Fetch messages from a chat (query-param variant) |
POST | /api/messages | Fetch messages from a chat (JSON body variant) |
POST | /api/logout | End the WhatsApp session and stop Chrome |
GET | /qr | Auto-refreshing HTML page displaying the auth QR code |
Request Format
POST endpoints expect a JSON body. Set the Content-Type header to application/json:
GET endpoints accept parameters as URL query strings and require no body.
Response Format
All REST endpoints returnapplication/json with pretty-printed output (2-space indentation), except GET /qr which returns an HTML page. Most successful responses include an ok: true field at the top level — the exception is GET /api/status, which returns the status object directly without an ok wrapper. Example of a wrapped response:
Error Responses
When a request fails, the server returns a JSON error envelope modelled on JSON-RPC 2.0:| HTTP status | Meaning |
|---|---|
400 | Bad input — invalid JSON body or failed parameter validation (error code -32602) |
404 | Path not found |
500 | Server-side error — WhatsApp not ready, Chrome crash, send failure, etc. (error code -32000) |
Phone Number Format
All endpoints that accept aphone_number parameter normalize the value automatically:
- All non-digit characters are stripped (spaces, dashes, parentheses,
+signs). - The resulting string must be 8–15 digits including the country code.
Pages in This Section
GET /api/status
Check the current WhatsApp client state, connection status, and account info.
POST /api/auth/start
Launch Chrome and start the WhatsApp Web authentication flow.
POST /api/send
Send a text message to any WhatsApp number.
GET /api/chats
List recent chats sorted by timestamp with unread counts.
GET /api/messages
Read recent messages from a chat by phone number.
POST /api/logout
End the WhatsApp session and reset the server state.
GET /qr
Open the browser-based QR authentication page.