API Introduction
Get started with the Wasapia API. Learn about authentication, rate limits, and basic API concepts to integrate WhatsApp automation into your applications.
Get started with the Wasapia API. Learn about authentication, rate limits, and basic API concepts to integrate WhatsApp automation into your applications.
Welcome to the Wasapia API! Our RESTful API allows you to integrate WhatsApp automation capabilities directly into your applications, websites, and workflows.
All API requests should be made to:
https://api.wasapia.com/v1
The Wasapia API uses API keys for authentication. You can generate API keys from your account dashboard.
Include your API key in the Authorization
header of all requests:
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.wasapia.com/v1/campaigns
⚠️ Important: Keep your API key secure and never expose it in client-side code.
All API requests should:
Content-Type: application/json
header for POST/PUT requestscurl -X POST https://api.wasapia.com/v1/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "+1234567890",
"message": "Hello from Wasapia!",
"type": "text"
}'
All API responses are returned as JSON with the following structure:
{
"success": true,
"data": {
"id": "msg_12345",
"status": "sent",
"to": "+1234567890",
"message": "Hello from Wasapia!",
"created_at": "2024-06-02T10:30:00Z"
},
"meta": {
"request_id": "req_67890",
"timestamp": "2024-06-02T10:30:00Z"
}
}
{
"success": false,
"error": {
"code": "INVALID_PHONE_NUMBER",
"message": "The phone number format is invalid",
"details": {
"field": "to",
"provided": "invalid-number"
}
},
"meta": {
"request_id": "req_67890",
"timestamp": "2024-06-02T10:30:00Z"
}
}
To ensure service quality for all users, the API implements rate limiting:
Plan | Requests per Minute | Requests per Hour |
---|---|---|
Free | 60 | 1,000 |
Pro | 300 | 10,000 |
Enterprise | 1,000 | 50,000 |
Each response includes rate limit information:
X-RateLimit-Limit: 300
X-RateLimit-Remaining: 299
X-RateLimit-Reset: 1635724800
When you exceed the rate limit, you'll receive a 429 Too Many Requests
response:
{
"success": false,
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests. Please try again later.",
"retry_after": 60
}
}
Common error codes you may encounter:
Code | Description |
---|---|
INVALID_API_KEY |
The provided API key is invalid or expired |
INVALID_PHONE_NUMBER |
The phone number format is incorrect |
MESSAGE_TOO_LONG |
The message exceeds the maximum length |
INSUFFICIENT_CREDITS |
Your account doesn't have enough credits |
RATE_LIMIT_EXCEEDED |
You've exceeded the rate limit |
CAMPAIGN_NOT_FOUND |
The specified campaign doesn't exist |
VALIDATION_ERROR |
Request validation failed |
List endpoints use cursor-based pagination:
curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://api.wasapia.com/v1/messages?limit=50&cursor=eyJpZCI6MTIzfQ"
{
"success": true,
"data": [
// ... message objects
],
"pagination": {
"has_more": true,
"next_cursor": "eyJpZCI6MTczfQ",
"total_count": 1250
}
}
Wasapia can send webhook notifications for various events. Configure webhooks in your dashboard under Settings → Webhooks.
message.sent
- Message successfully sentmessage.delivered
- Message delivered to recipientmessage.read
- Message read by recipientmessage.failed
- Message failed to sendcampaign.completed
- Campaign finished sending{
"event": "message.delivered",
"data": {
"id": "msg_12345",
"status": "delivered",
"to": "+1234567890",
"delivered_at": "2024-06-02T10:35:00Z"
},
"webhook_id": "wh_67890",
"timestamp": "2024-06-02T10:35:00Z"
}
We provide official SDKs for popular programming languages:
npm install @wasapia/sdk
const Wasapia = require("@wasapia/sdk");
const client = new Wasapia({
apiKey: "your-api-key",
});
// Send a message
const message = await client.messages.send({
to: "+1234567890",
message: "Hello from Wasapia!",
type: "text",
});
pip install wasapia-python
from wasapia import Wasapia
client = Wasapia(api_key='your-api-key')
# Send a message
message = client.messages.send(
to='+1234567890',
message='Hello from Wasapia!',
type='text'
)
composer require wasapia/sdk
<?php
use Wasapia\WasapiaClient;
$client = new WasapiaClient('your-api-key');
// Send a message
$message = $client->messages->send([
'to' => '+1234567890',
'message' => 'Hello from Wasapia!',
'type' => 'text'
]);
Use our sandbox environment for testing:
https://api-sandbox.wasapia.com/v1
The sandbox environment:
Need help with the API? We're here to help:
Now that you understand the basics, explore these topics:
Ready to start building? Get your API key and send your first message!