查询证书列表
/v1/certs按当前身份查询证书列表,并可组合分页、域名、所属用户、证书 ID、名称、备注、类型、DNS API、到期天数、启用状态、同步状态、签发状态和可用性条件。普通用户始终只返回自己的证书,即使传入 uid 也不会扩大数据范围;管理员可查看全部用户并用 uid 精确筛选。结果按证书 ID 倒序排列,limit=0 返回全部匹配记录。列表只返回管理和任务状态摘要,不返回证书 PEM 正文或私钥。
身份认证
access-token
api-key + api-secret
认证定义
{
"AccessToken": {
"type": "apiKey",
"in": "header",
"name": "access-token",
"description": "通过登录接口获得的短期访问令牌。"
},
"ApiKey": {
"type": "apiKey",
"in": "header",
"name": "api-key",
"description": "API Key;必须和 api-secret 同时发送。"
},
"ApiSecret": {
"type": "apiKey",
"in": "header",
"name": "api-secret",
"description": "API Secret;必须和 api-key 同时发送。"
}
}请求参数
| 参数 | 位置 | 类型 | 必填 | 说明与约束 |
|---|---|---|---|---|
page | query | integer (int32) | 可选 | 页码,从 1 开始;仅含十进制数字,省略时为 1。 完整参数定义 |
limit | query | integer (int32) | 可选 | 每页数量,仅含十进制数字;省略时为 10,传 0 时取消分页并返回全部匹配记录。 完整参数定义 |
domain | query | string | 可选 | 域名关键字,对证书的空格分隔域名文本执行包含匹配。 完整参数定义 |
domains | query | string | 可选 | 精确匹配多个证书域名,一行一个域名;每项必须是合法域名或至少三级的通配符域名。服务端去除普通空格后按换行等剩余空白拆分,并匹配证书域名列表中的完整项。 完整参数定义 |
uid | query | integer (int64) | 可选 | 证书所属用户 ID。管理员传入时按该用户精确筛选;普通用户传入时会被忽略,结果仍固定为当前用户的数据。 完整参数定义 |
id | query | integer (int64) | 可选 | 证书 ID,精确匹配。 完整参数定义 |
name | query | string | 可选 | 证书名称关键字,执行包含匹配。 完整参数定义 |
des | query | string | 可选 | 证书备注关键字,执行包含匹配。 完整参数定义 |
type | query | string | 可选 | 证书来源类型,精确匹配: 完整参数定义 |
dnsapi | query | integer (int64) | 可选 | 签发证书所使用的 DNS API 配置 ID,精确匹配。 完整参数定义 |
expire | query | integer (int32) | 可选 | 到期阈值天数,返回到期时间早于“当前时间加该天数”的证书;0 表示已经到期,也接受负整数以查询更早到期的记录。 完整参数定义 |
enable | query | integer | 可选 | 证书启用状态:1 表示启用,0 表示禁用。 完整参数定义 |
sync_state | query | string | 可选 | 证书同步任务状态。 完整参数定义 |
issue_state | query | string | 可选 | 自动证书签发任务状态。 完整参数定义 |
valid | query | string | 可选 | 可用性筛选开关;传任意非空值都会启用。启用后只返回证书已启用,且没有签发任务或签发任务状态为 done 的记录;该条件不检查同步任务状态,建议传 1。 完整参数定义 |
响应
HTTP 200
业务结果通过 HTTP 200 返回。查询成功时返回匹配总数和当前页证书摘要;页码、每页数量或精确域名列表格式错误,以及认证失效时返回字符串业务错误码。
application/json
oneOf
oneOf · 1 · object
| 字段 | 类型 | 必填 | 说明与约束 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
code | integer | 必填 | 成功状态码,列表查询成功时固定为 0。 约束 / 默认值 / 示例 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
count | integer (int64) | 必填 | 应用全部筛选条件后的记录总数,不受当前页和每页数量限制。 约束 / 默认值 / 示例 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data | array <object> | 必填 | 按证书 ID 倒序排列的当前页证书摘要; 展开字段结构按证书 ID 倒序排列的当前页证书摘要; 数组元素 · object 证书列表摘要,不包含证书 PEM 正文、私钥、同步任务 ID 或签发任务 ID。
|
oneOf · 2 · object
| 字段 | 类型 | 必填 | 说明与约束 |
|---|---|---|---|
code | string | 必填 | 业务错误码: 约束 / 默认值 / 示例 |
msg | string | 必填 | 与业务错误码对应的中文分页参数、域名格式或认证失败原因。 |
data | string | 必填 | 业务错误时固定为空字符串。 约束 / 默认值 / 示例 |
完整 Schema
{
"oneOf": [
{
"type": "object",
"required": [
"code",
"count",
"data"
],
"properties": {
"code": {
"type": "integer",
"enum": [
0
],
"description": "成功状态码,列表查询成功时固定为 0。"
},
"count": {
"type": "integer",
"format": "int64",
"minimum": 0,
"description": "应用全部筛选条件后的记录总数,不受当前页和每页数量限制。"
},
"data": {
"type": "array",
"description": "按证书 ID 倒序排列的当前页证书摘要;`limit=0` 时包含全部匹配记录。",
"items": {
"type": "object",
"required": [
"id",
"name",
"des",
"dnsapi",
"auto_renew",
"type",
"domain",
"start_time",
"expire_time2",
"create_at2",
"update_at",
"enable",
"issue_state",
"sync_state",
"uid",
"username",
"task_enable",
"task_ret",
"retry_at2"
],
"properties": {
"id": {
"type": "integer",
"format": "int64",
"description": "证书唯一 ID。"
},
"name": {
"type": "string",
"description": "用于识别该证书记录的显示名称。"
},
"des": {
"type": "string",
"description": "证书备注,可为空字符串。"
},
"dnsapi": {
"type": "integer",
"format": "int64",
"nullable": true,
"description": "自动签发所使用的 DNS API 配置 ID;未指定时为 null。"
},
"auto_renew": {
"type": "integer",
"enum": [
0,
1
],
"description": "是否自动续签:1 表示启用,0 表示关闭;主要用于自动签发证书。"
},
"type": {
"type": "string",
"enum": [
"custom",
"lets",
"zerossl",
"buypass"
],
"description": "证书来源类型,用于区分用户上传和不同自动签发机构。"
},
"domain": {
"type": "string",
"nullable": true,
"description": "证书覆盖的域名,多个域名使用空格分隔;尚未取得域名信息时可能为 null。"
},
"start_time": {
"type": "string",
"nullable": true,
"description": "数据库返回的证书生效时间;未签发或未解析出时间时为 null。非空值由 JSON 序列化器输出为 HTTP 日期字符串。"
},
"expire_time2": {
"type": "string",
"nullable": true,
"pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$",
"description": "证书到期时间,格式为 `YYYY-MM-DD HH:mm:ss`;未签发或未解析出时间时为 null。"
},
"create_at2": {
"type": "string",
"nullable": true,
"pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$",
"description": "证书记录创建时间,格式为 `YYYY-MM-DD HH:mm:ss`;历史记录没有时间时为 null。"
},
"update_at": {
"type": "string",
"nullable": true,
"description": "数据库返回的最后更新时间;历史记录没有时间时为 null。非空值由 JSON 序列化器输出为 HTTP 日期字符串。"
},
"enable": {
"type": "integer",
"enum": [
0,
1
],
"description": "证书启用状态:1 表示启用,0 表示禁用。"
},
"issue_state": {
"type": "string",
"nullable": true,
"enum": [
"pending",
"process",
"failed",
"done",
null
],
"description": "签发任务状态;自定义证书或没有关联签发任务时为 null。"
},
"sync_state": {
"type": "string",
"nullable": true,
"enum": [
"pending",
"process",
"failed",
"done",
null
],
"description": "最近一次证书同步任务状态;没有关联同步任务时为 null。"
},
"uid": {
"type": "integer",
"format": "int64",
"description": "证书所属用户 ID。"
},
"username": {
"type": "string",
"nullable": true,
"description": "证书所属用户名;关联用户名称不可用时为 null。"
},
"task_enable": {
"type": "integer",
"nullable": true,
"enum": [
0,
1,
null
],
"description": "签发任务是否仍启用:1 表示启用,0 表示已停用;没有签发任务时为 null。"
},
"task_ret": {
"type": "string",
"nullable": true,
"description": "签发任务返回信息或失败原因;任务没有返回内容时为 null。"
},
"retry_at2": {
"type": "string",
"nullable": true,
"pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$",
"description": "签发任务下次重试时间,格式为 `YYYY-MM-DD HH:mm:ss`;没有计划重试时为 null。"
}
},
"additionalProperties": false,
"description": "证书列表摘要,不包含证书 PEM 正文、私钥、同步任务 ID 或签发任务 ID。"
}
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"code",
"msg",
"data"
],
"properties": {
"code": {
"type": "string",
"enum": [
"cert-34",
"cert-35",
"cert-44",
"login_required"
],
"description": "业务错误码:`cert-34` 表示 page 不是数字,`cert-35` 表示 limit 不是数字,`cert-44` 表示 `domains` 中存在无效域名,`login_required` 表示认证无效。"
},
"msg": {
"type": "string",
"description": "与业务错误码对应的中文分页参数、域名格式或认证失败原因。"
},
"data": {
"type": "string",
"enum": [
""
],
"description": "业务错误时固定为空字符串。"
}
},
"additionalProperties": false
}
]
}示例
{
"code": 0,
"count": 1,
"data": [
{
"id": 10021,
"name": "API 自动证书",
"des": "生产站点证书",
"dnsapi": 12,
"auto_renew": 1,
"type": "lets",
"domain": "api.example.invalid *.static.example.invalid",
"start_time": "Mon, 01 Jun 2026 00:00:00 GMT",
"expire_time2": "2026-08-30 00:00:00",
"create_at2": "2026-06-01 00:00:00",
"update_at": "Mon, 01 Jun 2026 00:05:00 GMT",
"enable": 1,
"issue_state": "done",
"sync_state": "done",
"uid": 2,
"username": "example-user",
"task_enable": 1,
"task_ret": "",
"retry_at2": null
}
]
}cURL 示例
根据文档生成;请替换主控地址、路径参数和凭证,并按上表补充查询参数。
curl --request GET \
"https://master.example.invalid/v1/certs" \
--header "access-token: YOUR_ACCESS_TOKEN"