每条 $0.0018 起

充值说明联系我们

面向开发者

短信API 通过 REST 发送群发短信和验证码

把你的应用、网店或预约系统接入 WorldText 短信平台。价格和发送规则与网页发送后台一致。

20,000每次请求最多号码数
120每个密钥每分钟请求数
JSON请求和响应

快速开始

第一个请求

  1. 01进入账户的 API 页面生成密钥。密钥以 wt_ 开头。
  2. 02在每个请求中加上请求头 Authorization: Bearer <密钥>。
  3. 03用 POST /api/v1/quote 获取价格,再通过 POST /api/v1/messages 发送。

基础 URL

https://worldtext.world/api/v1

接口

接口列表

方法和路径用途
GET /api/v1/balance当前余额,以美元计
GET /api/v1/countries覆盖国家及每条价格(无需密钥)
POST /api/v1/quote价格、条数和被过滤的号码,不发送
POST /api/v1/messages立即发送,设置 schedule_at 时定时发送
GET /api/v1/messages最近的发送列表(limit, offset)
GET /api/v1/messages/{id}单次发送及其按国家的结果
POST /api/v1/messages/{id}/cancel取消尚未发出的定时发送并全额退款

发送

发送短信

to 字段可传号码数组,或每行一个号码的文本。对于不带 + 的号码,请把 country 字段设为两位字母的国家代码,例如 us 或 cn。

字段说明
to接收人。数组或每行一个号码,最多 20,000 个
text短信内容,不超过 10 条
country可选。不带 + 的号码使用的两位国家代码
schedule_at可选。带时区的 ISO 时间(如 2026-12-01T09:00:00Z)或 Unix 秒数,须在 5 分钟后至 30 天内
client_ref可选。你自己的参考编号,最多 64 个字符
响应 · 201201 Created
{
  "ok": true,
  "campaign": {
    "id": "K7Q2M9XD4TPA",
    "status": "sending",
    "recipients": 2,
    "parts": 1,
    "encoding": "GSM-7",
    "cost": "0.0105",
    "countries": [
      { "country": "US", "recipients": 1, "cost": "0.0041" },
      { "country": "GB", "recipients": 1, "cost": "0.0064" }
    ]
  },
  "rejected": [],
  "duplicates": 0,
  "opted_out": 0,
  "balance": "48.9895"
}
POST /api/v1/messages
curl -X POST https://worldtext.world/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://worldtext.world/api/v1/quote \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "to": ["+14155550142", "+819012345678"], "text": "Hello" }'
响应 · 200200 OK
{
  "ok": true,
  "recipients": 2,
  "parts": 1,
  "encoding": "GSM-7",
  "cost": "0.0131",
  "balance": "49.00",
  "countries": [
    { "country": "JP", "recipients": 1, "price": "0.009", "cost": "0.009" },
    { "country": "US", "recipients": 1, "price": "0.0041", "cost": "0.0041" }
  ],
  "rejected": [],
  "duplicates": 0,
  "opted_out": 0
}

错误

错误响应

代码HTTP原因
unauthorized401没有密钥或密钥无效
rate_limited429本分钟请求过多
bad_request400无法解析请求体
empty_text400没有短信内容
too_long400内容超过 10 条
no_numbers400没有可发送的号码
too_many400一次请求超过 20,000 个号码
bad_time400schedule_at 不在允许的时间范围内
low_balance402余额不足以完成这次发送
unavailable503发送暂时停止,未扣余额
not_found404该发送 ID 不存在
not_scheduled409该发送已发出或已取消

限制

  • 每个密钥每分钟最多 120 次请求。
  • 金额以美元字符串返回,例如 "0.0047"。
  • 发送 ID 是随机的 12 位代码,不是流水号。
  • 号码过滤和退订名单的规则与网页发送后台相同。
获取 API 密钥