itecdn 5.x用户文档
itecdn 5.x / 用户 API

查询证书列表

GET/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 同时发送。"
  }
}

请求参数

参数位置类型必填说明与约束
pagequeryinteger (int32)可选

页码,从 1 开始;仅含十进制数字,省略时为 1。limit=0 时仍会校验该值,但不参与截取结果。

完整参数定义
{
  "name": "page",
  "in": "query",
  "required": false,
  "description": "页码,从 1 开始;仅含十进制数字,省略时为 1。`limit=0` 时仍会校验该值,但不参与截取结果。",
  "schema": {
    "type": "integer",
    "format": "int32",
    "minimum": 1,
    "default": 1
  },
  "example": 1
}
limitqueryinteger (int32)可选

每页数量,仅含十进制数字;省略时为 10,传 0 时取消分页并返回全部匹配记录。

完整参数定义
{
  "name": "limit",
  "in": "query",
  "required": false,
  "description": "每页数量,仅含十进制数字;省略时为 10,传 0 时取消分页并返回全部匹配记录。",
  "schema": {
    "type": "integer",
    "format": "int32",
    "minimum": 0,
    "default": 10
  },
  "example": 10
}
domainquerystring可选

域名关键字,对证书的空格分隔域名文本执行包含匹配。

完整参数定义
{
  "name": "domain",
  "in": "query",
  "required": false,
  "description": "域名关键字,对证书的空格分隔域名文本执行包含匹配。",
  "schema": {
    "type": "string",
    "minLength": 1
  },
  "example": "api.example.invalid"
}
domainsquerystring可选

精确匹配多个证书域名,一行一个域名;每项必须是合法域名或至少三级的通配符域名。服务端去除普通空格后按换行等剩余空白拆分,并匹配证书域名列表中的完整项。

完整参数定义
{
  "name": "domains",
  "in": "query",
  "required": false,
  "description": "精确匹配多个证书域名,一行一个域名;每项必须是合法域名或至少三级的通配符域名。服务端去除普通空格后按换行等剩余空白拆分,并匹配证书域名列表中的完整项。",
  "schema": {
    "type": "string",
    "minLength": 1
  },
  "example": "api.example.invalid\n*.static.example.invalid"
}
uidqueryinteger (int64)可选

证书所属用户 ID。管理员传入时按该用户精确筛选;普通用户传入时会被忽略,结果仍固定为当前用户的数据。

完整参数定义
{
  "name": "uid",
  "in": "query",
  "required": false,
  "description": "证书所属用户 ID。管理员传入时按该用户精确筛选;普通用户传入时会被忽略,结果仍固定为当前用户的数据。",
  "schema": {
    "type": "integer",
    "format": "int64",
    "minimum": 1
  },
  "example": 2
}
idqueryinteger (int64)可选

证书 ID,精确匹配。

完整参数定义
{
  "name": "id",
  "in": "query",
  "required": false,
  "description": "证书 ID,精确匹配。",
  "schema": {
    "type": "integer",
    "format": "int64",
    "minimum": 1
  },
  "example": 10021
}
namequerystring可选

证书名称关键字,执行包含匹配。

完整参数定义
{
  "name": "name",
  "in": "query",
  "required": false,
  "description": "证书名称关键字,执行包含匹配。",
  "schema": {
    "type": "string",
    "minLength": 1
  },
  "example": "API 证书"
}
desquerystring可选

证书备注关键字,执行包含匹配。

完整参数定义
{
  "name": "des",
  "in": "query",
  "required": false,
  "description": "证书备注关键字,执行包含匹配。",
  "schema": {
    "type": "string",
    "minLength": 1
  },
  "example": "生产站点"
}
typequerystring可选

证书来源类型,精确匹配:custom 为用户上传,lets 为 Let's Encrypt,zerossl 为 ZeroSSL,buypass 为 BuyPass。

完整参数定义
{
  "name": "type",
  "in": "query",
  "required": false,
  "description": "证书来源类型,精确匹配:`custom` 为用户上传,`lets` 为 Let's Encrypt,`zerossl` 为 ZeroSSL,`buypass` 为 BuyPass。",
  "schema": {
    "type": "string",
    "enum": [
      "custom",
      "lets",
      "zerossl",
      "buypass"
    ]
  },
  "example": "lets"
}
dnsapiqueryinteger (int64)可选

