SMS
SMS sending, OTP and verification, and delivery status.
Overview
https://api.infrai.cc/v1/smsAuthorization: Bearer $INFRAI_API_KEY# Call any /v1/sms capability over raw HTTP — no SDK to install.
# curl:
curl https://api.infrai.cc/v1/sms/... \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json"Methods
sms.send
Send an SMS message; supports templates and BYOK vendors.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
to | string | Required | Recipient phone number in E.164. |
body | string | Optional | Message text. |
from | string | Optional | Sender id or number. |
template_id | string | Optional | Template id to render instead of a body. |
vendor | string | Optional | Pin a specific vendor instead of auto-routing. |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
SmsRecord { sms_id, to, state, vendor, segments, created_at }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/sms/send \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to": "+14155550100", "body": "Your code is 123456"}'sms.otp
Send a one-time passcode to a phone number.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
to | string | Required | Recipient phone number in E.164. |
Returns
{ request_id, expires_at }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/sms/otp \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to": "..."}'sms.verify
Verify a one-time passcode.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
to | string | Required | Recipient phone number in E.164. |
code | string | Required | The one-time passcode to verify. |
Returns
{ valid: boolean }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/sms/verify \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to": "...", "code": "..."}'sms.status
Fetch the delivery status of an SMS.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | The SMS record id. |
Returns
SmsRecordExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/sms/status/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"sms.batch.send
异构批量发送:每条为完整短信请求,整批共用一个幂等键,按条计费不重复。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
messages | SmsSendRequest[] | Required | 短信请求数组,最多 100 条,每条为完整的发送请求。 |
idempotency_key | string | Optional | 整批共用的去重键;相同重试返回相同结果。 |
Returns
SmsBatchSendResult { results: SmsSendResult[] }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/sms/batch/send \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"messages": []}'sms.cancel
取消尚未下发的已排程或排队中短信。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | 要取消的短信消息 ID。 |
Returns
SmsCancelResult { message_id, cancelled, state }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/sms/cancel/ID \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"message_id": "..."}'sms.events
读取单条短信的投递事件时间线。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | 短信消息 ID。 |
cursor | string | Optional | 分页游标,从上一页的 next_cursor 取得。 |
limit | number | Optional | 单页返回的最大条数。 |
Returns
SmsEventList { items: SmsEvent[], next_cursor }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/sms/events/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"sms.inbound.list
分页列出在已注册发送号上收到的入站(回复)短信。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
cursor | string | Optional | 分页游标,从上一页的 next_cursor 取得。 |
limit | number | Optional | 单页返回的最大条数。 |
Returns
SmsListResult { items, next_cursor }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/sms/inbound/list \
-H "Authorization: Bearer $INFRAI_API_KEY"sms.list
分页列出已发送的短信记录。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
cursor | string | Optional | 分页游标,从上一页的 next_cursor 取得。 |
limit | number | Optional | 单页返回的最大条数。 |
Returns
SmsListResult { items, next_cursor }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/sms/list \
-H "Authorization: Bearer $INFRAI_API_KEY"sms.lookup
校验号码并补充运营商、号码类型等信息。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
phone | string | Required | 要查询的电话号码(E.164 格式)。 |
fields | string[] | Optional | 需返回的补充字段列表,如 carrier、line_type。 |
Returns
SmsLookupResult { phone, valid, country_code, carrier, line_type, caller_name }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/sms/lookup \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"phone": "..."}'sms.resend
重新下发短信,可选仅重试失败的收件人。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
message_id | string | Required | 要重发的原短信消息 ID。 |
only_failed | boolean | Optional | 为 true 时仅重试投递失败的收件人。 |
idempotency_key | string | Optional | 去重键;相同重试返回相同结果。 |
Returns
SmsBatchSendResult { results }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/sms/resend/ID \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"message_id": "..."}'sms.sender.register
注册发送号码以供验证。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
phone_number | string | Required | 要注册的发送号码(E.164 格式)。 |
region | string | Required | 发送号码所属区域,如 western、china。 |
methods | string[] | Optional | 可用的验证方式列表。 |
idempotency_key | string | Optional | 去重键;相同重试返回相同结果。 |
Returns
SenderVerification { sender_id, phone_number, region, state, methods, created_at }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/sms/sender/register \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"phone_number": "...", "region": "..."}'sms.sender.verify
用验证码确认已注册的发送号码。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
sender_id | string | Required | 待验证的发送号 ID。 |
code | string | Optional | 收到的验证码。 |
idempotency_key | string | Optional | 去重键;相同重试返回相同结果。 |
Returns
SenderVerification { sender_id, phone_number, region, state, methods, created_at }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/sms/sender/verify \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"sender_id": "..."}'sms.sender.get
获取单个已注册发送号的详情。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | 发送号 ID。 |
Returns
SenderVerificationExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/sms/sender/get/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"sms.sender.list
分页列出已注册的发送号。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
cursor | string | Optional | 分页游标,从上一页的 next_cursor 取得。 |
limit | number | Optional | 单页返回的最大条数。 |
Returns
SmsSenderListResult { items, next_cursor }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/sms/sender/list \
-H "Authorization: Bearer $INFRAI_API_KEY"sms.sender.delete
删除一个已注册的发送号。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | 要删除的发送号 ID。 |
idempotency_key | string | Optional | 去重键;相同重试返回相同结果。 |
Returns
SmsDeleteResult { deleted }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X DELETE https://api.infrai.cc/v1/sms/sender/delete/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"sms.sender.reputation
查询发送号的信誉等级与限流风险。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | 发送号 ID。 |
Returns
SmsSenderReputation { sender_id, tier, complaint_rate_30d, cap, used_today, throttle_risk }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/sms/sender/reputation/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"sms.signature.create
创建短信签名(中国发送必需)并提交审核。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Required | 签名内容文本。 |
type | string | Optional | 签名类型,如 enterprise、individual。 |
proof_url | string | Optional | 资质证明文件的 URL。 |
remark | string | Optional | 提交审核时的备注说明。 |
vendor | string | Optional | Pin a specific vendor instead of auto-routing. |
Returns
SmsSignature { signature_id, text, type, review_state, reject_reason, vendor, created_at }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/sms/signature/create \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Acme", "type": "company"}'sms.signature.get
读取单个短信签名及其审核状态。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | 签名 ID。 |
Returns
SmsSignatureExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/sms/signature/get/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"sms.signature.list
分页列出短信签名。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
cursor | string | Optional | 分页游标,从上一页的 next_cursor 取得。 |
limit | number | Optional | 单页返回的最大条数。 |
Returns
SmsSignatureListResult { items, next_cursor }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/sms/signature/list \
-H "Authorization: Bearer $INFRAI_API_KEY"sms.signature.delete
删除一个短信签名。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | 要删除的签名 ID。 |
idempotency_key | string | Optional | 去重键;相同重试返回相同结果。 |
Returns
SmsDeleteResult { deleted }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X DELETE https://api.infrai.cc/v1/sms/signature/delete/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"sms.template.create
创建带命名变量的可复用短信模板。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Required | 模板名称。 |
body | string | Required | 模板正文,可含 {变量} 占位符。 |
locale | string | Optional | 模板语言区域,如 en、zh。 |
variables | string[] | Optional | 模板中使用的变量名列表。 |
vendor | string | Optional | Pin a specific vendor instead of auto-routing. |
Returns
SmsTemplate { template_id, name, body, locale, variables, review_state, created_at }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/sms/template/create \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "otp", "body": "Your code is {{code}}", "locale": "zh"}'sms.template.get
读取单个短信模板。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | 模板 ID。 |
Returns
SmsTemplateExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/sms/template/get/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"sms.template.list
分页列出短信模板。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
cursor | string | Optional | 分页游标,从上一页的 next_cursor 取得。 |
limit | number | Optional | 单页返回的最大条数。 |
Returns
SmsTemplateListResult { items, next_cursor }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/sms/template/list \
-H "Authorization: Bearer $INFRAI_API_KEY"sms.template.delete
删除一个短信模板。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | 要删除的模板 ID。 |
idempotency_key | string | Optional | 去重键;相同重试返回相同结果。 |
Returns
SmsDeleteResult { deleted }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X DELETE https://api.infrai.cc/v1/sms/template/delete/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"sms.suppress
将号码加入抑制(免打扰)列表。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
phone | string | Required | 要抑制的电话号码(E.164 格式)。 |
reason | string | Optional | 抑制原因,如 opt_out、complaint。 |
scope | string | Optional | 抑制范围,如 account、global。 |
sender_scope | string | Optional | 限定到某发送号的抑制范围。 |
notes | string | Optional | 内部备注说明。 |
idempotency_key | string | Optional | 去重键;相同重试返回相同结果。 |
Returns
SuppressionRecord { phone, scope, reason, created_at }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/sms/suppress \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"phone": "..."}'sms.suppression.check
发送前检查号码是否已被抑制。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
phone | string | Required | 要检查的电话号码(E.164 格式)。 |
scope | string | Optional | 检查的抑制范围,如 account、global。 |
sender_scope | string | Optional | 限定到某发送号的检查范围。 |
Returns
SmsSuppressionCheckResult { suppressed, record }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/sms/suppression/check \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"phone": "..."}'sms.suppression.list
分页列出被抑制的号码。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
cursor | string | Optional | 分页游标,从上一页的 next_cursor 取得。 |
limit | number | Optional | 单页返回的最大条数。 |
Returns
SmsSuppressionListResult { items, total_count, next_cursor }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/sms/suppression/list \
-H "Authorization: Bearer $INFRAI_API_KEY"sms.suppression.delete
从抑制列表移除号码以恢复发送。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
phone | string | Required | 要移除的电话号码(E.164 格式)。 |
scope | string | Optional | 移除的抑制范围,如 account、global。 |
sender_scope | string | Optional | 限定到某发送号的移除范围。 |
idempotency_key | string | Optional | 去重键;相同重试返回相同结果。 |
Returns
SmsSuppressionRemoveResult { phone, removed }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/sms/suppression/delete \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"phone": "..."}'sms.suppression.gdpr_remove
GDPR 删除:凭确认令牌硬删除某号码的抑制数据。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
phone | string | Required | 要执行 GDPR 删除的电话号码(E.164 格式)。 |
confirmation_token | string | Required | 执行硬删除所需的确认令牌。 |
idempotency_key | string | Optional | 去重键;相同重试返回相同结果。 |
Returns
SmsSuppressionRemoveResult { phone, removed }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/sms/suppression/gdpr_remove \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"phone": "...", "confirmation_token": "..."}'sms.usage
按时间窗聚合短信用量与成本统计。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
since | string | Optional | 统计起始时间(ISO 8601)。 |
until | string | Optional | 统计结束时间(ISO 8601)。 |
vendor | string | Optional | Pin a specific vendor instead of auto-routing. |
bucket | string | Optional | 聚合粒度,如 day、hour。 |
Returns
SmsUsageResult { sent, delivered, failed, segments, cost_usd, delivery_rate, buckets }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/sms/usage \
-H "Authorization: Bearer $INFRAI_API_KEY"All capabilities
Every routed capability in this module — the complete public REST contract. The methods above are the guided walkthrough; this index is the full reference.
| Capability | Endpoint | Description |
|---|---|---|
sms.batch.send | POST /v1/sms/batch/send | Send a heterogeneous batch of SMS (each a full request) under one idempotency key, billed per message. |
sms.cancel | POST /v1/sms/cancel/{id} | Cancel a scheduled or queued SMS that has not yet been dispatched. |
sms.events | GET /v1/sms/events/{id} | Retrieve the delivery event timeline for a single SMS message. |
sms.inbound.list | GET /v1/sms/inbound/list | List inbound (reply) SMS received on registered sender numbers, with pagination. |
sms.list | GET /v1/sms/list | List sent SMS message records with pagination. |
sms.lookup | POST /v1/sms/lookup | Validate a phone number and enrich it with carrier and line-type information. |
sms.otp | POST /v1/sms/otp | Send a one-time passcode via SMS with gateway-managed OTP lifecycle. |
sms.resend | POST /v1/sms/resend/{id} | Resend an SMS, optionally retrying only the failed recipients. |
sms.send | POST /v1/sms/send | Send an SMS message to one or more recipients (idempotent). |
sms.sender.delete | DELETE /v1/sms/sender/delete/{id} | Delete a registered sender number. |
sms.sender.get | GET /v1/sms/sender/get/{id} | Retrieve details of a single registered sender number. |
sms.sender.list | GET /v1/sms/sender/list | List registered sender numbers with pagination. |
sms.sender.register | POST /v1/sms/sender/register | Register a sender number for verification. |
sms.sender.reputation | GET /v1/sms/sender/reputation/{id} | Query a sender number's reputation score and throttling risk. |
sms.sender.verify | POST /v1/sms/sender/verify | Verify a registered sender number with a confirmation code. |
sms.signature.create | POST /v1/sms/signature/create | Create an SMS signature (required for China delivery) and submit it for review. |
sms.signature.delete | DELETE /v1/sms/signature/delete/{id} | Delete an SMS signature. |
sms.signature.get | GET /v1/sms/signature/get/{id} | Retrieve a single SMS signature and its review status. |
sms.signature.list | GET /v1/sms/signature/list | List SMS signatures with pagination. |
sms.status | GET /v1/sms/status/{id} | Query the delivery status of an SMS message by ID. |
sms.suppress | POST /v1/sms/suppress | Add a phone number to the suppression (do-not-contact) list. |
sms.suppression.check | POST /v1/sms/suppression/check | Check whether a phone number is suppressed before sending. |
sms.suppression.delete | POST /v1/sms/suppression/delete | Remove a number from the suppression list to resume sending. |
sms.suppression.gdpr_remove | POST /v1/sms/suppression/gdpr_remove | Hard-delete a number's suppression record under GDPR, authorized by a confirmation token. |
sms.suppression.list | GET /v1/sms/suppression/list | List suppressed phone numbers with pagination. |
sms.template.create | POST /v1/sms/template/create | Create a reusable SMS template with named variables. |
sms.template.delete | DELETE /v1/sms/template/delete/{id} | Delete an SMS template. |
sms.template.get | GET /v1/sms/template/get/{id} | Retrieve a single SMS template. |
sms.template.list | GET /v1/sms/template/list | List SMS templates with pagination. |
sms.usage | GET /v1/sms/usage | Aggregate SMS usage and cost statistics over a time window. |
sms.verify | POST /v1/sms/verify | Verify a user-submitted SMS one-time passcode. |
End-to-end example
A production-style walkthrough of this module: configure once, then run the flow. It exercises most of the module's APIs.
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."# 1) Auth: every call is a raw HTTPS request to the Infrai gateway carrying
# only your project key. No SDK, no install.
# Get your key: sign in with Google/GitHub at the console for a project key
# + $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..." # from the console
# 2) sms.send
curl -X POST https://api.infrai.cc/v1/sms/send \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to": "+14155550100", "body": "Your code is 123456"}'
# 3) sms.otp
curl -X POST https://api.infrai.cc/v1/sms/otp \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to": "..."}'
# 4) sms.verify
curl -X POST https://api.infrai.cc/v1/sms/verify \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to": "...", "code": "..."}'
# 5) sms.status
curl -X GET https://api.infrai.cc/v1/sms/status/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 6) sms.batch.send
curl -X POST https://api.infrai.cc/v1/sms/batch/send \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"messages": []}'
# 7) sms.cancel
curl -X POST https://api.infrai.cc/v1/sms/cancel/ID \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"message_id": "..."}'
# 8) sms.events
curl -X GET https://api.infrai.cc/v1/sms/events/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 9) sms.inbound.list
curl -X GET https://api.infrai.cc/v1/sms/inbound/list \
-H "Authorization: Bearer $INFRAI_API_KEY"