#域名

用户需要在 SendCloud 中配置发信域名才能正常的发送邮件.

你可以使用 API 进行域名的查询, 添加, 修改操作


# 查询 ( 批量查询 )

通过此接口查询域名的基本信息

URL

https://api2.sendcloud.net/api/domain/list
1

HTTP请求方式

post    get
1

参数说明

参数 类型 必须 说明
apiUser string API_USER
apiKey string API_KEY
name string 域名名称. 多个 name 用 ; 分隔
type int 域名类型: 0 (测试域名), 1(普通域名)
verify string 域名验证值. 举例: verify=1, 查询验证值为 1 的域名; verify为 >22, 查询验证值大于等于 22 的域名; verify为 <12, 查询验证值小于等于 12 的域名

说明

域名的验证值 代表 SendCloud 检查用户域名配置是否通过的返回值. SendCloud 会要求用户按照 发送设置 -> 域名 的指引来配置域名记录. 下表是由返回值计算配置项是否通过的方法:

类型 计算 说明
dkim verify & 1 == 1 dkim 配置通过
spf verify & 2 == 2 spf 配置通过
mx verify & 4 == 4 mx 配置通过
dmarc verify & 16 ==16 dmarc 配置通过

举例:

verify = 0  | 没有配置项通过
verify = 3  | dkim, spf 配置通过
verify = 7 | dkim, spf, mx 配置通过
verify = 22 | spf, dmarc, mx 配置通过
verify = 23 | dkim, spf, mx, dmarc 配置通过
1
2
3
4
5

请求示例

https://api2.sendcloud.net/api/domain/list?apiUser=***&apiKey=***&name=ifaxin.com
1

返回值说明

参数 说明
name 域名名称
type 域名类型
verify 域名验证值
spf.domain 此域名 SPF 的主机记录
spf.value 此域名 SPF 的配置值
dkim.domain 此域名 DKIM 的主机记录
dkim.value 此域名 DKIM 的配置值
mx.domain 此域名 MX 的主机记录
mx.value 此域名 MX 的配置值
dmarc.domain 此域名 Dmarc 的主机记录
dmarc.value 此域名 Dmarc 的配置值
gmtCreated 域名创建时间
gmtUpdated 域名修改时间
ipType 0共享 1 独立

返回值示例

