收信路由

使用收信路由可将“回复邮件”的消息推送至指定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为邮箱时,此参数必填

提示:

  1. 同一个用户最多能添加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
}