Appearance
API 文档
TimelyNotify API 采用 RESTful 风格,所有请求使用 JSON 编码。
基础信息
- Base URL:
https://api.timelynotify.com/v1 - 认证方式:请求头携带
Authorization: Bearer <API_KEY>
发送通知
POST /messages请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| channel | string | 是 | 通知渠道:email / sms / webhook |
| to | string | 是 | 接收人地址 |
| template | string | 是 | 模板 ID 或模板名 |
| params | object | 否 | 模板变量 |
请求示例
bash
curl -X POST https://api.timelynotify.com/v1/messages \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"channel": "email",
"to": "user@example.com",
"template": "welcome",
"params": { "name": "张三" }
}'返回示例
json
{
"code": 0,
"data": {
"messageId": "msg_8f3k2x9q",
"status": "queued"
}
}查询送达状态
GET /messages/{messageId}返回该消息的当前状态(queued / sent / delivered / failed)及各渠道明细。
错误码
| code | 说明 |
|---|---|
| 401 | API Key 无效或已过期 |
| 429 | 触发限流,请稍后重试 |
| 400 | 参数错误,参见返回的 message 字段 |