WhatsApp API guide

What is a WhatsApp API and what is it for

A WhatsApp API is the bridge between your system and WhatsApp: instead of someone typing on a phone, your software sends, receives and reacts to messages on its own. It's what lets you put WhatsApp inside a CRM, an ERP or any product.

By D-API engineering team5 min read

The short definition

API stands for Application Programming Interface: a set of endpoints one system calls to ask another system to do something. In a WhatsApp API, those requests are things like "send this message to this number", "let me know when a reply arrives" or "create a group with these people".

In practice, WhatsApp stops being an app someone operates and becomes a part of your software. The appointment confirmation goes out when the slot is booked, the payment link arrives when the invoice closes, and the customer's reply lands straight in the CRM history.

What you can do with a WhatsApp API

The most common uses fall into three groups:

  • Messages triggered by system events: order confirmations, appointment reminders, payment reminders, login codes. Nobody has to remember to send them.
  • Support and conversations: incoming messages reach your system through a webhook, where a chatbot, an AI or a human agent replies from your own interface.
  • WhatsApp as a product feature: software such as CRMs, customer support platforms and business management systems offer WhatsApp to their own customers. Each customer connects their number and uses everything inside the product.

Beyond text, a complete API sends images, audio, video, documents, locations, option lists and link buttons. See the details in how to send media through the API and buttons and lists.

How it works under the hood

Every WhatsApp API flow has two directions:

  1. From your system to WhatsApp: your code makes an HTTP request to the API with the destination number and the content. The API delivers the message through the connected number.
  2. From WhatsApp to your system: when something happens (message received, message read, connection dropped), the API makes a request to a URL of yours, the webhook.

Sending a text on D-API, for example, is a single call:

curl -X POST https://api.d-api.cloud/api/v1/messages/send/text \
  -H "Authorization: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "sessionId": "my-session", "to": "14155550123", "text": "Your order is out for delivery." }'

The full walkthrough, from connecting the number to the first webhook, is in how the WhatsApp API works.

Official and unofficial API

There are two ways to get a WhatsApp API, and the choice changes cost, rules and how fast you can ship.

Official API (Meta)Unofficial API
How it connectsNumber registered on Meta's platformQR code, like WhatsApp Web
ApprovalBusiness verification and approved templatesNot required
BillingPer template message, set by MetaPer connected number (on D-API)
Starting a conversationOnly with an approved templateFree-form
Ban riskLower, within Meta's rulesDepends on how you send

It isn't a lifelong choice. On D-API both use the same integration: the type is set when you create the connection and the rest of the code stays the same. The detailed comparison is in official vs unofficial API, and each model has its own page: official WhatsApp API and unofficial WhatsApp API.

What to check before choosing a provider

Sending the first message is easy with any API. The difference shows up when the operation grows and the connection has to stay up with nobody watching. Before integrating, ask:

  • What happens when a connection drops? Does it recover on its own or does someone have to reconnect it? Do you find out before your customer does?
  • Can one number take down the others? If they all run on the same server with the same IP, one problem becomes a domino effect. On D-API, each connection runs isolated with its own IP.
  • Are webhooks retried on failure? If your server was down for a minute, are that minute's messages lost, or do they arrive later?
  • How does billing scale? Per-message billing is a variable cost. Per-connection billing is predictable.
  • Can you create connections through the API itself? For a product with many customers, provisioning numbers via API is what separates an integration from a manual process.

Who a WhatsApp API makes sense for

The ones who gain the most from an API are software companies that need WhatsApp inside their product, with one connection per customer. That's the case for CRMs, customer support platforms and ERPs. There's a dedicated page for this profile: WhatsApp API for SaaS.

It's also used by agencies that build automations for clients, teams that plug WhatsApp into tools like n8n, and companies that want to automate their own operations. If you're starting to compare options, the natural next step is understanding how much a WhatsApp API costs.

Frequently asked questions

Is a WhatsApp API the same as WhatsApp Business?
No. WhatsApp Business is an app a person operates on a phone. The API is an interface for software: your system sends and receives messages automatically, without anyone touching the device.
Do I need to code to use a WhatsApp API?
To integrate it directly into your system, yes, or someone on your team does. People who don't code usually use the API through automation tools such as n8n, which already ship ready-made blocks.
Can I use my current number?
With the unofficial WhatsApp API, yes: you connect the number by scanning a QR code, just like WhatsApp Web. With the official WhatsApp API (Meta Cloud API), the number must be registered on Meta's platform and linked to a verified business account.
How much does a WhatsApp API cost?
It depends on the model. The official API charges per template message sent, at rates set by Meta. Unofficial APIs like D-API charge per connected number, with no per-message fee.
Is an unofficial API safe to use?
The risk lies in how you send, not in the technology: bulk messaging people who didn't ask for it leads to bans under any model. Infrastructure with a dedicated IP per connection and isolation between numbers limits the damage when something goes wrong.

Try D-API's WhatsApp API

3-day trial with full access. No credit card, no lock-in.