{
  "tags": [
    "证书管理"
  ],
  "description": "按当前身份查询证书列表，并可组合分页、域名、所属用户、证书 ID、名称、备注、类型、DNS API、到期天数、启用状态、同步状态、签发状态和可用性条件。普通用户始终只返回自己的证书，即使传入 `uid` 也不会扩大数据范围；管理员可查看全部用户并用 `uid` 精确筛选。结果按证书 ID 倒序排列，`limit=0` 返回全部匹配记录。列表只返回管理和任务状态摘要，不返回证书 PEM 正文或私钥。",
  "operationId": "user_get_v1_certs",
  "security": [
    {
      "AccessToken": []
    },
    {
      "ApiKey": [],
      "ApiSecret": []
    }
  ],
  "responses": {
    "200": {
      "description": "业务结果通过 HTTP 200 返回。查询成功时返回匹配总数和当前页证书摘要；页码、每页数量或精确域名列表格式错误，以及认证失效时返回字符串业务错误码。",
      "content": {
        "application/json": {
          "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
              }
            ]
          },
          "example": {
            "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
              }
            ]
          }
        }
      }
    }
  },
  "x-python-handler": "site.CertAPI",
  "x-python-route-line": 362,
  "x-audience": "user",
  "x-auth": "user",
  "x-reviewed": true,
  "parameters": [
    {
      "name": "page",
      "in": "query",
      "required": false,
      "description": "页码，从 1 开始；仅含十进制数字，省略时为 1。`limit=0` 时仍会校验该值，但不参与截取结果。",
      "schema": {
        "type": "integer",
        "format": "int32",
        "minimum": 1,
        "default": 1
      },
      "example": 1
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "description": "每页数量，仅含十进制数字；省略时为 10，传 0 时取消分页并返回全部匹配记录。",
      "schema": {
        "type": "integer",
        "format": "int32",
        "minimum": 0,
        "default": 10
      },
      "example": 10
    },
    {
      "name": "domain",
      "in": "query",
      "required": false,
      "description": "域名关键字，对证书的空格分隔域名文本执行包含匹配。",
      "schema": {
        "type": "string",
        "minLength": 1
      },
      "example": "api.example.invalid"
    },
    {
      "name": "domains",
      "in": "query",
      "required": false,
      "description": "精确匹配多个证书域名，一行一个域名；每项必须是合法域名或至少三级的通配符域名。服务端去除普通空格后按换行等剩余空白拆分，并匹配证书域名列表中的完整项。",
      "schema": {
        "type": "string",
        "minLength": 1
      },
      "example": "api.example.invalid\n*.static.example.invalid"
    },
    {
      "name": "uid",
      "in": "query",
      "required": false,
      "description": "证书所属用户 ID。管理员传入时按该用户精确筛选；普通用户传入时会被忽略，结果仍固定为当前用户的数据。",
      "schema": {
        "type": "integer",
        "format": "int64",
        "minimum": 1
      },
      "example": 2
    },
    {
      "name": "id",
      "in": "query",
      "required": false,
      "description": "证书 ID，精确匹配。",
      "schema": {
        "type": "integer",
        "format": "int64",
        "minimum": 1
      },
      "example": 10021
    },
    {
      "name": "name",
      "in": "query",
      "required": false,
      "description": "证书名称关键字，执行包含匹配。",
      "schema": {
        "type": "string",
        "minLength": 1
      },
      "example": "API 证书"
    },
    {
      "name": "des",
      "in": "query",
      "required": false,
      "description": "证书备注关键字，执行包含匹配。",
      "schema": {
        "type": "string",
        "minLength": 1
      },
      "example": "生产站点"
    },
    {
      "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"
    },
    {
      "name": "dnsapi",
      "in": "query",
      "required": false,
      "description": "签发证书所使用的 DNS API 配置 ID，精确匹配。",
      "schema": {
        "type": "integer",
        "format": "int64",
        "minimum": 1
      },
      "example": 12
    },
    {
      "name": "expire",
      "in": "query",
      "required": false,
      "description": "到期阈值天数，返回到期时间早于“当前时间加该天数”的证书；0 表示已经到期，也接受负整数以查询更早到期的记录。",
      "schema": {
        "type": "integer",
        "format": "int32"
      },
      "example": 30
    },
    {
      "name": "enable",
      "in": "query",
      "required": false,
      "description": "证书启用状态：1 表示启用，0 表示禁用。",
      "schema": {
        "type": "integer",
        "enum": [
          0,
          1
        ]
      },
      "example": 1
    },
    {
      "name": "sync_state",
      "in": "query",
      "required": false,
      "description": "证书同步任务状态。`done` 同时匹配同步任务已完成和没有同步任务的证书；其他值仅匹配对应任务状态。",
      "schema": {
        "type": "string",
        "enum": [
          "pending",
          "process",
          "failed",
          "done"
        ]
      },
      "example": "done"
    },
    {
      "name": "issue_state",
      "in": "query",
      "required": false,
      "description": "自动证书签发任务状态。`failed` 同时匹配已停用的签发任务和状态为 failed 的任务；其他值要求任务仍启用且状态精确匹配。",
      "schema": {
        "type": "string",
        "enum": [
          "pending",
          "process",
          "failed",
          "done"
        ]
      },
      "example": "pending"
    },
    {
      "name": "valid",
      "in": "query",
      "required": false,
      "description": "可用性筛选开关；传任意非空值都会启用。启用后只返回证书已启用，且没有签发任务或签发任务状态为 done 的记录；该条件不检查同步任务状态，建议传 1。",
      "schema": {
        "type": "string",
        "minLength": 1
      },
      "example": "1"
    }
  ],
  "x-itecdn-source-reviewed": true,
  "extensions": [
    {
      "key": "x-python-handler",
      "value": "site.CertAPI"
    },
    {
      "key": "x-python-route-line",
      "value": 362
    },
    {
      "key": "x-audience",
      "value": "user"
    },
    {
      "key": "x-auth",
      "value": "user"
    },
    {
      "key": "x-reviewed",
      "value": true
    },
    {
      "key": "x-itecdn-source-reviewed",
      "value": true
    }
  ],
  "method": "get",
  "path": "/v1/certs",
  "servers": [
    {
      "url": "https://master.example.invalid",
      "description": "不可调用的示例地址；复制示例后替换为自己的主控域名。"
    }
  ],
  "securitySchemes": {
    "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 同时发送。"
    }
  },
  "info": {
    "title": "itecdn v5 用户 API",
    "version": "5.x",
    "description": "itecdn v5.x Python 主控用户 API。本文档不适用于 v6 或其它实现。"
  },
  "postman": {
    "name": "查询证书列表",
    "description": {
      "content": "按当前身份查询证书列表，并可组合分页、域名、所属用户、证书 ID、名称、备注、类型、DNS API、到期天数、启用状态、同步状态、签发状态和可用性条件。普通用户始终只返回自己的证书，即使传入 `uid` 也不会扩大数据范围；管理员可查看全部用户并用 `uid` 精确筛选。结果按证书 ID 倒序排列，`limit=0` 返回全部匹配记录。列表只返回管理和任务状态摘要，不返回证书 PEM 正文或私钥。",
      "type": "text/plain"
    },
    "url": {
      "path": [
        "v1",
        "certs"
      ],
      "host": [
        "{{baseUrl}}"
      ],
      "query": [
        {
          "disabled": false,
          "description": {
            "content": "页码，从 1 开始；仅含十进制数字，省略时为 1。`limit=0` 时仍会校验该值，但不参与截取结果。",
            "type": "text/plain"
          },
          "key": "page",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "每页数量，仅含十进制数字；省略时为 10，传 0 时取消分页并返回全部匹配记录。",
            "type": "text/plain"
          },
          "key": "limit",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "域名关键字，对证书的空格分隔域名文本执行包含匹配。",
            "type": "text/plain"
          },
          "key": "domain",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "精确匹配多个证书域名，一行一个域名；每项必须是合法域名或至少三级的通配符域名。服务端去除普通空格后按换行等剩余空白拆分，并匹配证书域名列表中的完整项。",
            "type": "text/plain"
          },
          "key": "domains",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "证书所属用户 ID。管理员传入时按该用户精确筛选；普通用户传入时会被忽略，结果仍固定为当前用户的数据。",
            "type": "text/plain"
          },
          "key": "uid",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "证书 ID，精确匹配。",
            "type": "text/plain"
          },
          "key": "id",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "证书名称关键字，执行包含匹配。",
            "type": "text/plain"
          },
          "key": "name",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "证书备注关键字，执行包含匹配。",
            "type": "text/plain"
          },
          "key": "des",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "证书来源类型，精确匹配：`custom` 为用户上传，`lets` 为 Let's Encrypt，`zerossl` 为 ZeroSSL，`buypass` 为 BuyPass。",
            "type": "text/plain"
          },
          "key": "type",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "签发证书所使用的 DNS API 配置 ID，精确匹配。",
            "type": "text/plain"
          },
          "key": "dnsapi",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "到期阈值天数，返回到期时间早于“当前时间加该天数”的证书；0 表示已经到期，也接受负整数以查询更早到期的记录。",
            "type": "text/plain"
          },
          "key": "expire",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "证书启用状态：1 表示启用，0 表示禁用。",
            "type": "text/plain"
          },
          "key": "enable",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "证书同步任务状态。`done` 同时匹配同步任务已完成和没有同步任务的证书；其他值仅匹配对应任务状态。",
            "type": "text/plain"
          },
          "key": "sync_state",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "自动证书签发任务状态。`failed` 同时匹配已停用的签发任务和状态为 failed 的任务；其他值要求任务仍启用且状态精确匹配。",
            "type": "text/plain"
          },
          "key": "issue_state",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "可用性筛选开关；传任意非空值都会启用。启用后只返回证书已启用，且没有签发任务或签发任务状态为 done 的记录；该条件不检查同步任务状态，建议传 1。",
            "type": "text/plain"
          },
          "key": "valid",
          "value": ""
        }
      ],
      "variable": []
    },
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "method": "GET",
    "auth": {
      "type": "apikey",
      "apikey": [
        {
          "type": "any",
          "value": "access-token",
          "key": "key"
        },
        {
          "type": "any",
          "value": "{{apiKey}}",
          "key": "value"
        },
        {
          "type": "any",
          "value": "header",
          "key": "in"
        }
      ]
    }
  }
}