Make the first read
Start the linked bridge and check its health endpoint on loopback. This endpoint is at the root and can report whether the service is running even during login preview. For account details, request the status endpoint inside the versioned API. Read its connected and logged_in fields separately from the overall health result.
Retrieve the API token as the same operating system user that runs the bridge. The api-token command prints the current value for a script. Send it in the Authorization header with the Bearer scheme for versioned API requests. In the default keystore mode the bridge protects the generated token with the user's operating system credentials.
TOKEN=$(./wa-bridge api-token)
curl -H "Authorization: Bearer $TOKEN" \
"http://127.0.0.1:8080/api/v1/messages?query=invoice&limit=5"
Query the message store
The example searches for the term invoice and limits the number of results. Use the API reference for the parameters of each endpoint, or request /api/v1/openapi.yaml from the bridge. Times in responses are Unix seconds. Requests accept Unix timestamps, RFC 3339 timestamps or a calendar date interpreted in local time.
A chat address can be a WhatsApp ID or a phone number with its country code. Keep that identifier with a result when your application needs to retrieve media or inspect the same conversation later. Remember that a chat ID can contain a phone number. Even a log that omits message content may disclose contact information if you include request details.
Understand responses and permissions
Versioned API responses are JSON objects with an ok field. An error response also includes an explanation. A 401 points to the token. A 403 can mean a Host mismatch, a disabled capability or an operation refused by a path or quiet-hours rule. Read the response before asking the user to link the phone again.
A 503 can indicate a bridge that has not logged in or has lost its connection. A 429 indicates a sending limit. Message sends, read receipts and imports have different settings and inputs. For instance, ordinary JSON requests have a 256 KiB body limit, while the import endpoint accepts a form upload under the configured import size limit.
Receive changes with webhooks
If you need to react to a new message, configure a webhook URL. The bridge publishes events for messages, receipts, calls, connections, schedules and security changes. Each destination has its own delivery queue. Failed deliveries are retried, so a receiver should expect to see a delivery ID more than once.
When a webhook secret is set, verify the HMAC signature over the timestamp, delivery ID and raw request body. Keep the raw bytes for verification, check the timestamp for freshness and process each verified delivery ID once. A receiver that schedules a follow-up action benefits from this distinction between a new event and a retry of an earlier one.
Choose the right interface for an application
A Python application can use the wa_mcp SDK for bridge access, local database reads, exports and transcription. A Go application can embed the bridge with wabridge when it needs hooks for stored messages or extra HTTP routes. An assistant that already speaks MCP can instead use the Python server with its documented tool arguments.
Remote MCP and the bridge API have different callers and credentials. The bridge API defaults to loopback. In the documented Docker deployment it stays inside the bridge network namespace, while remote assistants connect to the authenticated /mcp endpoint through an HTTPS proxy. Use the deployment instructions when moving a local integration to a server.
Questions
Is this self-hosted WhatsApp API free to use?
The bridge and SDK use the MIT license. You supply the machine and linked account. It uses the unofficial WhatsApp Web protocol, which carries a risk of account restrictions.
Is this the official WhatsApp Business API?
WA MCP is independent and uses the unofficial companion-device protocol. WhatsApp can limit or block a linked account. Sending limits and quiet hours cannot guarantee the account's safety.
Must an assistant stay open for scheduled sends?
No. The bridge handles scheduled messages and can deliver them while the assistant is closed. Keep the bridge running and connected for delivery.
Project documentation ยท http-api.md