{
  "result": true,
  "statusCode": 200,
  "message": "request was successful",
  "info": {
    "dataList": [
      {
        "name": "test456.com",
        "type": "ordinary",
        "verify": 0,
        "spf.domain": "test456.com",
        "spf.value": "v=spf1 include:spf.sendcloud.org -all",
        "dkim.domain": "mail._domainkey.test456.com",
        "dkim.value": "k=rsa;p=***",
        "mx.domain": "test456.com",
        "mx.value": "mx2.sendcloud.org",
		"dmarc.domain": "_dmarc.test456.com",
		"dmarc.value": "v=DMARC1;p=***",
        "gmtCreated": "2014-11-01 22:41:52",
        "gmtUpdated": "2015-09-25 10:56:06",
        "ipType":0
      }
    ],
    "count": 1
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

# 添加

通过此接口添加域名

URL

https://api2.sendcloud.net/api/domain/add
1

HTTP请求方式

post    get
1

参数说明

参数 类型 必须 说明
apiUser string API_USER
apiKey string API_KEY
name string 域名名称

说明

1. 域名名称不能含有 `sendcloud`, `ifaxin`
2. 域名名称长度不能超过 250 个字符
3. 同一个用户最多能添加 5 个域名
1
2
3

请求示例

https://api2.sendcloud.net/api/domain/add?apiUser=***&apiKey=***&name=mail.liubida.cn
1

返回值说明

返回符合条件所有域名信息.

参数 说明
name 域名名称
type 域名类型
verify 域名验证值
spf.domain 此域名 SPF 的主机记录
spf.value 此域名 SPF 的配置值
dkim.domain 此域名 DKIM 的主机记录
dkim.value 此域名 DKIM 的配置值
mx.domain 此域名 MX 的主机记录
mx.value 此域名 MX 的配置值
dmarc.domain 此域名 Dmarc 的主机记录
dmarc.value 此域名 Dmarc 的配置值
gmtCreated 域名创建时间
gmtUpdated 域名修改时间

返回值示例

{
    statusCode: 200,
    info: {
        data: {
	        "name": "test456.com",
	        "type": "ordinary",
	        "verify": 0,
	        "spf.domain": "test456.com",
	        "spf.value": "v=spf1 include:spf.sendcloud.org ~all",
	        "dkim.domain": "k=rsa;p=***",
	        "dkim.value": "k=rsa;p=***",
	        "mx.domain": "test456.com",
	        "mx.value": "mx2.sendcloud.org",
			"dmarc.domain": "_dmarc.test456.com",
			"dmarc.value": "v=DMARC1;p=***",
	        "gmtCreated": "2014-11-01 22:41:52",
	        "gmtUpdated": "2015-09-25 10:56:06"			
        }
    },
    message: "request was successful",
    result: true
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

# 修改

通过此接口修改域名

URL

https://api2.sendcloud.net/api/domain/update
1

HTTP请求方式

post    get
1

参数说明

参数 类型 必须 说明
apiUser string API_USER
apiKey string API_KEY
name string 域名名称
newName string 新域名名称

说明

已有配置项验证通过的域名不能修改
1

请求示例

https://api2.sendcloud.net/api/domain/update?apiUser=***&apiKey=***&name=mail.liubida.cn&name=email.liubida.cn
1

返回值说明

返回符合条件所有域名信息.

参数 说明
name 域名名称
type 域名类型
verify 域名验证值
spf.domain 此域名 SPF 的主机记录
spf.value 此域名 SPF 的配置值
dkim.domain 此域名 DKIM 的主机记录
dkim.value 此域名 DKIM 的配置值
mx.domain 此域名 MX 的主机记录
mx.value 此域名 MX 的配置值
dmarc.domain 此域名 Dmarc 的主机记录
dmarc.value 此域名 Dmarc 的配置值
gmtCreated 域名创建时间
gmtUpdated 域名修改时间

返回值示例

{
    statusCode: 200,
    info: {
        data: {
	        "name": "***",
	        "type": "ordinary",
	        "verify": 30,
	        "spf.domain": "***",
	        "spf.value": "v=spf1 include:spf.sendcloud.org ~all",
	        "dkim.domain": "***",
	        "dkim.value": "k=rsa;p=***",
	        "mx.domain": "***",
	        "mx.value": "***",
			"dmarc.domain": "***",
			"dmarc.value": "***",
	        "gmtCreated": "2014-11-01 22:41:52",
	        "gmtUpdated": "2015-09-25 10:56:06"
        }
    },
    message: "request was successful",
    result: true
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

# 验证

通过此接口验证域名(数据每30min更新一次)

URL

https://api2.sendcloud.net/api/domain/checkConfig
1

HTTP请求方式

post    get
1

参数说明

参数 类型 必须 说明
apiUser string API_USER
apiKey string API_KEY
name string 域名名称. 多个 name 用 ; 分隔

说明

返回已有域名的配置是否通过
1

请求示例

https://api2.sendcloud.net/api/domain/checkConfig?apiUser=***&apiKey=***&name=mail.liubida.cn
1

返回值说明

返回符合条件所有域名信息.

参数 说明
name 域名名称
type 域名类型
MX 是否配置
SPF 是否配置
DKIM 是否配置
DMARC 是否配置
isConfigSuccess 是否配置成功
message 验证结果

返回值示例

{
    "result": true,
    "statusCode": 200,
    "message": "request was successful",
    "info": {
        "dataList": [
            {
                "name": "zhouwj.cn",
                "isConfigSuccess": true,
                "configInfo": {
                    "MX": true,
                    "SPF": true,
                    "DKIM": true,
                    "DMARC": false
                },
                "message": "可使用",
                "type": 0
            }
        ]
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

# 删除

通过此接口删除域名

URL

https://api2.sendcloud.net/api/domain/delete
1

HTTP请求方式

post    get
1

参数说明

参数 类型 必须 说明
apiUser string API_USER
apiKey string API_KEY
name string 域名名称

说明

1. 配置已经通过的域名,不能删除
2. 有关联API_USER的域名,不能删除
3. 测试域名不能删除
1
2
3

请求示例

https://api2.sendcloud.net/api/domain/delete?apiUser=***&apiKey=***&name=mail.liubida.cn
1

返回值说明

参数 说明
count 成功删除域名个数

返回值示例

{
  "statusCode": 200,
  "info": {
    "count": 1
  },
  "message": "request was successful",
  "result": true
}
1
2
3
4
5
6
7
8

#

上次更新: 2025/03/25 10:38:59