{
  "tags": [
    "API 密钥"
  ],
  "description": "关闭并删除当前登录用户的 API Key 配置；管理员可通过 `uid` 关闭指定用户。删除的是整条配置记录，包括 API Key、API Secret 和来源 IP 白名单；事务提交后旧凭证立即无法用于后续 API 认证。目标用户必须已经开通 API Key。",
  "operationId": "user_delete_v1_api_key",
  "security": [
    {
      "AccessToken": []
    },
    {
      "ApiKey": [],
      "ApiSecret": []
    }
  ],
  "responses": {
    "200": {
      "description": "业务结果通过 HTTP 200 返回。API Key 配置删除并提交后返回确认消息；目标用户未开通、普通用户尝试指定 `uid` 或认证无效时返回字符串业务错误码，删除事务会回滚。",
      "content": {
        "application/json": {
          "schema": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "code",
                  "msg",
                  "data"
                ],
                "properties": {
                  "code": {
                    "type": "integer",
                    "enum": [
                      0
                    ],
                    "description": "成功状态码，API Key 配置删除成功时固定为 0。"
                  },
                  "msg": {
                    "type": "string",
                    "enum": [
                      "api_key关闭成功"
                    ],
                    "description": "API Key 配置删除并提交事务后返回的确认消息。"
                  },
                  "data": {
                    "type": "string",
                    "nullable": true,
                    "enum": [
                      null
                    ],
                    "description": "关闭成功时没有额外业务数据，固定为 null。"
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "object",
                "required": [
                  "code",
                  "msg",
                  "data"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "api-key-4",
                      "message-28",
                      "login_required"
                    ],
                    "description": "业务错误码：`api-key-4` 表示目标用户尚未开通 API Key，`message-28` 表示普通用户尝试关闭指定用户的密钥，`login_required` 表示登录态或 API Key 认证无效。"
                  },
                  "msg": {
                    "type": "string",
                    "description": "与业务错误码对应的中文未开通、权限或认证失败原因。"
                  },
                  "data": {
                    "type": "string",
                    "enum": [
                      ""
                    ],
                    "description": "业务错误时固定为空字符串。"
                  }
                },
                "additionalProperties": false
              }
            ]
          },
          "example": {
            "code": 0,
            "msg": "api_key关闭成功",
            "data": null
          }
        }
      }
    }
  },
  "x-python-handler": "system.ApiKeyAPI",
  "x-python-route-line": 907,
  "x-audience": "user",
  "x-auth": "user",
  "x-reviewed": true,
  "parameters": [
    {
      "name": "uid",
      "in": "query",
      "required": false,
      "description": "要关闭 API Key 的用户 ID。省略时关闭当前登录用户的密钥；仅管理员可指定其他用户。",
      "schema": {
        "type": "integer",
        "format": "int64",
        "minimum": 1
      },
      "example": 2
    }
  ],
  "x-itecdn-source-reviewed": true,
  "extensions": [
    {
      "key": "x-python-handler",
      "value": "system.ApiKeyAPI"
    },
    {
      "key": "x-python-route-line",
      "value": 907
    },
    {
      "key": "x-audience",
      "value": "user"
    },
    {
      "key": "x-auth",
      "value": "user"
    },
    {
      "key": "x-reviewed",
      "value": true
    },
    {
      "key": "x-itecdn-source-reviewed",
      "value": true
    }
  ],
  "method": "delete",
  "path": "/v1/api-key",
  "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": "关闭 API Key",
    "description": {
      "content": "关闭并删除当前登录用户的 API Key 配置；管理员可通过 `uid` 关闭指定用户。删除的是整条配置记录，包括 API Key、API Secret 和来源 IP 白名单；事务提交后旧凭证立即无法用于后续 API 认证。目标用户必须已经开通 API Key。",
      "type": "text/plain"
    },
    "url": {
      "path": [
        "v1",
        "api-key"
      ],
      "host": [
        "{{baseUrl}}"
      ],
      "query": [
        {
          "disabled": false,
          "description": {
            "content": "要关闭 API Key 的用户 ID。省略时关闭当前登录用户的密钥；仅管理员可指定其他用户。",
            "type": "text/plain"
          },
          "key": "uid",
          "value": ""
        }
      ],
      "variable": []
    },
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "method": "DELETE",
    "auth": {
      "type": "apikey",
      "apikey": [
        {
          "type": "any",
          "value": "access-token",
          "key": "key"
        },
        {
          "type": "any",
          "value": "{{apiKey}}",
          "key": "value"
        },
        {
          "type": "any",
          "value": "header",
          "key": "in"
        }
      ]
    }
  }
}