Adresa de baza
https://api.sms24.ro/api/v1
Autentificare
Toate cererile necesita cheia clientului in headerul X-API-Key.
X-API-Key: sms_live_CHEIA_CLIENTULUI
Content-Type: application/json
Accept: application/json
Content-Type: application/json
Accept: application/json
Endpointuri
| Metoda | Endpoint | Descriere |
|---|---|---|
| POST | /messages | Trimite un SMS. |
| GET | /messages | Lista paginata a mesajelor. |
| GET | /messages/{id} | Detaliile unui mesaj. |
| GET | /account/balance | Soldul clientului. |
Trimite un SMS
POST /messages
| Camp | Tip | Reguli |
|---|---|---|
to | string | Format E.164, exemplu +40722123456. Este acceptat si 0722123456. |
text | string | Obligatoriu, maximum 1600 caractere, fara diacritice. |
curl -X POST "https://api.sms24.ro/api/v1/messages" \
-H "X-API-Key: sms_live_CHEIA_CLIENTULUI" \
-H "Content-Type: application/json" \
-d '{"to":"+40722123456","text":"Mesaj de test"}'
-H "X-API-Key: sms_live_CHEIA_CLIENTULUI" \
-H "Content-Type: application/json" \
-d '{"to":"+40722123456","text":"Mesaj de test"}'
Raspuns 202 Accepted
{
"id": "01K...",
"status": "queued",
"to": "+40722123456",
"cost_ron": 0.05,
"currency": "RON",
"created_at": "2026-08-25T10:00:00.000000Z"
}
"id": "01K...",
"status": "queued",
"to": "+40722123456",
"cost_ron": 0.05,
"currency": "RON",
"created_at": "2026-08-25T10:00:00.000000Z"
}
Verifica mesajele
GET /messages returneaza 25 de rezultate pe pagina. Pentru alta pagina foloseste ?page=2.
curl "https://api.sms24.ro/api/v1/messages" \
-H "X-API-Key: sms_live_CHEIA_CLIENTULUI"
-H "X-API-Key: sms_live_CHEIA_CLIENTULUI"
Pentru un singur mesaj:
curl "https://api.sms24.ro/api/v1/messages/ID_MESAJ" \
-H "X-API-Key: sms_live_CHEIA_CLIENTULUI"
-H "X-API-Key: sms_live_CHEIA_CLIENTULUI"
Statusuri: queued, processing, sent si failed.
Verifica soldul
GET /account/balance
curl "https://api.sms24.ro/api/v1/account/balance" \
-H "X-API-Key: sms_live_CHEIA_CLIENTULUI"
-H "X-API-Key: sms_live_CHEIA_CLIENTULUI"
Raspuns 200 OK
{
"balance_ron": 100.00,
"currency": "RON"
}
"balance_ron": 100.00,
"currency": "RON"
}
Fire rate
Limita este configurata per client. La 1 SMS / 3 secunde, a doua cerere din aceeasi fereastra primeste statusul 429.
{
"error": "rate_limit_exceeded",
"message": "Maximum 1 SMS la 3 secunde.",
"retry_after": 2
}
"error": "rate_limit_exceeded",
"message": "Maximum 1 SMS la 3 secunde.",
"retry_after": 2
}
Headerul Retry-After indica dupa cate secunde poate fi repetata cererea.
Coduri de raspuns
| Cod | Semnificatie |
|---|---|
200 | Cerere reusita. |
202 | SMS acceptat in coada. |
401 | Cheie API lipsa, invalida sau revocata. |
402 | Credit insuficient. |
404 | Mesaj inexistent. |
422 | Date invalide sau text cu diacritice. |
429 | Fire rate depasit. |
Important: cheia API trebuie pastrata pe server. Nu o include in JavaScript public sau in repository.