Developer guide

How to send WhatsApp messages using an API

You can send a WhatsApp message from any programming language with a single HTTP request — no SDK, no Meta Business verification, and no per-conversation fees. This guide shows the four steps end to end, then links to a copy-paste example for your exact stack.

curl -X POST https://api.spwp.app/api/v1/public/messages/text \
  -H "X-API-Key: $SPWP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "to": "9647503505440", "text": "Hello from SPWP" }'

Four steps to your first message

The whole process takes about five minutes. Everything after step 2 is ordinary HTTP.

  1. Create an account and pair a WhatsApp number

    Sign up, then scan a QR code with the WhatsApp app on your phone — the same flow as WhatsApp Web. Your number is live in under a minute and starts a 3-day free trial automatically. No Meta Business verification, no template approval.

  2. Generate an API key

    Open the account you just paired and create an API key. The key is scoped to that one WhatsApp number, so the account is implicit in every request. Store it as a server-side environment variable — anyone holding it can send messages as you.

  3. POST the message

    Send a JSON body with a recipient and some text to /public/messages/text, authenticated with the X-API-Key header. The API answers 202 Accepted immediately and returns a message id you can track.

  4. Receive replies and delivery receipts

    Register a webhook URL to get inbound messages and status changes (sent, delivered, read, failed) pushed to your server as HMAC-signed events. Verify the signature before trusting the payload.

Pick your language or framework

Every guide below sends the same message — the difference is only the HTTP client. All of them are complete, runnable files rather than fragments.

Common questions

Can I send WhatsApp messages without the official Business API?

Yes. SPWP connects through the WhatsApp Web protocol, the same channel the official WhatsApp Web client uses, so you send from a real number you already own. That removes Meta Business verification, template approval and per-conversation pricing. The trade-off is that messages come from your own number rather than a verified business profile.

What is the fastest way to test that it works?

Use the cURL guide. One command in your terminal with your API key proves the whole path — key, pairing and delivery — before you write any application code.

Do I need a separate API key per WhatsApp number?

Yes, and that is deliberate. Keys are scoped to a single WhatsApp account, so a leaked or revoked key affects exactly one number. You can hold as many numbers as your plan allows and round-robin between them for higher throughput.

How do I send messages to numbers in Iraq?

Use the full international number without a plus sign, spaces or dashes — for example 9647503505440. The country code is always required. SPWP normalises plain numbers into WhatsApp JIDs for you.

Send your first WhatsApp message today

Pair a number, copy an API key, and run one of the examples above. The first 3 days are free on every new number — no credit card.

3-day free trial — no card requiredPay in IQDOpenAPI 3.0