APIドキュメント
iLoveSMSのREST APIまたはSMS-Activateプロトコルで番号購入を自動化。
個人用APIキーはアカウント設定にあります。 新規登録
REST JSON API v1
ベースURL: https://ilovesms.com.tr/api/v1/ — 認証: ?api_key=… / Authorization: Bearer …
| Method | パラメータ | 説明 |
|---|---|---|
GET services | — | 最安値と在庫付きのサービス一覧。 |
GET countries | — | 国の一覧。 |
GET prices | service | サービスごとの国別価格と在庫。 |
GET balance | api_key | 残高。 |
POST buy | api_key, service, country_id | 番号を購入(料金は残高から引かれます)。 |
GET status | api_key, id | 注文状況とSMSコード。 |
POST cancel | api_key, id | 待機中の注文をキャンセルして返金。 |
POST finish | api_key, id | コード受信後に番号を終了。 |
GET orders | api_key | 直近100件の注文。 |
# 1) 番号を購入
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) コードが届くまで5秒ごとに確認
curl "https://ilovesms.com.tr/api/v1/status?api_key=YOUR_API_KEY&id=1042"
{"ok":true,"order":{"id":1042,"status":"received","code":"48213", ...}}
エラーコード: bad_key, bad_service, insufficient, no_numbers, not_cancelable, cancel_later
Webhooks
ポーリングの代わりに URL を登録すると、コード受信や返金時に JSON イベントを送信します。
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']);
5 秒以内に HTTP 2xx で応答してください。Webhook URL の設定はこちら: アカウント設定
SMS-Activate互換エンドポイント
SMS-Activateプロトコル対応ソフトはそのまま使えます。ベースURLとAPIキーを変更するだけです。
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}}}
サービスコードと国IDはservicesとcountriesメソッドのものと同じです。