WpAi API

One REST API over two WhatsApp channels. Send a message, manage the templates you send, and get told what happened — without knowing which channel carried it.

What this is

WpAi connects a business to WhatsApp two ways: the official Cloud API, and WhatsApp Web paired by QR code. They differ in real ways — one bills per approved template message and needs one outside a 24-hour window, the other sends free text at one message a second — but the API in front of them is the same shape.

Everything below is addressed to https://api.wpai.co.in. Requests and responses are JSON unless a route is explicitly multipart or a CSV download.

Three surfaces

Which one you want depends on where your code runs, and it decides which kind of API key you create.

  • Server to server — your backend calling /api/messages/send and /api/templates. Needs a key with the messages:send scope.
  • Website widget — a browser calling /api/public/* for assistant chat and bookings. Needs a widget-scoped key, which is safe to publish in page source and is refused everywhere else.
  • Webhooks — us calling you when a message arrives, a delivery status changes or Meta reviews a template.

Your first call

Create a key under Settings → API Keys with the messages:send scope. The full key is shown once. Then send a message to a number that has messaged you in the last 24 hours:

cURL
curl -X POST https://api.wpai.co.in/api/messages/send \
  -H "X-API-Key: wpai_abc123.def456..." \
  -H "Content-Type: application/json" \
  -d '{
    "to": "919876543210",
    "channel": "whatsapp_cloud",
    "type": "text",
    "text": "Thanks for getting in touch — how can we help?"
  }'

A brand-new number will fail

Free-form text and media on Cloud API are only allowed inside the 24-hour service window, which opens when the customer messages you. A contact who has never written in has a closed window, so this call returns 400 until they do. Use an approved template to open a conversation, or send over WhatsApp Web, which has no window.

Or start in Postman

Every request in these docs, ready to run. Import it, set baseUrl and apiKey, and send.

Download the Postman collection

The Website widget folder is the exception — it wants a widget-scoped key rather than your server key. Override apiKey on that folder.

Where to go next

These pages cover integrating with WpAi — sending, templates and events. Running the business itself — campaigns, contacts, the shared inbox, reports — is done in the dashboard. If something here does not match what the API actually did, tell us: that is a bug in the documentation.