WhatsApp API guide

Self-hosted or managed WhatsApp API: what it really costs to keep it running

Running an open source WhatsApp API on your own server gives you full control and looks cheaper at first. The math changes once proxies, monitoring, on-call and WhatsApp protocol changes come in; the more connections you run, the more managed infrastructure tends to win on total cost.

By D-API engineering team5 min read

A decision that looks technical but is really a business one

Connecting the first number on your own server takes an afternoon. A container, a QR code and the message goes out. The doubt shows up months later, when the product has eighty customers and each one has their own WhatsApp. At that point the question stops being "does it work?" and becomes "who wakes up when it goes down?".

There are serious, well-maintained open source projects for this, and they solve the protocol. What they do not solve is operations: keeping dozens of connections stable, isolated and observable, every single day. That is the part that decides between hosting it yourself and using a managed WhatsApp API.

Total cost: what goes into the bill

The server price is the smallest line. The table below lists what tends to show up as the operation grows, without numbers, because they depend on your scale and your team's cost.

ItemSelf-hostedManaged
ServersYour cloud provider; grows with the number of connectionsIncluded
IP per connectionBuy, rotate and replace proxiesIncluded on D-API: each connection gets a dedicated IP
MonitoringBuild alerts for dropped connections, queues and errorsConnection status through the connection.status event
ReconnectionYour own scripts and manual interventionContinuous self-healing
WhatsApp changesTrack releases, update, test, deployThe vendor's responsibility
On-callSomeone on your team on standbyVendor support
Isolation between customersDepends on how you designed itEach connection runs isolated, with its own credentials and webhook
BillingInfrastructure cost plus team hoursPer connection, not per message (see pricing)

The line that weighs the most almost never makes it into the spreadsheet: the engineering hours spent keeping connections alive instead of improving the product. For a SaaS, keeping WhatsApp up is not a differentiator; it is work the end user never sees.

What is actually hard about self-hosting

Reconnection and dropped sessions

WhatsApp connections drop: the phone gets replaced, the session is logged out from the phone, the protocol changes. Every drop needs to be detected, and every lost session means telling the customer to scan the QR code again. Without that, the customer finds out on their own, usually when an important message did not go out.

The domino effect

When every connection runs in the same process and goes out through the same IP, one badly behaved number can hurt the others, and a memory leak takes everyone down together. Isolating per connection fixes it, but it is infrastructure engineering that someone has to build and maintain.

Protocol updates

WhatsApp changes without notice. Open source projects tend to react quickly, but the update still has to reach your environment: read the changelog, roll it out to staging, test sending and receiving, and deploy without dropping active sessions.

Webhooks that cannot get lost

If your receiver goes down for a minute, someone has to resend that minute's events. On D-API, delivery is retried up to 7 times with exponential backoff; when self-hosting, that logic is yours. The details are in WhatsApp API webhooks.

When self-hosting makes sense

  • Regulatory or contractual requirements that no data can pass through third-party infrastructure.
  • Small, stable volume: a few internal numbers, with no customers depending on them.
  • An infrastructure team with spare capacity and experience running stateful services.
  • A need to customize the library's internal behavior beyond what an API exposes.

When managed pays off

  • Each of your product's customers has their own number, and one going down becomes a support ticket.
  • Your product team is small, and every sprint spent on infrastructure delays the roadmap.
  • You need to provision connections through the API, with no manual process. See multiple numbers.
  • You want the option to use the official WhatsApp API (Meta Cloud API) later without rewriting the integration. On D-API, official and unofficial use the same call format.

A checklist to decide

  1. How many connections will you have in 12 months?
  2. What does an hour of your engineering team cost, and how many hours go to WhatsApp each month today?
  3. What is the impact on your customers of WhatsApp being down for an hour?
  4. Is anyone on the team willing to be on call for it?
  5. Is there a requirement that rules out third-party infrastructure?

If the answers point to growth and a team with little slack, the next comparison is price. Start with WhatsApp API pricing and, if you run a product with many customers, the WhatsApp API for SaaS page.

Frequently asked questions

Is an open source WhatsApp API free?
The software can be free, the operation is not. Servers, proxies, monitoring, backups and the hours of whoever keeps it all running go into the bill. For a few numbers the cost is low; with dozens of connected customers, operations become recurring work.
How many numbers can I run on my own server?
It depends on how much each connection consumes and on the architecture. The practical limit usually shows up in operations before it shows up in the machine: when several connections share a process and an IP, a problem in one tends to affect the others.
Do I need a proxy to run WhatsApp on my own server?
With a few numbers, many teams run without one. With many numbers going out from the same datacenter IP, the risk of one suspicious behavior affecting all of them grows. That is why larger operations usually give each connection its own IP, which means buying and managing proxies.
Can I migrate from a self-hosted setup to a managed one?
Yes. The main work is swapping the send calls and adapting your webhook receiver to the new event format. Connections are usually re-created by scanning the QR code again, so plan the migration in batches of customers.
When does it make sense to stay self-hosted?
When there is a requirement that nothing runs outside your infrastructure, when volume is small and stable, or when your team already operates this kind of service and wants full control over versions and customizations.

Try D-API's WhatsApp API

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