API-documentatie

Automatiseer aankopen met de REST-API van iLoveSMS of het SMS-Activate-protocol.

Je persoonlijke API-sleutel staat in je accountinstellingen. Registreren

REST JSON API v1

Basis-URL: https://ilovesms.com.tr/api/v1/ — Authenticatie: ?api_key=… / Authorization: Bearer …

MethodParametersOmschrijving
GET services—Diensten met laagste prijs en voorraad.
GET countries—Landenlijst.
GET pricesservicePrijzen en voorraad per land voor een dienst.
GET balanceapi_keyJe saldo.
POST buyapi_key, service, country_idKoop een nummer; de prijs gaat van je saldo af.
GET statusapi_key, idBestelstatus en sms-code.
POST cancelapi_key, idAnnuleer een wachtende bestelling en betaal terug.
POST finishapi_key, idSluit een nummer na ontvangst van de code.
GET ordersapi_keyJe laatste 100 bestellingen.
# 1) Nummer kopen
curl -X POST "https://ilovesms.com.tr/api/v1/buy" -d "api_key=YOUR_API_KEY" -d "service=tg" -d "country_id=12"

{"ok":true,"order":{"id":1042,"service":"Telegram","country":"USA","number":"12025550123",
 "price":0.45,"status":"waiting","code":null,"seconds_left":1200}}

# 2) Vraag elke 5 seconden op tot de code binnen is
curl "https://ilovesms.com.tr/api/v1/status?api_key=YOUR_API_KEY&id=1042"

{"ok":true,"order":{"id":1042,"status":"received","code":"48213", ...}}

Foutcodes: bad_key, bad_service, insufficient, no_numbers, not_cancelable, cancel_later

Webhooks

In plaats van steeds te pollen, geef ons een URL en we sturen een JSON-gebeurtenis zodra een code binnenkomt of een bestelling wordt terugbetaald.

POST https://your-server.example/sms-webhook
Content-Type: application/json
X-Event: sms.received          (sms.received | order.refunded | test)
X-Signature: sha256=<hmac_sha256(body, API_KEY)>

{"event":"sms.received","order":{"id":1042,"service":"Telegram","number":"12025550123","status":"received","code":"48213", ...},"sent_at":"2026-10-30T12:00:00+00:00"}

# PHP
$ok = hash_equals('sha256=' . hash_hmac('sha256', file_get_contents('php://input'), API_KEY), $_SERVER['HTTP_X_SIGNATURE']);

Antwoord binnen 5 seconden met HTTP 2xx. Stel je webhook-URL in bij Accountinstellingen

SMS-Activate-compatibel endpoint

Software voor het SMS-Activate-protocol werkt zonder aanpassing: vervang alleen de basis-URL en API-sleutel.

https://ilovesms.com.tr/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getBalance        → ACCESS_BALANCE:12.40
...&action=getNumber&service=tg&country=12                    → ACCESS_NUMBER:1042:12025550123
...&action=getStatus&id=1042                                   → STATUS_WAIT_CODE | STATUS_OK:48213
...&action=setStatus&id=1042&status=8                          → ACCESS_CANCEL
...&action=setStatus&id=1042&status=6                          → ACCESS_ACTIVATION
...&action=getPrices&service=tg                                → {"12":{"tg":{"cost":0.45,"count":3120}}}

Dienstcodes en land-ID's komen uit de methodes services en countries.