Send your first WhatsApp message via API in 2 minutes · Lime API
Register, link your number by QR, copy two credentials and send a WhatsApp message from cURL, Node.js, Python or PHP. Plus files and webhooks.
This guide takes you from zero to a WhatsApp message sent from your own code. No Meta Business Manager, no template approval, no verification queue. You link a regular WhatsApp number the same way WhatsApp Web does, and you get an HTTPS endpoint for it.
By the end you will have sent a text, sent a file and received an incoming message on your server.
What you need
- A phone with WhatsApp (the regular app or WhatsApp Business)
- A free Lime API account: register here, no credit card
- A terminal, or any language that can make an HTTPS request
The free Developer plan lets you send and receive with up to 3 destination numbers. That is enough to build and test everything in this guide. When you go live, you move to a paid plan and the limit disappears (see pricing).
Step 1: Create an instance
After you sign up, click New instance in the dashboard. An instance is one WhatsApp number connected to Lime. Each instance has its own credentials, settings, webhooks and inbox.
Step 2: Link your phone
The instance Overview page shows a QR code.
- Open WhatsApp on your phone
- Tap Menu ⋮ or Settings and choose Linked devices
- Tap Link a device and scan the QR code
If scanning is awkward (for example, the phone is with a client), use a pairing code instead: click Get pairing code in the panel, then on the phone tap Link a device and Link with phone number instead, and type the code.
The state switches to authorized within seconds and your chats start syncing. That is the whole setup.
Step 3: Copy your credentials
The same Overview page shows two values:
idInstance: the numeric ID of the instanceapiTokenInstance: the secret token for that instance
Every API call uses this URL pattern:
https://api.lime-api.com/waInstance{idInstance}/{method}/{apiTokenInstance}
Treat apiTokenInstance like a password. If it ever leaks, rotate it from the Overview page. The old token stops working immediately.
Step 4: Send a text message
Messages are addressed by chatId. For a person it is the full international number, digits only, followed by @c.us. An Israeli mobile number 050-123-4567 becomes 972501234567@c.us. A US number +1 555 123 4567 becomes 15551234567@c.us. Group chats end with @g.us.
The method is sendMessage, a POST with a JSON body. Replace 1101234567 and YOUR_TOKEN with your own values.
cURL
curl -X POST "https://api.lime-api.com/waInstance1101234567/sendMessage/YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"chatId": "972501234567@c.us", "message": "Hello from Lime API"}'
Node.js (18+, built-in fetch)
const ID = '1101234567'
const TOKEN = process.env.LIME_TOKEN
const res = await fetch('https://api.lime-api.com/waInstance' + ID + '/sendMessage/' + TOKEN, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ chatId: '972501234567@c.us', message: 'Hello from Lime API' }),
})
console.log(await res.json()) // { idMessage: '3EB0C767D26A1D8A4E1F' }
Python
import os
import requests
ID = "1101234567"
TOKEN = os.environ["LIME_TOKEN"]
url = f"https://api.lime-api.com/waInstance{ID}/sendMessage/{TOKEN}"
r = requests.post(url, json={"chatId": "972501234567@c.us", "message": "Hello from Lime API"})
print(r.json()) # {'idMessage': '3EB0C767D26A1D8A4E1F'}
PHP
<?php
$id = '1101234567';
$token = getenv('LIME_TOKEN');
$url = "https://api.lime-api.com/waInstance$id/sendMessage/$token";
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode(['chatId' => '972501234567@c.us', 'message' => 'Hello from Lime API']),
]);
echo curl_exec($ch);
The response contains an idMessage. Store it if you want to match delivery and read receipts later. Optional fields: quotedMessageId to reply to a specific message, and linkPreview to turn link previews off. Text can be up to 20,000 characters and supports WhatsApp formatting such as *bold*.
Step 5: Send a file
To send an image, PDF, video or audio file that already sits at a public URL, use sendFileByUrl:
curl -X POST "https://api.lime-api.com/waInstance1101234567/sendFileByUrl/YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"chatId": "972501234567@c.us", "urlFile": "https://example.com/invoice.pdf", "fileName": "invoice.pdf", "caption": "Your invoice"}'
The file extension in fileName decides how WhatsApp shows it: a .jpg arrives as a photo, a .pdf as a document. If the file is on your server and not public, use sendFileByUpload with multipart/form-data (up to 100 MB). Other send methods include sendLocation, sendContact, sendPoll and sendReaction. All of them are listed in the API docs.
Step 6: Receive messages with webhooks
Sending is half the story. To react to customers you need incoming messages pushed to your server.
- Open the instance settings in the panel and set your webhook URL (or call
setSettings with webhookUrl) - Optionally set
webhookUrlToken. Lime sends it as an Authorization: Bearer header so you can reject requests that are not from Lime - Send a WhatsApp message to your linked number from another phone
Your endpoint receives a JSON POST like this:
{
"typeWebhook": "incomingMessageReceived",
"instanceData": { "idInstance": 1101234567, "wid": "972541112222@c.us", "typeInstance": "whatsapp" },
"timestamp": 1760188800,
"idMessage": "3EB0C767D26A1D8A4E1F",
"senderData": { "chatId": "972501234567@c.us", "senderName": "Emma" },
"messageData": { "typeMessage": "textMessage", "textMessageData": { "textMessage": "Hello!" } }
}
Return HTTP 200 quickly and do the heavy work afterwards. Failed deliveries are retried with exponential backoff, and the panel keeps a webhook log you can inspect and replay. Besides incoming messages you can receive delivery statuses (outgoingMessageStatus), messages you sent from the phone, calls and connection state changes.
No public server yet? You can poll with receiveNotification and acknowledge each item with deleteNotification. It is fine for local development; webhooks are better in production.
Already using Green API?
Lime is compatible with Green API: same URL paths, same method names, same webhook payloads. Existing code and SDKs work after you change the host in the base URL to api.lime-api.com and use your Lime credentials. The full walkthrough is in How to migrate from Green API, and the differences are covered in Lime API vs Green API.
Before you send at scale
This API links a regular WhatsApp number, so WhatsApp's own rules apply. Numbers that send unsolicited bulk messages get blocked. Lime gives you anti-ban protection (random delays, typing simulation, daily limits and a sending window), and a queue so sends go out at a steady pace. Read How to avoid a WhatsApp ban before your first campaign, and unofficial vs official WhatsApp API if you are still choosing an approach.
Where to go next
Start free
The Developer plan is free and includes the full API, webhooks and the AI connector. Create your account and send your first message in the next two minutes. When you are ready for production, Pro is $9.90 per number per month with no per-message fees. See pricing.