WhatsApp API guide

Official vs unofficial WhatsApp API: which one to choose

The official WhatsApp API belongs to Meta: it requires a verified account and an approved template to start a conversation, and charges per message. The unofficial API connects the number by QR code, with no approval, and usually charges per connection. The choice depends on who you'll contact, at what volume and with what risk tolerance.

By D-API engineering team5 min read

The difference in one sentence

With the official API, you operate within Meta's rules and billing in exchange for stability and backing. With the unofficial API, you operate the number's own WhatsApp, with freedom and predictable cost, in exchange for taking responsibility for your sending behavior. Both are legitimate ways to get a WhatsApp API; the mistake is choosing without looking at your scenario.

Criterion-by-criterion comparison

CriteriaOfficial (Cloud API)Unofficial (QR code)
Time to first messageDepends on sign-up and verification with MetaMinutes: create the session and scan the QR code
NumberRegistered on Meta's platform, under its rulesYour current number, which stays on the phone
Starting a conversationOnly with an approved templateFree-form message
BillingPer template, varies by category and country, plus provider feePer connection, no per-message fee
GroupsLimitedCreate, manage participants, send
Ban riskLow within Meta's rulesDepends on sending patterns and infrastructure
Verified badge and profilePossible, under Meta's criteriaNot applicable
DependencyMeta's rules and timelinesProvider quality

When to choose each one

Choose the official API when

  • You need to start conversations with people who have never messaged you, at scale, such as notices to a large base. Approved templates are the intended path for that.
  • Your customer or your industry requires it. Banks, insurers and companies with a compliance team often require the official channel by contract.
  • The number is the brand. A central support number, with a verified profile, that can't risk being banned.

Choose the unofficial API when

  • Each of your customers connects their own number. That's the typical SaaS case: the customer scans a QR code on your screen and starts using it, without going through Meta sign-up.
  • The conversation is ongoing and a relationship already exists. Support, sales follow-up, appointment confirmation, customer care.
  • You need groups or features of the regular app that the official API doesn't cover.
  • Per-message cost breaks your business model, as in operations with high message volume per number.

Use both when

The most common scenario in mature products is mixed: most customers on the unofficial API, for activation speed and cost, and a few on the official one, because they require it or for a specific flow, such as notifications to people who haven't started a conversation yet. That's only viable if the integration doesn't have to be duplicated.

On D-API, both use the same API

The difference is in creating the session. The type field accepts unofficial or cloud_api, and the resulting sessionId works on the same send routes:

# Unofficial: connect afterwards with a QR code
curl -X POST https://api.d-api.cloud/api/v1/sessions \
  -H "Authorization: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "sessionId": "store-nyc", "type": "unofficial" }'

# Official: uses your Meta account details
curl -X POST https://api.d-api.cloud/api/v1/sessions \
  -H "Authorization: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "hq-official",
    "type": "cloud_api",
    "wabaId": "YOUR_WABA_ID",
    "phoneNumberId": "YOUR_PHONE_NUMBER_ID",
    "accessToken": "YOUR_ACCESS_TOKEN"
  }'

After that, sending a text to store-nyc or to hq-official is the same call to /api/v1/messages/send/text. On the official connection, the webhook can come in the normalized format, the same as the unofficial one, or in Meta's original format, if your system already works with it.

What is exclusive to one model stays exclusive. Sending an approved template, at /api/v1/messages/send/template, only works on cloud_api connections; on an unofficial session, the API responds with a 400 error and the code NOT_CLOUD_API. That makes it explicit, in the code itself, which flow depends on which model.

Cost, risk and what nobody tells you

Two points are usually left out of comparisons. First: on the official API, what drives cost isn't how many numbers you have, but how many conversations you start. A product that sends daily reminders to a large base feels that quickly. The breakdown is in WhatsApp API pricing.

Second: on the unofficial API, ban risk isn't a lottery. It depends on consent, volume and content, and infrastructure limits the damage when something goes wrong. On D-API, each connection runs isolated with its own IP, so one number's problem doesn't spill over to the others. The practices that make the most difference are in how to avoid bans on the WhatsApp API.

To go deeper on each model, see the pages for the official WhatsApp API and the unofficial WhatsApp API.

Frequently asked questions

Is the unofficial API illegal?
It's not a matter of law, but of WhatsApp's terms of use. The unofficial API connects the number as a linked device, the same way WhatsApp Web does. The real risk is the number getting banned when sending breaks those rules, which is why sending behavior matters so much.
Can I use the same number on both APIs at the same time?
In general, each number sits in one of the two models. The QR code connection depends on the app on the phone, and Meta has its own rules about what happens to the app when the number is registered on the official platform. Since those rules change, check the current situation before migrating a number.
Which one is cheaper?
It depends on volume and message type. The official API charges per template sent, so it gets expensive when you start many conversations. The unofficial API charges per connection, so the cost doesn't change with volume. For many numbers with high volume, the unofficial API is usually cheaper.
Do I need to rewrite the integration to switch from one to the other?
On D-API, no. The type is set when the session is created, and the send routes and the normalized webhook are the same. What changes is whatever only exists on the official API, such as sending an approved template.
Which one is more stable?
The official API has Meta behind its availability and doesn't depend on a paired phone. The unofficial API depends on the quality of the provider's infrastructure: auto-reconnect, per-instance isolation and a dedicated IP per connection make the difference between one outage a month and one a day.

Try D-API's WhatsApp API

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