WhatsApp API — Send Messages Programmatically

A complete WhatsApp API for sending text, media, and managing conversations through a simple REST interface. No Puppeteer, no headless browser — pure WebSocket.

Quick Start

Send your first WhatsApp message in under a minute. Create an account, connect your number, and call the API:

curl -X POST https://api2whats.com/send-text \
  -H "Authorization: Bearer ***" \
  -H "Content-Type: application/json" \
  -d '{"to": "971501234567", "message": "Hello from the API!"}'

That is it. One request. One response. No SDK required.

What Is a WhatsApp API?

A WhatsApp API lets you send and receive WhatsApp messages from your own software. Instead of opening the WhatsApp app on a phone and typing messages manually, your code makes HTTP requests to an API endpoint. The API handles the connection to WhatsApp's servers, message delivery, status tracking, and incoming message forwarding.

This is useful for any business that needs to communicate with customers at scale. Order confirmations, shipping updates, appointment reminders, customer support replies, marketing campaigns — all of these can be automated through a WhatsApp API. The messages appear in the same WhatsApp chat that customers already use, which means they actually read them. Open rates on WhatsApp messages typically exceed 90%, compared to 20% for email.

The concept is straightforward: your application sends an HTTP request to the API server, the API server delivers the message to the recipient via WhatsApp, and you get a response confirming delivery. For incoming messages, the API forwards them to your webhook URL in real time so your system can process them immediately.

How Our WhatsApp API Works

Our API is built on the WhatsApp Web protocol using direct WebSocket connections. This is fundamentally different from solutions that use Puppeteer or headless browsers to automate a web interface. Direct WebSocket means lower latency, lower resource usage, and significantly better reliability.

Each instance you create maintains an authenticated WebSocket connection to WhatsApp's servers. When you send a message through the API, it goes directly over this WebSocket connection. There is no browser rendering overhead, no screenshot parsing, no fragile DOM manipulation. The connection is persistent and handles reconnection automatically.

We also run a distributed SOCKS5 proxy pool across multiple regions. This serves two purposes: it ensures reliable connectivity regardless of where your servers are located, and it distributes connections across multiple IP addresses to avoid rate limiting. Each instance connects through a different proxy, so even if you are running ten instances simultaneously, they each have their own clean connection path.

What You Can Do With the API

Send Text Messages

The most basic use case: send a text message to any WhatsApp number. Messages support Unicode, so you can send text in any language including Arabic, Hindi, Chinese, and emoji. Each message is delivered individually with full delivery status tracking.

Send Media

Go beyond text. Send images, videos, documents, audio files, and stickers. Media can be provided as a URL (the API fetches and delivers it) or as Base64-encoded data for inline sending. Documents can be PDFs, Word files, spreadsheets — any file type that WhatsApp supports.

Receive Messages via Webhooks

When someone sends a message to your connected number, the API forwards it to your webhook URL as a POST request. You get the sender's number, the message content, any media attachments, and timestamp information. Your webhook handler processes the message and can trigger any automated response or workflow.

Manage Multiple Numbers

Each plan supports multiple instances, meaning you can connect several WhatsApp numbers and manage them all from one dashboard. Switch between numbers via the API by specifying the instance ID in your request. This is useful for businesses operating in multiple regions or brands.

Track Message Status

Every message you send gets a unique ID. You can query the status of any message — whether it is pending, sent, delivered, or read. Webhooks also push status updates in real time, so your system knows the moment a message is delivered or read without polling.

API Endpoints

The API follows a clean REST design. All endpoints accept and return JSON. Here are the main endpoints:

  • POST /send-text — Send a text message
  • POST /send-image — Send an image
  • POST /send-video — Send a video
  • POST /send-document — Send a document or file
  • POST /send-audio — Send an audio file
  • POST /send-location — Send a location pin
  • GET /message-status/{id} — Check delivery status
  • POST /set-webhook — Configure your webhook URL
  • GET /instance/status — Check connection status

Every endpoint requires an API key passed in the Authorization header. Rate limits are enforced per plan, and the API returns clear error messages with HTTP status codes when something goes wrong.

Connection Methods

Connecting a phone number to the API is simple. We support two methods:

QR Code Connection

Scan a QR code from your dashboard using the WhatsApp app on your phone. This is the quickest method — it takes about 10 seconds. The QR code refreshes automatically if you do not scan it in time. Once scanned, the connection is established and the instance stays online until you disconnect it.

Pairing Code Connection

Enter a numeric pairing code on your phone instead of scanning a QR code. This is useful when you cannot scan a QR code — for example, when connecting a number on a remote server. The pairing code is generated by the API and expires after a few minutes.

