{
  "tags": [
    "域名管理"
  ],
  "description": "分页查询网站绑定的域名及其 CNAME、DNS API 和同步任务状态，按域名记录 ID 倒序返回。普通用户只可查询自己的域名，管理员可用 uid 查询指定用户。domain 使用包含匹配；limit=0 时返回全部匹配记录。",
  "operationId": "user_get_v1_domains",
  "security": [
    {
      "AccessToken": []
    },
    {
      "ApiKey": [],
      "ApiSecret": []
    }
  ],
  "responses": {
    "200": {
      "description": "业务结果使用 HTTP 200 返回。成功响应含 code、count、data，不含 msg 字段；分页参数或认证失败时返回业务错误封装。",
      "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": "当前页域名记录，按 domain.id 倒序排列。",
                    "items": {
                      "type": "object",
                      "required": [
                        "username",
                        "uid",
                        "id",
                        "site_id",
                        "domain",
                        "cname",
                        "dns_api",
                        "state",
                        "ret"
                      ],
                      "properties": {
                        "username": {
                          "type": "string",
                          "nullable": true,
                          "description": "网站所属用户登录名。"
                        },
                        "uid": {
                          "type": "integer",
                          "format": "int64",
                          "nullable": true,
                          "description": "网站所属用户 ID。"
                        },
                        "id": {
                          "type": "integer",
                          "format": "int64",
                          "description": "域名记录 ID。"
                        },
                        "site_id": {
                          "type": "integer",
                          "format": "int64",
                          "nullable": true,
                          "description": "所属网站 ID。"
                        },
                        "domain": {
                          "type": "string",
                          "description": "网站绑定的域名。"
                        },
                        "cname": {
                          "type": "string",
                          "nullable": true,
                          "description": "根据网站 cname_mode 及其 CNAME 域名配置计算出的完整 CNAME 目标。"
                        },
                        "dns_api": {
                          "type": "integer",
                          "format": "int64",
                          "nullable": true,
                          "description": "网站关联的 DNS API 凭据 ID；null 表示尚未设置。"
                        },
                        "state": {
                          "type": "string",
                          "nullable": true,
                          "description": "关联域名 DNS 同步任务状态；无任务时为 null。"
                        },
                        "ret": {
                          "type": "string",
                          "nullable": true,
                          "description": "关联域名 DNS 同步任务返回内容；无任务时为 null。"
                        }
                      },
                      "additionalProperties": false,
                      "description": "网站域名及 DNS 同步状态记录。"
                    }
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "object",
                "required": [
                  "code",
                  "msg",
                  "data"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "domain-2",
                      "domain-3",
                      "login_required"
                    ],
                    "description": "分页参数错误或认证失效的业务错误码。"
                  },
                  "msg": {
                    "type": "string",
                    "description": "分页参数或认证失败原因。"
                  },
                  "data": {
                    "type": "string",
                    "enum": [
                      ""
                    ],
                    "description": "业务错误时固定为空字符串。"
                  }
                },
                "additionalProperties": false
              }
            ]
          },
          "example": {
            "code": 0,
            "count": 1,
            "data": [
              {
                "username": "demo-user",
                "uid": 10001,
                "id": 9001,
                "site_id": 5001,
                "domain": "www.example.com",
                "cname": "site-a.cname.example.invalid",
                "dns_api": 3001,
                "state": "pending",
                "ret": null
              }
            ]
          }
        }
      }
    }
  },
  "x-python-handler": "site.DomainAPI",
  "x-python-route-line": 577,
  "x-audience": "user",
  "x-auth": "user",
  "x-reviewed": true,
  "parameters": [
    {
      "name": "page",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "format": "int32"
      },
      "description": "页码，默认 1。服务端仅校验其为数字；分页偏移按 (page - 1) × limit 计算。",
      "example": 1
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "format": "int32",
        "minimum": 0
      },
      "description": "每页记录数，默认 10；传 0 时取消 SQL limit。",
      "example": 10
    },
    {
      "name": "uid",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "format": "int64",
        "minimum": 1
      },
      "description": "仅管理员可用：筛选网站所属用户 ID。普通用户提供该参数不会改变查询范围。",
      "example": 10001
    },
    {
      "name": "domain",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      },
      "description": "按域名进行包含匹配，不是精确匹配。",
      "example": "example.com"
    },
    {
      "name": "site_id",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "format": "int64",
        "minimum": 1
      },
      "description": "精确筛选所属网站 ID。",
      "example": 5001
    },
    {
      "name": "dnsapi_state",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "enum": [
          "set",
          "not_set"
        ]
      },
      "description": "DNS API 设置状态：set 仅返回已设置 s.dns_api 的网站域名，not_set 仅返回未设置的。其他值不会增加筛选条件。",
      "example": "set"
    },
    {
      "name": "task_state",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string"
      },
      "description": "精确筛选关联域名 DNS 同步任务的 state 值。",
      "example": "pending"
    }
  ],
  "x-itecdn-source-reviewed": true,
  "extensions": [
    {
      "key": "x-python-handler",
      "value": "site.DomainAPI"
    },
    {
      "key": "x-python-route-line",
      "value": 577
    },
    {
      "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/domains",
  "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": "查询网站域名与 DNS 同步状态",
    "description": {
      "content": "分页查询网站绑定的域名及其 CNAME、DNS API 和同步任务状态，按域名记录 ID 倒序返回。普通用户只可查询自己的域名，管理员可用 uid 查询指定用户。domain 使用包含匹配；limit=0 时返回全部匹配记录。",
      "type": "text/plain"
    },
    "url": {
      "path": [
        "v1",
        "domains"
      ],
      "host": [
        "{{baseUrl}}"
      ],
      "query": [
        {
          "disabled": false,
          "description": {
            "content": "页码，默认 1。服务端仅校验其为数字；分页偏移按 (page - 1) × limit 计算。",
            "type": "text/plain"
          },
          "key": "page",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "每页记录数，默认 10；传 0 时取消 SQL limit。",
            "type": "text/plain"
          },
          "key": "limit",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "仅管理员可用：筛选网站所属用户 ID。普通用户提供该参数不会改变查询范围。",
            "type": "text/plain"
          },
          "key": "uid",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "按域名进行包含匹配，不是精确匹配。",
            "type": "text/plain"
          },
          "key": "domain",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "精确筛选所属网站 ID。",
            "type": "text/plain"
          },
          "key": "site_id",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "DNS API 设置状态：set 仅返回已设置 s.dns_api 的网站域名，not_set 仅返回未设置的。其他值不会增加筛选条件。",
            "type": "text/plain"
          },
          "key": "dnsapi_state",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "精确筛选关联域名 DNS 同步任务的 state 值。",
            "type": "text/plain"
          },
          "key": "task_state",
          "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"
        }
      ]
    }
  }
}