Phone-number pairing lets you link the WhatsApp MCP API server to your WhatsApp account by entering a short numeric code in the mobile app — no QR code, no camera, and no visible browser window required. This makes it the go-to method for headless servers, remote machines, and automated provisioning scripts.Documentation 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.
Prerequisites: The server must be running (
npm start) and Chrome or Chromium must be reachable at the path configured in WHATSAPP_CHROME_EXECUTABLE. The client must not already be in the ready state — if it is, the endpoint returns an already_authenticated response instead of a new code.Step-by-step Process
Start the server
From the The server starts on
whatsapp-mcp-api/ directory, start the server:http://127.0.0.1:8790 by default. Chrome is not launched yet — that happens on the next step.Initialize the WhatsApp client (optional)
Triggering auth start explicitly launches Chrome and begins loading WhatsApp Web. The pairing code endpoint will do this automatically if needed, but you can start it early:Wait until
GET /api/status reports state: "qr" or state: "starting" before proceeding — this confirms Chrome is up and WhatsApp Web has made contact.Request the pairing code
Call A successful response looks like this:Note the value of
POST /api/pairing-code with your phone number. The server will request a numeric code from WhatsApp on your behalf:"code" — you will enter this on your phone in the next step.Enter the code on your phone
Open WhatsApp on your mobile device and navigate to:Settings → Linked Devices → Link a Device → Link with phone number insteadType the numeric code exactly as returned in the
"code" field. WhatsApp will verify the code and complete the device link.Request
Endpoint:POST /api/pairing-code
The phone number associated with your WhatsApp account. Must include the country code. Non-digit characters (spaces, dashes,
+) are stripped automatically. The resulting digit string must be between 8 and 15 characters long.Response
Not yet authenticated
When the server is in theqr or starting state and a new pairing code is successfully generated:
false — the server is not yet linked.The normalized (digits-only) phone number the code was issued for.
The numeric pairing code to enter in the WhatsApp app.
Human-readable navigation path for entering the code on the phone.
Already authenticated
When the client is already in theready state, no new code is generated:
true — the server already has an active WhatsApp session.Always
null when already authenticated.The full status object from
GET /api/status, including state, account, and auth_dir.Phone Number Format
The server normalizes phone numbers through thenormalizePhone function: all non-digit characters are stripped first, then the length is validated. Valid inputs include:
| Format | Input example | Normalized |
|---|---|---|
| Digits only (US) | 15551234567 | 15551234567 |
| E.164 (US) | +15551234567 | 15551234567 |
| Digits only (UK) | 447911123456 | 447911123456 |
| E.164 (UK) | +447911123456 | 447911123456 |