DEVELOPER API
SMS API Hantar dengan satu kunci
Hantar teks dari aplikasi, kedai atau sistem tempahan anda melalui API SMS SMSWorld. Harga dan peraturan sama seperti skrin hantar web.
1,000Nombor setiap permintaan
120Permintaan seminit
JSONMasuk dan keluar
QUICK START
Bermula
- 01Cipta kunci di halaman API dalam akaun anda (bermula dengan sw_).
- 02Hantar pengepala Authorization: Bearer <key> bersama setiap permintaan.
- 03Semak kos dengan POST /api/v1/quote, kemudian hantar dengan POST /api/v1/messages.
URL asas
https://smsworld.shop/api/v1
ENDPOINTS
Endpoint
| Permintaan | Fungsi |
|---|---|
GET /api/v1/balance | Baki dalam dolar AS |
GET /api/v1/countries | Negara dan harga setiap SMS (tanpa kunci) |
POST /api/v1/quote | Kos, bahagian dan nombor dibuang sebelum hantar |
POST /api/v1/messages | Hantar, atau jadualkan dengan schedule_at |
GET /api/v1/messages | Penghantaran terkini (limit, offset) |
GET /api/v1/messages/{id} | Satu penghantaran dengan keputusan mengikut negara |
POST /api/v1/messages/{id}/cancel | Batalkan jadual sebelum dihantar, bayaran balik penuh |
SEND
Penghantaran
to ialah tatasusunan nombor atau teks yang dipisahkan baris baharu. Untuk menggunakan nombor tanpa +, tetapkan country kepada kod negara lalai (seperti us atau kr).
| Medan | Keterangan |
|---|---|
to | Penerima. Tatasusunan atau teks baris baharu, maksimum 1,000 |
text | Mesej. Maksimum 10 bahagian |
country | Pilihan. Kod negara untuk nombor tanpa + |
schedule_at | Pilihan. Masa ISO dengan zon waktu (contohnya 2026-12-01T09:00:00Z) atau saat Unix, 5 minit hingga 30 hari dari sekarang |
client_ref | Pilihan. Rujukan anda sendiri, maksimum 64 aksara |
Respons · 201201 Created
{
"ok": true,
"campaign": {
"id": "K7Q2M9XD4TPA",
"status": "sending",
"recipients": 2,
"parts": 1,
"encoding": "GSM-7",
"cost": "0.012",
"countries": [
{ "country": "US", "recipients": 1, "cost": "0.0047" },
{ "country": "GB", "recipients": 1, "cost": "0.0073" }
]
},
"rejected": [],
"duplicates": 0,
"opted_out": 0,
"balance": "48.988"
}POST /api/v1/messages
curl -X POST https://smsworld.shop/api/v1/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": ["+14155550142", "+447400123456"],
"text": "Your order #A2847 has shipped."
}'POST /api/v1/quote
curl -X POST https://smsworld.shop/api/v1/quote \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "to": ["+14155550142", "+819012345678"], "text": "Hello" }'Respons · 200200 OK
{
"ok": true,
"recipients": 2,
"parts": 1,
"encoding": "GSM-7",
"cost": "0.0147",
"balance": "49.00",
"countries": [
{ "country": "JP", "recipients": 1, "price": "0.01", "cost": "0.01" },
{ "country": "US", "recipients": 1, "price": "0.0047", "cost": "0.0047" }
],
"rejected": [],
"duplicates": 0,
"opted_out": 0
}ERRORS
Kod ralat
| Kod | HTTP | Maksud |
|---|---|---|
unauthorized | 401 | Kunci tiada atau salah |
rate_limited | 429 | Melebihi had seminit |
bad_request | 400 | Kandungan permintaan tidak dapat dibaca |
empty_text | 400 | Teks kosong |
too_long | 400 | Teks melebihi 10 bahagian |
no_numbers | 400 | Tiada nombor yang boleh dihantar |
too_many | 400 | Lebih daripada 1,000 nombor |
bad_time | 400 | Masa jadual di luar julat |
low_balance | 402 | Baki tidak mencukupi |
unavailable | 503 | Penghantaran belum dibuka (tiada caj) |
not_found | 404 | Penghantaran tidak wujud |
not_scheduled | 409 | Sudah dihantar atau dibatalkan |
Had dan peraturan
- Maksimum 120 permintaan seminit bagi setiap kunci.
- Jumlah ialah rentetan dolar AS ("0.0047").
- ID penghantaran ialah kod 12 aksara, bukan nombor urutan.
- Semakan nombor dan senarai opt-out yang sama seperti skrin hantar web.