はじめに
Bulk SMS API リファレンス
BulkSMSAPIは開発者向けの一括SMS APIです: REST経由で1つのテキストまたは1リクエストあたり最大10,000件の番号を227ヶ国に送信し、署名付きウェブフックで各メッセージを追跡し、プリペイド残高からメッセージごとに支払います。このリファレンスでは、APIのすべてのエンドポイント、フィールド、イベント、エラーを網羅しています。各ページはMarkdown形式でも利用可能で、アドレスに.mdを追加してください。
ベースURLと形式
すべてのリクエストはHTTPS経由でhttps://bulksmsapi.cc/v1に送信されます。ボディはJSON形式(Content-Type: application/json、UTF-8エンコード)で、すべての応答(エラーを含む)もJSONです。時刻はUTCのISO 8601形式です。金額は5桁の小数を持つUSドル文字列("0.00507")で、1セント未満の価格も正確に表現されます。
エンドポイント
| メソッドとパス | 機能 | Key |
|---|---|---|
| POST /v1/messages | 1つの番号に1つのテキストを送信 | Yes |
| POST /v1/batches | 最大10,000件の番号に、1つのテキストまたは番号ごとに個別のテキストを送信 | Yes |
| GET /v1/messages/{id} | ステータスと価格を含む1つのメッセージ | Yes |
| GET /v1/messages | メッセージ(新しい順)、バッチまたはステータスでフィルタリング | Yes |
| GET /v1/batches/{id} | ステータスごとの件数を含む1つのバッチ | Yes |
| GET /v1/batches | バッチ(新しい順) | Yes |
| POST /v1/batches/{id}/cancel | 予約済みバッチのキャンセル(全額返金) | Yes |
| POST /v1/estimates | 送信せずにリクエストの料金を計算 | Yes |
| GET /v1/balance | USD残高 | Yes |
| GET /v1/pricing | 各国のセグメント単価 | No |
| GET /v1/pricing/{country} | 1か国分の料金(ISOコード指定) | No |
最初のリクエスト
コンソールでAPIキーを作成・エクスポートし、メッセージを送信します。202応答とメッセージオブジェクトが返されます:コストは残高から差し引かれ、メッセージはキューに入ります。
curl https://bulksmsapi.cc/v1/messages \
-H "Authorization: Bearer $BULKSMSAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "+14155550123",
"text": "Your Northwind code is 482913. It expires in 10 minutes.",
"reference": "login-7781"
}'// Node.js 18 or newer (built-in fetch)
const res = await fetch("https://bulksmsapi.cc/v1/messages", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.BULKSMSAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
to: "+14155550123",
text: "Your Northwind code is 482913. It expires in 10 minutes.",
reference: "login-7781",
}),
});
const message = await res.json();
console.log(res.status, message.id, message.status, message.price);# Python 3, standard library only
import json, os, urllib.request
req = urllib.request.Request(
"https://bulksmsapi.cc/v1/messages",
data=json.dumps({
"to": "+14155550123",
"text": "Your Northwind code is 482913. It expires in 10 minutes.",
"reference": "login-7781",
}).encode(),
headers={
"Authorization": "Bearer " + os.environ["BULKSMSAPI_KEY"],
"Content-Type": "application/json",
"User-Agent": "northwind-app/1.0",
},
method="POST",
)
with urllib.request.urlopen(req) as res:
message = json.load(res)
print(res.status, message["id"], message["status"], message["price"])<?php
// PHP 7.4 or newer with the curl extension
$ch = curl_init("https://bulksmsapi.cc/v1/messages");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("BULKSMSAPI_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"to" => "+14155550123",
"text" => "Your Northwind code is 482913. It expires in 10 minutes.",
"reference" => "login-7781",
]),
]);
$message = json_decode(curl_exec($ch), true);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), " ", $message["id"], " ", $message["status"], "\n";// Go 1.20 or newer, standard library only
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
body, _ := json.Marshal(map[string]any{
"to": "+14155550123",
"text": "Your Northwind code is 482913. It expires in 10 minutes.",
"reference": "login-7781",
})
req, _ := http.NewRequest("POST", "https://bulksmsapi.cc/v1/messages", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("BULKSMSAPI_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
var message map[string]any
json.NewDecoder(res.Body).Decode(&message)
fmt.Println(res.StatusCode, message["id"], message["status"], message["price"])
}{
"id": "msg_8F3K2Q9TZ1MX",
"object": "message",
"batch_id": "bat_4M7Q1X0PK2RS",
"to": "+14155550123",
"country": "US",
"text": "Your Northwind code is 482913. It expires in 10 minutes.",
"segments": 1,
"price": "0.00507",
"currency": "USD",
"status": "queued",
"error": null,
"reference": "login-7781",
"created_at": "2026-11-07T09:30:12.418Z",
"sent_at": null,
"done_at": null
}メッセージの流れ
受理されたメッセージはqueued(またはsend_at指定時はscheduled)状態になります。キューは2秒ごとにネットワークへ渡し(アカウント毎分1,200件上限)、sent状態に。最終状態はdeliveredかfailedで、失敗時は即時返金されます。各最終状態で署名付きイベントがwebhookへ通知されます。
制限の概要
| 制限 | 値 |
|---|---|
| APIリクエストあたりの送信先数 | 10,000 |
| コンソールキャンペーンあたりの送信先数 | 50,000 |
| キーあたり毎分リクエスト数 | 600 |
| アカウントあたり毎分ネットワーク送信件数 | 1,200 |
| 最大文字数 | 10セグメント(GSM-7で1,530文字、UCS-2で670文字) |
| 予約可能期間 | 2分から45日前 |
| イベントあたりのwebhook試行回数 | 10 |
| Idempotency-Keyの保持期間 | 24時間 |
| アカウントあたりのAPIキー数 | 10 |
機械可読ファイル
- OpenAPI 3.1仕様(コード生成器とAPIクライアント向け)
- llms-full.txt: このリファレンス全体を1つのプレーンテキストファイルで
- 全ドキュメントページをMarkdown形式で(例: /en/docs/webhooks.md)