签发证书所使用的 DNS API 配置 ID,精确匹配。

完整参数定义
{
  "name": "dnsapi",
  "in": "query",
  "required": false,
  "description": "签发证书所使用的 DNS API 配置 ID,精确匹配。",
  "schema": {
    "type": "integer",
    "format": "int64",
    "minimum": 1
  },
  "example": 12
}
expirequeryinteger (int32)可选

到期阈值天数,返回到期时间早于“当前时间加该天数”的证书;0 表示已经到期,也接受负整数以查询更早到期的记录。

完整参数定义
{
  "name": "expire",
  "in": "query",
  "required": false,
  "description": "到期阈值天数,返回到期时间早于“当前时间加该天数”的证书;0 表示已经到期,也接受负整数以查询更早到期的记录。",
  "schema": {
    "type": "integer",
    "format": "int32"
  },
  "example": 30
}
enablequeryinteger可选

证书启用状态:1 表示启用,0 表示禁用。

完整参数定义
{
  "name": "enable",
  "in": "query",
  "required": false,
  "description": "证书启用状态:1 表示启用,0 表示禁用。",
  "schema": {
    "type": "integer",
    "enum": [
      0,
      1
    ]
  },
  "example": 1
}
sync_statequerystring可选

证书同步任务状态。done 同时匹配同步任务已完成和没有同步任务的证书;其他值仅匹配对应任务状态。

完整参数定义
{
  "name": "sync_state",
  "in": "query",
  "required": false,
  "description": "证书同步任务状态。`done` 同时匹配同步任务已完成和没有同步任务的证书;其他值仅匹配对应任务状态。",
  "schema": {
    "type": "string",
    "enum": [
      "pending",
      "process",
      "failed",
      "done"
    ]
  },
  "example": "done"
}
issue_statequerystring可选

自动证书签发任务状态。failed 同时匹配已停用的签发任务和状态为 failed 的任务;其他值要求任务仍启用且状态精确匹配。

完整参数定义
{
  "name": "issue_state",
  "in": "query",
  "required": false,
  "description": "自动证书签发任务状态。`failed` 同时匹配已停用的签发任务和状态为 failed 的任务;其他值要求任务仍启用且状态精确匹配。",
  "schema": {
    "type": "string",
    "enum": [
      "pending",
      "process",
      "failed",
      "done"
    ]
  },
  "example": "pending"
}
validquerystring可选

可用性筛选开关;传任意非空值都会启用。启用后只返回证书已启用,且没有签发任务或签发任务状态为 done 的记录;该条件不检查同步任务状态,建议传 1。

完整参数定义
{
  "name": "valid",
  "in": "query",
  "required": false,
  "description": "可用性筛选开关;传任意非空值都会启用。启用后只返回证书已启用,且没有签发任务或签发任务状态为 done 的记录;该条件不检查同步任务状态,建议传 1。",
  "schema": {
    "type": "string",
    "minLength": 1
  },
  "example": "1"
}

响应

HTTP 200

业务结果通过 HTTP 200 返回。查询成功时返回匹配总数和当前页证书摘要;页码、每页数量或精确域名列表格式错误,以及认证失效时返回字符串业务错误码。

application/json

oneOf

oneOf · 1 · object
字段类型必填说明与约束
codeinteger必填

成功状态码,列表查询成功时固定为 0。

约束 / 默认值 / 示例
{
  "enum": [
    0
  ]
}
countinteger (int64)必填

应用全部筛选条件后的记录总数,不受当前页和每页数量限制。

约束 / 默认值 / 示例
{
  "format": "int64",
  "minimum": 0
}
dataarray <object>必填

按证书 ID 倒序排列的当前页证书摘要;limit=0 时包含全部匹配记录。

展开字段结构

按证书 ID 倒序排列的当前页证书摘要;limit=0 时包含全部匹配记录。

数组元素 · object

