Use the API
Use the API when you want your own website, app or software to talk to your WhatsApp account, for example to read contacts or send a message. This guide is for people who work with a developer or know basic API calls. You need an active plan and a connected WhatsApp number.
Find your API endpoint and key#
- Open the API screenClick API in the left menu, under the API heading at the bottom. The page title is API Details.
- Read API CredentialsYou will see two read-only boxes: API Endpoint (the base address of the platform) and API Key (your personal key).
- Copy a valueClick the copy icon at the right of a box. A small Copied message appears. Paste the value into your developer's settings.
- Open the documentationThe API Documentation box has a See API Documentation button when the platform has published a documentation link. If you do not see the button, no link has been set yet.
Your API key is like a password. Share it only with people who must have it, and never paste it in public places such as social media, chat groups or website code that visitors can read. If you think it has leaked, contact support.
API Credentials
API EndpointAPI Documentation
- API Endpoint
- API Key (treat it like a password)
- Documentation button, shown only when a link is set
How requests are authenticated#
Every API address starts with your endpoint followed by /api/. Each request needs your API key in a header called apikey. Most calls also need a login token, which you get by signing in through the API with the email and password of a panel user.
| Step | What to send |
|---|---|
| 1. Sign in | POST to /api/login with header apikey and the fields email and password. The reply contains a token. |
| 2. Call other endpoints | Send the header apikey and the header Authorization: Bearer YOUR_TOKEN on every call. |
Replies are JSON with success, message and data.
{"success": true, "message": "Message sent successfully", "data": {"message_type": "text", "conversation_id": 123, "remaining_conversations": 1499}}Endpoints you can use#
These endpoints exist in the platform. Addresses are written after the /api/ part.
| Address | What it does |
|---|---|
POST login | Sign in and get a token |
GET profile | Read the signed-in user |
GET whatsapp-contact | List your active contacts, 10 per page |
POST whatsapp-contact-store | Add a contact |
GET whatsapp-contact-list | List your contact lists |
GET whatsapp-segment | List your segments |
GET whatsapp-templates | List your templates, 50 per page |
GET whatsapp-campaign | List your campaigns |
POST send-message | Send a text, image or document message to a contact |
POST whatsapp/send-template | Send a template message to a contact |
Send your first message#
- Sign inCall
POST /api/loginas described above and keep the token from the reply. - Find the contact IDCall
GET /api/whatsapp-contact. Each contact in the reply has an ID. Use that ID, not the phone number. - Send the messageCall
POST /api/send-messagewith the fieldsreceiver_id(the contact ID) andmessage. To send a file, sendimageordocumentinstead of a message. - Check the replyA successful reply says the message was sent and shows
remaining_conversations, which is how many conversations are left on your plan.
As per Meta's rules, free-form messages can be delivered only inside the 24-hour customer service window. Outside it, send an approved template with whatsapp/send-template. Sending uses up conversations and campaigns from your plan, so watch your limits.
Common problems#
"API key missing" (401)
The apikey header was not sent. Add it to every request.
"API key invalid" (403)
The key does not match any account. Copy it again from the API screen without extra spaces.
"Invalid Credentials" or a token error
The email or password is wrong, or the token has expired or is missing. Sign in again and send the new token. A banned, unverified or suspended user cannot sign in.
"Insufficient Conversation Limit"
Your plan has no conversations left. See Manage your subscription and billing to check usage or upgrade.
"Contact not found"
The ID does not belong to a contact in your account. Fetch the contact list again and use the ID from there.
Related guides#
- Add and import contacts
- Create and submit a message template
- Troubleshooting: common problems and fixes
Need help?#
Contact support on WhatsApp +91 99159 60958 or email info@whatsappmarketingagency.com, or use the contact page.