API Details
Manage your API credentials and integrate WhatsApp messaging into your applications
API Credentials
Use these credentials to authenticate your API requests
Important: Keep your API key secure. Never share it publicly or commit it to version control. Use environment variables to store sensitive credentials.
Quick Start Guide
All API requests require authentication using your API key in the request header:
X-API-Key: your-api-key-here
Send a WhatsApp message using the simple send endpoint:
curl -X POST window.location.origin/api/sessions/send-simple \ -H "Content-Type: application/json" \ -H "X-API-Key: your-api-key" \ -d '{ "phoneNumber": "2348012345678", "message": "Hello from Wappi API!" }'
const axios = require('axios');
const API_ENDPOINT = 'window.location.origin';
const API_KEY = 'your-api-key';
async function sendWhatsAppMessage() {
try {
const response = await axios.post(
`${API_ENDPOINT}/api/sessions/send-simple`,
{
phoneNumber: '2348012345678',
message: 'Hello from Wappi API!'
},
{
headers: {
'Content-Type': 'application/json',
'X-API-Key': API_KEY
}
}
);
console.log('Message sent:', response.data);
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
}
sendWhatsAppMessage();
import requests import json API_ENDPOINT = 'window.location.origin' API_KEY = 'your-api-key' def send_whatsapp_message(): url = f"{API_ENDPOINT}/api/sessions/send-simple" headers = { 'Content-Type': 'application/json', 'X-API-Key': API_KEY } payload = { 'phoneNumber': '2348012345678', 'message': 'Hello from Wappi API!' } try: response = requests.post(url, headers=headers, json=payload) response.raise_for_status() print('Message sent:', response.json()) except requests.exceptions.RequestException as error: print('Error:', error) send_whatsapp_message()
<?php $apiEndpoint = 'window.location.origin'; $apiKey = 'your-api-key'; $data = [ 'phoneNumber' => '2348012345678', 'message' => 'Hello from Wappi API!' ]; $ch = curl_init($apiEndpoint . '/api/sessions/send-simple'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', 'X-API-Key: ' . $apiKey ]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode === 200) { echo "Message sent: " . $response; } else { echo "Error: " . $response; } ?>
Available Endpoints
Complete list of API endpoints available in your plan
Rate Limits & Usage
Current Plan: Free Tier
• 100 messages per day
• 1 WhatsApp device connection
• Rate limit: 10 requests per minute
• Webhook support: Not available
Upgrade to a paid plan for higher limits and advanced features:
Upgrade PlanResponse Format
All API responses follow this standard format:
{
"success": true,
"data": {
"messageId": "msg_123456",
"sessionId": "session_abc",
"phoneNumber": "+2348012345678",
"message": "Hello from Wappi API!",
"sentVia": "+2349087654321"
}
}
{
"success": false,
"error": "No active WhatsApp session found",
"hint": "Contact administrator to access admin panel at /admin.html for session management"
}
Best Practices
1. Secure Your API Key
Never expose your API key in client-side code. Always make API calls from your backend server.
2. Handle Errors Gracefully
Always check the response status and handle errors appropriately. Implement retry logic with exponential backoff.
3. Respect Rate Limits
Monitor your usage and implement request throttling to avoid hitting rate limits.
4. Phone Number Format
Always use international format with country code (e.g., +2348012345678). Include the + symbol.
5. Session Management
Keep your WhatsApp session connected. If disconnected, you'll need to scan the QR code again to reconnect.