Complete API documentation with examples
All API requests require authentication using your API key. Include it in the Authorization header:
Authorization: Bearer YOUR_API_KEY
https://tawasol.site/api
/api/send-message
Send a text or media message to a WhatsApp number.
{
"device_id": "string (required)",
"to": "string (required)",
"message": "string (required)",
"type": "text|image|video|document|audio"
}
curl -X POST https://tawasol.site/api/send-message \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"device_id": "device_123",
"to": "1234567890",
"message": "Hello from API!"
}'
/api/devices
Get a list of all connected devices.
curl -X GET https://tawasol.site/api/devices \
-H "Authorization: Bearer YOUR_API_KEY"
/api/devices/{device_id}
Get the status and information of a specific device.
/api/messages
Retrieve message history with optional filters.
device_id - Filter by deviceto - Filter by recipientlimit - Number of results (default: 50)page - Page number/api/webhook
Configure webhook URL for receiving events.
{
"device_id": "string (required)",
"url": "string (required)",
"events": ["message", "status", "device"]
}
/api/contacts
Add a new contact to your phonebook.
All API responses follow a consistent format:
{
"success": true,
"data": { ... },
"message": "Operation successful"
}
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Error description"
}
}
API requests are rate-limited to ensure fair usage:
| Code | الوصف |
|---|---|
400 |
Bad Request - Invalid parameters |
401 |
Unauthorized - Invalid or missing API key |
404 |
Not Found - Resource does not exist |
429 |
Too Many Requests - Rate limit exceeded |
500 |
Internal Server Error |