Supported Programming Languages

The API is language-agnostic. Any language that can make HTTP requests can use it. We provide ready-made code samples for:

  • PHP — Using cURL or Guzzle
  • Python — Using requests library
  • JavaScript — Using fetch or axios (Node.js and browser)
  • cURL — Direct command-line usage
  • Go — Using net/http
  • Java — Using HttpURLConnection or OkHttp

If your language can send an HTTP POST request with a JSON body, you can use this API. No SDK installation required.

Message Delivery Flow

Understanding how messages flow through the system helps you build better integrations. When you send a message, here is what happens step by step:

  1. Your application sends an HTTP request to the API with your API key and message data
  2. The API validates your request: checks the API key, verifies the phone number format, and confirms the instance is connected
  3. The message is queued for delivery through the appropriate instance's WebSocket connection
  4. The message is transmitted to WhatsApp's servers over the persistent WebSocket connection
  5. WhatsApp delivers the message to the recipient's phone
  6. The API receives a delivery confirmation from WhatsApp and updates the message status
  7. If a webhook is configured, the status update is forwarded to your server

The entire flow from your request to delivery confirmation typically takes 1-3 seconds. Status updates (delivered, read) may take longer depending on the recipient's connection and when they open the message.

Instance Management

Each WhatsApp number you connect is called an "instance." You can manage multiple instances from a single dashboard and switch between them via the API by specifying the instance ID. Each instance has its own:

  • API key — Unique authentication token
  • Connection status — Connected, disconnected, or reconnecting
  • Phone number — The WhatsApp number associated with the instance
  • Webhook URL — Where incoming messages are forwarded
  • Message history — Log of sent and received messages

Instances can be created, disconnected, and deleted from the dashboard or via the API. When you disconnect an instance, the WhatsApp session is terminated but you can reconnect at any time without losing your data.

Reliability and Uptime

We maintain a 99.9% uptime SLA across all plans. Our infrastructure is built for reliability:

  • Automatic reconnection — If a WebSocket connection drops, the API automatically reconnects within seconds
  • Proxy failover — If one proxy server has issues, traffic routes through another in the pool
  • Message queuing — If the WhatsApp connection is temporarily unavailable, messages are queued and delivered when the connection restores
  • Health monitoring — We monitor all instances 24/7 and proactively address issues before they affect delivery

The API returns a 503 Service Unavailable error only when all connection paths are exhausted, which is extremely rare. In practice, your messages will be delivered even if individual components experience brief outages.

Security and Privacy

All API communication is encrypted over HTTPS. API keys are stored securely with bcrypt hashing — we never store them in plain text. Your webhook URLs are validated and all webhook payloads are signed so you can verify they actually came from our servers.

We do not have access to your message content unless you explicitly forward it via webhooks. Messages between you and your customers remain private. The WhatsApp connection uses end-to-end encryption for the message transport layer.

Pricing

Plans start at $9.99 per month and include a set number of API requests per day, instances, and features. There are no hidden fees, no per-message charges, and no overage surprises. You can upgrade or downgrade at any time from your dashboard.

We accept cryptocurrency and credit cards. Payment processing is handled through secure gateways, and your payment information is never stored on our servers.

Use Cases

Our WhatsApp API is used across a wide range of industries and applications. Here are some of the most common use cases our customers build:

  • E-commerce — Order confirmations, shipping updates, delivery notifications, return status updates, and abandoned cart reminders
  • Healthcare — Appointment reminders, prescription refill notifications, lab result delivery, and patient follow-ups
  • Education — Course enrollment confirmations, assignment deadlines, exam results, and parent-teacher communication
  • Real Estate — Property listing alerts, viewing confirmations, offer notifications, and tenant communication
  • Financial Services — Transaction alerts, invoice delivery, payment reminders, and account notifications
  • Restaurants — Order confirmations, table reservation reminders, feedback collection, and promotional offers
  • Logistics — Shipment tracking updates, delivery confirmations, driver assignments, and warehouse notifications

Any business that communicates with customers via WhatsApp can benefit from automating those conversations through the API. The key is identifying which messages are repetitive and predictable — those are the ones that should be automated.

Getting Started

  1. Create a free account — takes 30 seconds
  2. Choose a plan that fits your needs
  3. Create an instance from your dashboard
  4. Connect your phone number via QR code or pairing code
  5. Use your API key to send your first message

If you need help getting started, check our API documentation or contact our support team.

Ready to Build With WhatsApp API?

Join thousands of developers using our API to automate messaging and build better customer experiences.

Get Started Free