Route Management
使用收信路由可将“回复邮件”的消息推送至指定URL/邮箱
你可以使用 API 对收信路由进行查询, 添加, 删除
同一个用户最多能添加1000个收信路由
查询 ( 批量 )
返回收信路由的列表信息
URL
https://api.sendcloud.net/apiv2/route/list
HTTP请求方式
post get
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
apiUser | string | 是 | API_USER |
apiKey | string | 是 | API_KEY |
domain | string | 否 | 域名 |
start | int | 否 | 查询起始位置, 取值区间 [0-], 默认为 0 |
limit | int | 否 | 查询个数, 取值区间 [0-100], 默认为 100 |
请求示例
https://api.sendcloud.net/apiv2/route/list?apiUser=***&apiKey=***&domain=post.sc.com&start=0&limit=10
返回值说明
参数 | 说明 |
---|---|
id | 路由ID |
domain | 域名 |
expression | 收信路由 |
action | URL/邮箱 |
apiUserRoute | action为邮箱时不为空 |
返回值示例
{
"info": {
"dataList": [
{
"id": 1,
"domain": "post.sc.com",
"expression": "*@post.sc.com",
"action": "http://requestb.in/13kup3a1"
},
{
"id": 2,
"domain": "notice.sc.com",
"expression": "*@notice.sc.com",
"action": "admin@notice.sc.com",
"apiUserRoute": "sctest"
}
],
"total": 2,
"count": 2
},
"statusCode": 200,
"message": "请求成功",
"result": true
}
查询
URL
https://api.sendcloud.net/apiv2/route/get
HTTP请求方式
post get
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
apiUser | string | 是 | API_USER |
apiKey | string | 是 | API_KEY |
routeId | int | 是 | 路由ID |
请求示例
https://api.sendcloud.net/apiv2/route/get?apiUser=***&apiKey=***&routeId=1
返回值说明
参数 | 说明 |
---|---|
id | 路由ID |
domain | 域名 |
expression | 收信路由 |
action | URL/邮箱 |
apiUserRoute | action为邮箱时不为空 |
{
"info": {
"data": {
"id": 1,
"domain": "post.sc.com",
"expression": "*@post.sc.com",
"action": "admin@post.sc.com",
"apiUserRoute": "sctest"
}
},
"statusCode": 200,
"message": "请求成功",
"result": true
}
添加
URL
https://api.sendcloud.net/apiv2/route/add
HTTP请求方式
post get
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
apiUser | string | 是 | API_USER |
apiKey | string | 是 | API_KEY |
expression | string | 是 | 收信路由。格式为“正则表达式@域名”;也可以为具体的邮箱。域名/邮箱域名需是已验证或可使用的发信域名 |
action | string | 是 | URL/邮箱 |
apiUserRoute | string | * | action为邮箱时,此参数必填 |
提示:
- 同一个用户最多能添加1000个收信路由
请求示例
https://api.sendcloud.net/apiv2/route/add?apiUser=***&apiKey=***&expression=*@post.sc.com&action=admin@post.sc.com&apiUserRoute=sctest
返回值说明
参数 | 说明 |
---|---|
id | 路由ID |
domain | 域名 |
expression | 收信路由 |
action | URL/邮箱 |
apiUserRoute | 转信到邮箱时,将使用此API_USER进行转信发送 |
返回值示例
{
"info": {
"data": {
"id": 1,
"domain": "post.sc.com",
"expression": "*@post.sc.com",
"action": "admin@post.sc.com",
"apiUserRoute": "sctest"
}
},
"statusCode": 200,
"message": "请求成功",
"result": true
}
修改
URL
https://api.sendcloud.net/apiv2/route/update
HTTP请求方式
post get
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
apiUser | string | 是 | API_USER |
apiKey | string | 是 | API_KEY |
routeId | int | 是 | 路由ID |
expression | string | 是 | 收信路由 |
action | string | 是 | URL/邮箱 |
apiUserRoute | string | * | action为邮箱时,此参数必填 |
请求示例
https://api.sendcloud.net/apiv2/route/update?apiUser=***&apiKey=***&routeId=1&expression=*@post.sc.com&action=http://requestb.in/13kup3a1
返回值说明
参数 | 说明 |
---|---|
count | 更新个数 |
返回值示例
{
"statusCode": 200,
"info": {
"count": 1
},
"message": "请求成功",
"result": true
}
删除
URL
https://api.sendcloud.net/apiv2/route/delete
HTTP请求方式
post get
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
apiUser | string | 是 | API_USER |
apiKey | string | 是 | API_KEY |
routeId | int | 是 | 路由ID |
请求示例
https://api.sendcloud.net/apiv2/label/delete?apiUser=***&apiKey=***&routeId=1
返回值说明
参数 | 说明 |
---|---|
count | 成功删除的个数 |
返回值示例
{
"statusCode": 200,
"info": {
"count": 1
},
"message": "请求成功",
"result": true
}
收信数据统计
按天统计的收信数据
URL
https://api.sendcloud.net/apiv2/routestat/list
HTTP请求方式
post get
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
apiUser | string | 是 | API_USER |
apiKey | string | 是 | API_KEY |
routeId | int | 否 | 转信路由ID |
domainList | string | 否 | 获取指定域名的统计数据, 多个 domain 用; 分开 |
startDate | date | 是 | 起始日期 |
endDate | date | 是 | 截止日期 |
请求示例
https://api.sendcloud.net/apiv2/label/update?apiUser=***&apiKey=***&routeId=1&domainList=***&startDate=2023-01-01&startDate=2023-02-01
返回值说明
参数 | 说明 |
---|---|
id | 路由ID |
domain | 域名 |
expression | 收信路由 |
action | URL/邮箱 |
apiUserRoute | action为邮箱时不为空 |
date | 收信日期 |
total | 收信合计 |
返回值示例
{
"info": {
"dataList": [
{
"id": 1,
"domain": "post.sc.com",
"expression": "*@post.sc.com",
"action": "http://requestb.in/13kup3a1",
"date": "2023-01-01",
"total": 20
},
{
"id": 2,
"domain": "notice.sc.com",
"expression": "*@notice.sc.com",
"action": "admin@notice.sc.com",
"apiUserRoute": "sctest",
"date": "2023-01-02",
"total": 18
}
],
"total": 2,
"count": 2
},
"statusCode": 200,
"message": "请求成功",
"result": true
}