🔐 Autentifikatsiya
Har bir so'rovda quyidagi header yuborilishi kerak:
Authorization: Bearer your_token_here
1. SMS Yuborish
https://devsms.uz/api/send_sms.php
Request Body:
{
"phone": "998901234567",
"message": "Test SMS xabari",
"from": "4546",
"callback_url": "https://your-domain.com/sms-callback"
}
Parametrlar:
| Parametr | Turi | Majburiy | Tavsif |
|---|---|---|---|
| phone | string | Ha | Telefon raqam (998901234567 yoki xalqaro: 12025551234) |
| message | string | Ha | SMS matni |
| from | string | Yo'q | Kimdan (default: 4546) |
| callback_url | string | Yo'q | SMS status o'zgarganda natija yuboriladigan URL (http:// yoki https://) |
| type | string | Yo'q | SMS turi: eskiz (default), simple, universal_otp |
Response:
// O'zbekiston raqamiga
{
"success": true,
"message": "SMS muvaffaqiyatli yuborildi",
"data": {
"sms_id": 123,
"request_id": "uuid-here",
"status": "sent",
"parts_count": 1,
"total_cost": 50,
"balance": 950,
"type": "eskiz"
}
}
// Xalqaro raqamga
{
"success": true,
"message": "SMS muvaffaqiyatli yuborildi",
"data": {
"sms_id": 124,
"request_id": "uuid-here",
"status": "sent",
"parts_count": 1,
"total_cost": 112,
"balance": 838,
"type": "eskiz",
"country": "United States",
"country_code": "us"
}
}
1.1 Universal OTP SMS
https://devsms.uz/api/send_sms.php
Eskiz orqali universal OTP shablonlari yordamida tasdiqlash kodi yuborish. Korxona nomi AI moderatsiyadan o'tkaziladi.
Universal shablonlar Eskiz tomonidan tasdiqlangan. Siz faqat korxona nomini va OTP kodni kiritasiz. Korxona nomi nomaqbul bo'lsa SMS yuborilmaydi, lekin balansdan pul yechiladi!
Request Body:
{
"phone": "998901234567",
"type": "universal_otp",
"template_type": 1,
"service_name": "TechShop",
"otp_code": "5678"
}
Parametrlar:
| Parametr | Turi | Majburiy | Tavsif |
|---|---|---|---|
| phone | string | Ha | Telefon raqam (998901234567 yoki xalqaro: 12025551234) |
| type | string | Ha | "universal_otp" |
| template_type | integer | Ha | Shablon turi: 1=Amaliyot tasdiqlash, 2=Parol tiklash, 3=Ro'yxatdan o'tish, 4=Tizimga kirish |
| service_name | string | Ha | Korxona/servis nomi (2-50 belgi, faqat harflar, raqamlar, bo'shliq, nuqta, tire) |
| otp_code | string | Ha | OTP tasdiqlash kodi (4-8 ta raqam) |
Mavjud shablonlar:
MyService tizimi: {service_name} xizmatida amaliyotni tasdiqlash kodi: {otp_code}
MyService tizimi: {service_name} xizmatida parolni tiklash uchun tasdiqlash kodi: {otp_code}
MyService tizimi: {service_name} xizmatiga ro'yxatdan o'tish uchun tasdiqlash kodi: {otp_code}
MyService tizimi: {service_name} xizmatiga kirish uchun tasdiqlash kodi: {otp_code}
Response:
{
"success": true,
"message": "SMS muvaffaqiyatli yuborildi",
"data": {
"sms_id": 456,
"request_id": "uuid-here",
"status": "sent",
"parts_count": 1,
"total_cost": 50,
"balance": 950,
"type": "universal_otp"
}
}
Bloklangan SMS javobi:
{
"success": false,
"error": "Korxona nomi nomaqbul deb topildi: ... SMS yuborilmadi, lekin to'lov yechildi."
}
2. SMS Tarixini Olish
https://devsms.uz/api/get_history.php
Query Parametrlar:
| Parametr | Turi | Default | Tavsif |
|---|---|---|---|
| limit | integer | 50 | Nechta SMS (max: 200) |
| offset | integer | 0 | Offset |
| status | string | null | Status filter (sent, delivered, failed) |
Misol:
GET https://devsms.uz/api/get_history.php?limit=10&offset=0&status=delivered
Response:
{
"success": true,
"data": {
"history": [
{
"id": 123,
"phone_number": "998901234567",
"message": "Salom!",
"status": "delivered",
"parts_count": 1,
"total_cost": 50,
"from_number": "4546",
"eskiz_request_id": "uuid-here",
"eskiz_message_id": "msg-id",
"sent_at": "2026-03-09 10:30:00",
"delivered_at": "2026-03-09 10:30:05",
"failed_at": null,
"created_at": "2026-03-09 10:29:58"
}
],
"count": 1,
"limit": 10,
"offset": 0
}
}
Status vaqtlari
| Parametr | Tavsif |
|---|---|
| created_at | SMS yaratilgan vaqt |
| sent_at | SMS yuborilgan vaqt |
| delivered_at | SMS yetkazilgan vaqt |
| failed_at | SMS muvaffaqiyatsiz bo'lgan vaqt |
3. Balansni Olish
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 }
}
}
4. SMS Statusini Olish
https://devsms.uz/api/get_status.php
Query Parametrlar:
| Parametr | Turi | Tavsif |
|---|---|---|
| sms_id | integer | SMS ID (database'dagi ID) |
| request_id | string | Eskiz request ID |
Misol:
GET https://devsms.uz/api/get_status.php?sms_id=123
yoki
GET https://devsms.uz/api/get_status.php?request_id=uuid-here
Response:
{
"success": true,
"data": {
"id": 123,
"phone_number": "998901234567",
"message": "Salom!",
"status": "delivered",
"parts_count": 1,
"total_cost": 50,
"from_number": "4546",
"eskiz_request_id": "uuid-here",
"eskiz_message_id": "msg-id",
"sent_at": "2026-03-09 10:30:00",
"delivered_at": "2026-03-09 10:30:05",
"failed_at": null,
"created_at": "2026-03-09 10:29:58",
"updated_at": "2026-03-09 10:30:05"
}
}
🔔 Callback URL
SMS yuborishda callback_url parametrini qo'shsangiz, SMS status o'zgarganda (yuborildi, yetkazildi, muvaffaqiyatsiz) sizning URL'ingizga POST so'rov yuboriladi.
Callback qachon yuboriladi:
Sizning URL'ingizga yuboriladigan ma'lumot:
{
"sms_id": 123,
"request_id": "uuid-here",
"phone": "998901234567",
"status": "delivered",
"sent_at": "2026-03-09 10:30:00",
"delivered_at": "2026-03-09 10:30:05",
"failed_at": null,
"timestamp": "2026-03-09 10:30:05"
}
Parametrlar:
| Parametr | Turi | Tavsif |
|---|---|---|
| sms_id | integer | SMS ID (database'dagi ID) |
| request_id | string | Eskiz request ID |
| phone | string | Telefon raqam (998901234567 yoki xalqaro: 12025551234) |
| status | string | Status filter (sent, delivered, failed) |
| sent_at | string|null | SMS yuborilgan vaqt |
| delivered_at | string|null | SMS yetkazilgan vaqt |
| failed_at | string|null | SMS muvaffaqiyatsiz bo'lgan vaqt |
| timestamp | string | SMS yaratilgan vaqt |
Eslatma: Callback 5 soniya timeout bilan yuboriladi. Agar sizning serveringiz javob bermasa, qayta urinish amalga oshirilmaydi.
📝 SMS Statuslar
| Status | Tavsif |
|---|---|
| pending | SMS hali yuborilmagan (kutish holatida) |
| sent | SMS yuborildi (Eskiz qabul qildi) |
| delivered | SMS qabul qiluvchiga yetkazildi |
| failed | SMS muvaffaqiyatsiz (rad etildi yoki yetkazilmadi) |
❌ Xatoliklar
Xatolik yuz berganda quyidagi format qaytariladi:
{
"success": false,
"error": "Xatolik xabari"
}
HTTP Status Kodlar:
| Kod | Tavsif |
|---|---|
| 200 | Muvaffaqiyatli |
| 400 | Noto'g'ri so'rov |
| 401 | Autentifikatsiya xatosi |
| 403 | Ruxsat yo'q |
| 404 | Topilmadi |
| 500 | Server xatosi |
Maslahat:
API'ni test qilish uchun Postman yoki cURL ishlatishingiz mumkin.
🌍 Xalqaro SMS Narxlari
Xalqaro raqamga SMS yuborish uchun phone parametriga xalqaro formatda raqam kiriting (masalan: 12025551234). Davlat va narx avtomatik aniqlanadi. Simple SMS faqat O'zbekiston raqamlariga yuboriladi.
| Davlat | Telefon kodi | Mahalliy user (so'm) | Chet el user (so'm) |
|---|---|---|---|
| Afghanistan (AF) | +93 | 6 558 | 7 607 |
| Aland Islands (AX) | +35818 | 1 530 | 1 775 |
| Albania (AL) | +355 | 1 652 | 1 916 |
| Angola (AO) | +244 | 2 053 | 2 381 |
| Argentina (AR) | +54 | 1 293 | 1 500 |
| Armenia (AM) | +374 | 3 092 | 3 586 |
| Aruba (AW) | +297 | 1 824 | 2 116 |
| Australia (AU) | +61 | 1 089 | 1 263 |
| Austria (AT) | +43 | 1 734 | 2 012 |
| Azerbaijan (AZ) | +994 | 7 398 | 8 582 |
| Bahamas (BS) | +1242 | 140 | 163 |
| Bahrain (BH) | +973 | 838 | 972 |
| Bangladesh (BD) | +880 | 5 119 | 5 938 |
| Barbados (BB) | +1246 | 140 | 163 |
| Belarus (BY) | +375 | 4 815 | 5 586 |
| Belgium (BE) | +32 | 1 860 | 2 158 |
| Belize (BZ) | +501 | 6 139 | 7 121 |
| Bosnia and Herzegovina (BA) | +387 | 129 | 150 |
| Brazil (BR) | +55 | 1 103 | 1 279 |
| Bulgaria (BG) | +359 | 2 752 | 3 192 |
| Cambodia (KH) | +855 | 2 919 | 3 386 |
| Canada (CA) | +1 | 140 | 163 |
| Central African Republic (CF) | +236 | 732 | 849 |
| China (CN) | +86 | 769 | 892 |
| Colombia (CO) | +57 | 892 | 1 034 |
| Croatia (HR) | +385 | 1 648 | 1 912 |
| Cuba (CU) | +53 | 1 497 | 1 736 |
| Cyprus (CY) | +357 | 1 557 | 1 806 |
| Czech Republic (CZ) | +420 | 1 177 | 1 365 |
| Denmark (DK) | +45 | 1 139 | 1 321 |
| Egypt (EG) | +20 | 3 675 | 4 263 |
| Estonia (EE) | +372 | 1 690 | 1 961 |
| Finland (FI) | +358 | 1 584 | 1 838 |
| France (FR) | +33 | 1 422 | 1 649 |
| Georgia (GE) | +995 | 3 868 | 4 487 |
| Germany (DE) | +49 | 2 014 | 2 336 |
| Greece (GR) | +30 | 1 115 | 1 294 |
| Guernsey (GG) | +441481 | 898 | 1 042 |
| Hong Kong (HK) | +852 | 1 430 | 1 659 |
| Hungary (HU) | +36 | 1 555 | 1 804 |
| Iceland (IS) | +354 | 1 433 | 1 662 |
| India (IN) | +91 | 1 528 | 1 772 |
| Indonesia (ID) | +62 | 7 730 | 8 967 |
| Iran (IR) | +98 | 4 037 | 4 683 |
| Iraq (IQ) | +964 | 5 402 | 6 266 |
| Ireland (IE) | +353 | 1 324 | 1 536 |
| Israel (IL) | +972 | 3 508 | 4 069 |
| Italy (IT) | +39 | 1 670 | 1 938 |
| Japan (JP) | +81 | 1 584 | 1 838 |
| Kazakhstan (KZ) | +77 | 10 398 | 12 062 |
| Kuwait (KW) | +965 | 4 974 | 5 770 |
| Kyrgyzstan (KG) | +996 | 6 323 | 7 335 |
| Latvia (LV) | +371 | 1 335 | 1 549 |
| Liechtenstein (LI) | +423 | 1 092 | 1 266 |
| Lithuania (LT) | +370 | 1 207 | 1 400 |
| Luxembourg (LU) | +352 | 1 460 | 1 694 |
| Macedonia (MK) | +389 | 1 282 | 1 487 |
| Madagascar (MG) | +261 | 8 275 | 9 599 |
| Malaysia (MY) | +60 | 1 403 | 1 627 |
| Maldives (MV) | +960 | 595 | 691 |
| Malta (MT) | +356 | 1 604 | 1 861 |
| Mexico (MX) | +52 | 928 | 1 076 |
| Moldova (MD) | +373 | 1 408 | 1 633 |
| Monaco (MC) | +377 | 2 869 | 3 328 |
| Mongolia (MN) | +976 | 3 619 | 4 198 |
| Morocco (MA) | +212 | 3 594 | 4 169 |
| Myanmar (MM) | +95 | 4 343 | 5 038 |
| Netherlands (NL) | +31 | 1 799 | 2 087 |
| New Zealand (NZ) | +64 | 1 858 | 2 155 |
| Norway (NO) | +47 | 1 313 | 1 523 |
| Oman (OM) | +968 | 2 768 | 3 211 |
| Pakistan (PK) | +92 | 7 350 | 8 526 |
| Philippines (PH) | +63 | 3 930 | 4 559 |
| Poland (PL) | +48 | 777 | 901 |
| Portugal (PT) | +351 | 964 | 1 118 |
| Qatar (QA) | +974 | 1 140 | 1 323 |
| Romania (RO) | +40 | 1 367 | 1 585 |
| Russia (RU) | +7 | 10 398 | 12 062 |
| Saudi Arabia (SA) | +966 | 2 105 | 2 442 |
| Serbia (RS) | +381 | 3 910 | 4 536 |
| Singapore (SG) | +65 | 989 | 1 147 |
| Slovakia (SK) | +421 | 1 665 | 1 932 |
| Slovenia (SI) | +386 | 3 619 | 4 198 |
| South Korea (KR) | +82 | 905 | 1 050 |
| Spain (ES) | +34 | 679 | 788 |
| Sri Lanka (LK) | +94 | 5 173 | 6 001 |
| Sweden (SE) | +46 | 1 184 | 1 374 |
| Switzerland (CH) | +41 | 1 313 | 1 523 |
| Taiwan (TW) | +886 | 1 005 | 1 166 |
| Tajikistan (TJ) | +992 | 10 705 | 12 418 |
| Thailand (TH) | +66 | 539 | 625 |
| Tunisia (TN) | +216 | 4 777 | 5 541 |
| Turkey (TR) | +90 | 539 | 625 |
| Turkmenistan (TM) | +993 | 3 404 | 3 949 |
| Ukraine (UA) | +380 | 3 168 | 3 675 |
| United Arab Emirates (AE) | +971 | 2 379 | 2 760 |
| United Kingdom (GB) | +44 | 933 | 1 082 |
| United States (US) | +1 | 140 | 163 |
| Uruguay (UY) | +598 | 1 707 | 1 980 |
| Vietnam (VI) | +1340 | 140 | 163 |
Narxlar 1 SMS qismiga to'g'ri keladi. Uzun SMS bir nechta qismdan iborat bo'lishi mumkin.
Xalqaro SMS misol:
// USA
{
"phone": "12025551234",
"message": "Hello from Uzbekistan!"
}
// Russia
{
"phone": "79161234567",
"message": "Privet iz Uzbekistana!"
}
// Kazakhstan
{
"phone": "77011234567",
"message": "Salom Qozog'istondan!"
}
🔧 cURL Misollari
SMS Yuborish:
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"
}'
Balansni Olish:
curl -X GET https://devsms.uz/api/get_balance.php \
-H "Authorization: Bearer your_token"
💻 Kod Namunalari
Dasturlash tilini tanlang:
<?php
// DevSMS API - PHP Example
$token = "your_api_token_here";
$baseUrl = "https://devsms.uz/api";
// SMS Yuborish
function sendSMS($token, $baseUrl, $phone, $message) {
$ch = curl_init("$baseUrl/send_sms.php");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $token",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => json_encode([
"phone" => $phone,
"message" => $message
])
]);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
// Balansni olish
function getBalance($token, $baseUrl) {
$ch = curl_init("$baseUrl/get_balance.php");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $token"
]
]);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
// Ishlatish
$result = sendSMS($token, $baseUrl, "998901234567", "Salom!");
print_r($result);
$balance = getBalance($token, $baseUrl);
print_r($balance);
?>