Skip to content

API overview ​

The HTTP API lets your apps send messages, manage sessions and read chat history. It is compatible with WA Gateway v4.

Base URL ​

The API is served by your gateway, on the same port as the dashboard:

http://YOUR_SERVER:5001

Authentication ​

Every request needs an API key in the key header:

bash
curl http://YOUR_SERVER:5001/session -H "key: wag_your_key"

The x-api-key header and the ?key= query parameter are accepted too.

Interactive docs ​

Your gateway serves interactive API docs at /docs, with every field, example requests in many languages and a built-in client to try requests. The OpenAPI 3.1 document is at /openapi.json: import it into Postman, Insomnia or a code generator.

Interactive API docs

Requests and responses ​

Send JSON bodies with content-type: application/json. Successful responses are JSON, usually wrapped in data.

Errors use HTTP status codes and a message:

json
{ "message": "Session is not connected" }
StatusWhen
400Invalid input ("Invalid input: expected string, received undefined field 'to' on json"), the session doesn't exist or isn't connected, or the number isn't on WhatsApp ("6281234567890 is not registered on WhatsApp").
401Missing or invalid API key.
404Unknown session or route.
500Something went wrong while talking to WhatsApp.

Phone numbers and chats ​

  • Phone numbers are written with the country code and digits only: 6281234567890, 14155550100. +, spaces and dashes are removed for you.
  • Groups are addressed by their id (120363012345678901) with "is_group": true, or by the full JID (120363012345678901@g.us).
  • A full JID (…@s.whatsapp.net, …@g.us) is accepted anywhere a number is.

You find group ids in webhook payloads (chat), in the History API or in the inbox URL.

Endpoints ​

SessionsList, start, inspect and delete sessions.
MessagesSend text, images, videos, documents, audio, stickers and polls.
HistoryRead chats and messages stored by the gateway.
ProfileProfile picture and about text of a contact.

To receive messages, use webhooks.

Uses the unofficial WhatsApp Web protocol. Not affiliated with WhatsApp or Meta.