证书列表摘要,不包含证书 PEM 正文、私钥、同步任务 ID 或签发任务 ID。

字段类型必填说明与约束
idinteger (int64)必填

证书唯一 ID。

约束 / 默认值 / 示例
{
  "format": "int64"
}
namestring必填

用于识别该证书记录的显示名称。

desstring必填

证书备注,可为空字符串。

dnsapiinteger (int64)必填

自动签发所使用的 DNS API 配置 ID;未指定时为 null。

约束 / 默认值 / 示例
{
  "format": "int64",
  "nullable": true
}
auto_renewinteger必填

是否自动续签:1 表示启用,0 表示关闭;主要用于自动签发证书。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ]
}
typestring必填

证书来源类型,用于区分用户上传和不同自动签发机构。

约束 / 默认值 / 示例
{
  "enum": [
    "custom",
    "lets",
    "zerossl",
    "buypass"
  ]
}
domainstring必填

证书覆盖的域名,多个域名使用空格分隔;尚未取得域名信息时可能为 null。

约束 / 默认值 / 示例
{
  "nullable": true
}
start_timestring必填

数据库返回的证书生效时间;未签发或未解析出时间时为 null。非空值由 JSON 序列化器输出为 HTTP 日期字符串。

约束 / 默认值 / 示例
{
  "nullable": true
}
expire_time2string必填

证书到期时间,格式为 YYYY-MM-DD HH:mm:ss;未签发或未解析出时间时为 null。

约束 / 默认值 / 示例
{
  "nullable": true,
  "pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$"
}
create_at2string必填

证书记录创建时间,格式为 YYYY-MM-DD HH:mm:ss;历史记录没有时间时为 null。

约束 / 默认值 / 示例
{
  "nullable": true,
  "pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$"
}
update_atstring必填

数据库返回的最后更新时间;历史记录没有时间时为 null。非空值由 JSON 序列化器输出为 HTTP 日期字符串。

约束 / 默认值 / 示例
{
  "nullable": true
}
enableinteger必填

证书启用状态:1 表示启用,0 表示禁用。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ]
}
issue_statestring必填

签发任务状态;自定义证书或没有关联签发任务时为 null。

约束 / 默认值 / 示例
{
  "nullable": true,
  "enum": [
    "pending",
    "process",
    "failed",
    "done",
    null
  ]
}
sync_statestring必填

最近一次证书同步任务状态;没有关联同步任务时为 null。

约束 / 默认值 / 示例
{
  "nullable": true,
  "enum": [
    "pending",
    "process",
    "failed",
    "done",
    null
  ]
}
uidinteger (int64)必填

证书所属用户 ID。

约束 / 默认值 / 示例
{
  "format": "int64"
}
usernamestring必填

证书所属用户名;关联用户名称不可用时为 null。

约束 / 默认值 / 示例
{
  "nullable": true
}
task_enableinteger必填

签发任务是否仍启用:1 表示启用,0 表示已停用;没有签发任务时为 null。

约束 / 默认值 / 示例
{
  "nullable": true,
  "enum": [
    0,
    1,
    null
  ]
}
task_retstring必填

签发任务返回信息或失败原因;任务没有返回内容时为 null。

约束 / 默认值 / 示例
{
  "nullable": true
}
retry_at2string必填

签发任务下次重试时间,格式为 YYYY-MM-DD HH:mm:ss;没有计划重试时为 null。

约束 / 默认值 / 示例
{
  "nullable": true,
  "pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$"
}
oneOf · 2 · object
字段类型必填说明与约束
codestring必填

业务错误码:cert-34 表示 page 不是数字,cert-35 表示 limit 不是数字,cert-44 表示 domains 中存在无效域名,login_required 表示认证无效。

约束 / 默认值 / 示例
{
  "enum": [
    "cert-34",
    "cert-35",
    "cert-44",
    "login_required"
  ]
}
msgstring必填

与业务错误码对应的中文分页参数、域名格式或认证失败原因。

datastring必填

业务错误时固定为空字符串。

约束 / 默认值 / 示例
{
  "enum": [
    ""
  ]
}
完整 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"

查看完整接口 JSON