> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ycloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 发送 SMS

> 发送全球 SMS 消息并跟踪送达更新。

使用 `POST /sms` 发送 SMS。

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl --request POST https://api.ycloud.com/v2/sms \
  --header "X-API-Key: $YCLOUD_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "to": "+16315551111",
    "text": "Your verification code is 123456.",
    "externalId": "login-10001"
  }'
```

## 必填字段

| 字段 | 描述 |
| - | - |
| `to` | E.164 格式的接收者号码。 |
| `text` | 消息正文。 |

您还可以提供：

* `senderId` 用于已批准的发送者 ID。
* `signature` 用于发送至中国大陆的消息。YCloud 会将其包裹在 `【】` 中并添加到消息的开头。
* `externalId` 用于将消息与您系统中的记录关联。
* `callbackUrl` 用于每条消息的送达报告 URL。对于新的集成，YCloud 建议使用 Webhook 端点。

## 追踪消息

响应包含 YCloud 消息 `id`。订阅 `sms.message.updated` 以接收送达状态更新。如果您的账户接收 SMS 回复，请订阅 `sms.inbound.received`。

您还可以使用 `GET /sms` 列出 SMS 记录。当您需要核对记录时，可以按创建时间或消息 ID 进行过滤。

<Note>
  发送者 ID 的可用性和内容要求因目的地而异。请确保您的发送者和消息内容符合接收国的规则。
</Note>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.