🔐 Authentication
Each request must include the following header:
Authorization: Bearer your_token_here
POST
1. Send SMS
https://devsms.uz/api/send_sms.php
Request Body:
{
"phone": "998901234567",
"message": "Test SMS xabari",
"from": "4546"
}
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| phone | string | Yes | Phone number (format: 998901234567) |
| message | string | Yes | SMS message text |
| from | string | No | From (default: 4546) |
Response:
{
"success": true,
"message": "SMS muvaffaqiyatli yuborildi",
"data": {
"sms_id": 123,
"request_id": "uuid-here",
"status": "waiting",
"parts_count": 1,
"total_cost": 50,
"balance": 950
}
}
GET
2. Get SMS History
https://devsms.uz/api/get_history.php
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
| limit | integer | 50 | Number of SMS (max: 200) |
| offset | integer | 0 | Offset |
| status | string | null | Status filter (DELIVERED, waiting, REJECTED) |
Example:
GET https://devsms.uz/api/get_history.php?limit=10&offset=0&status=DELIVERED
GET
3. Get Balance
https://devsms.uz/api/get_balance.php
Response:
{
"success": true,
"data": {
"balance": 1000,
"sms_price": 50,
"statistics": {
"total_sms": 100,
"total_spent": 5000,
"today_sms": 10,
"today_spent": 500,
"month_sms": 50,
"month_spent": 2500
}
}
}
GET
4. Get SMS Status
https://devsms.uz/api/get_status.php
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
| sms_id | integer | SMS ID (database ID) |
| request_id | string | Eskiz request ID |
Example:
GET https://devsms.uz/api/get_status.php?sms_id=123
or
GET https://devsms.uz/api/get_status.php?request_id=uuid-here
📝 SMS Statuses
| Status | Description |
|---|---|
| waiting | SMS is waiting |
| ACCEPTED | SMS sent to operator |
| DELIVERED | SMS delivered |
| REJECTED | SMS rejected |
| UNDELIVERABLE | SMS undeliverable |
❌ Errors
When an error occurs, the following format is returned:
{
"success": false,
"error": "Xatolik xabari"
}
HTTP Status Codes:
| Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request |
| 401 | Authentication Error |
| 403 | Forbidden |
| 404 | Not Found |
| 500 | Server Error |
Tip:
You can use Postman or cURL to test the API.
🔧 cURL Examples
Send SMS:
curl -X POST https://devsms.uz/api/send_sms.php \
-H "Authorization: Bearer your_token" \
-H "Content-Type: application/json" \
-d '{
"phone": "998901234567",
"message": "Test SMS"
}'
Get Balance:
curl -X GET https://devsms.uz/api/get_balance.php \
-H "Authorization: Bearer your_token"