{
  "tags": [
    "账户资料"
  ],
  "description": "注册普通用户。是否开放注册，以及用户名、邮箱、手机和 QQ 是否必填、是否需要邮箱或手机验证码，均由系统的注册配置决定。无论配置如何，必须同意注册协议并提供符合规则的密码。",
  "operationId": "public_post_v1_user",
  "security": [],
  "responses": {
    "200": {
      "description": "请求已被处理。注册成功时 `code` 为 0、`msg` 为“注册成功!”、`data` 为 null；注册关闭、字段缺失、格式错误、账号重复或验证码无效时仍返回 HTTP 200。",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "code",
              "msg",
              "data"
            ],
            "properties": {
              "code": {
                "type": "integer",
                "description": "业务状态码；成功为 0。",
                "example": 0
              },
              "msg": {
                "type": "string",
                "description": "处理结果说明。",
                "example": "注册成功!"
              },
              "data": {
                "type": "string",
                "nullable": true,
                "description": "注册成功时为 null；失败时为空字符串。",
                "example": null
              }
            }
          },
          "examples": {
            "success": {
              "summary": "注册成功",
              "value": {
                "code": 0,
                "msg": "注册成功!",
                "data": null
              }
            },
            "agreementRequired": {
              "summary": "未同意协议",
              "value": {
                "code": "user-29",
                "msg": "请勾选同意协议再注册",
                "data": ""
              }
            },
            "registerDisabled": {
              "summary": "注册关闭",
              "value": {
                "code": "user-15",
                "msg": "目前已关闭注册!",
                "data": ""
              }
            }
          },
          "example": {
            "code": 0,
            "msg": "注册成功!",
            "data": null
          }
        }
      }
    }
  },
  "x-python-handler": "user.UserAPI",
  "x-python-route-line": 185,
  "x-audience": "user",
  "x-auth": "public",
  "x-reviewed": true,
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "accept_agreement",
            "password"
          ],
          "properties": {
            "username": {
              "type": "string",
              "description": "当系统要求用户名时必填。仅允许中文、英文字母与数字，不能是手机号，且必须唯一。",
              "example": "demo_user"
            },
            "email": {
              "type": "string",
              "format": "email",
              "description": "当系统要求邮箱时必填，且必须唯一；若系统配置邮箱验证，需同时提供 `captcha`。",
              "example": "demo@example.invalid"
            },
            "phone": {
              "type": "string",
              "description": "当系统要求手机号时必填，且必须唯一；若系统配置手机验证，需同时提供 `phone_captcha`。",
              "example": "13800000000"
            },
            "qq": {
              "type": "string",
              "description": "当系统要求 QQ 时必填，必须为合法 QQ 号。",
              "example": "10001"
            },
            "captcha": {
              "type": "string",
              "description": "邮箱验证码；仅在系统启用必填邮箱且要求邮箱验证时必填。",
              "example": "123456"
            },
            "phone_captcha": {
              "type": "string",
              "description": "手机验证码；仅在系统启用必填手机且要求手机验证时必填。",
              "example": "123456"
            },
            "accept_agreement": {
              "type": "integer",
              "enum": [
                1
              ],
              "description": "必填。必须为 1，表示同意注册协议。",
              "example": 1
            },
            "password": {
              "type": "string",
              "format": "password",
              "minLength": 6,
              "description": "必填。至少 6 位，且必须同时包含英文字母和数字。",
              "example": "Demo123456"
            }
          },
          "example": {
            "username": "demo_user",
            "email": "demo@example.invalid",
            "phone": "13800000000",
            "captcha": "123456",
            "phone_captcha": "123456",
            "accept_agreement": 1,
            "password": "Demo123456"
          }
        }
      }
    }
  },
  "parameters": [],
  "x-itecdn-source-reviewed": true,
  "extensions": [
    {
      "key": "x-python-handler",
      "value": "user.UserAPI"
    },
    {
      "key": "x-python-route-line",
      "value": 185
    },
    {
      "key": "x-audience",
      "value": "user"
    },
    {
      "key": "x-auth",
      "value": "public"
    },
    {
      "key": "x-reviewed",
      "value": true
    },
    {
      "key": "x-itecdn-source-reviewed",
      "value": true
    }
  ],
  "method": "post",
  "path": "/v1/user",
  "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 同时发送。"
    }
  },
  "jsonRequestBodyExample": {
    "username": "demo_user",
    "email": "demo@example.invalid",
    "phone": "13800000000",
    "captcha": "123456",
    "phone_captcha": "123456",
    "accept_agreement": 1,
    "password": "Demo123456"
  },
  "info": {
    "title": "itecdn v5 用户 API",
    "version": "5.x",
    "description": "itecdn v5.x Python 主控用户 API。本文档不适用于 v6 或其它实现。"
  },
  "postman": {
    "name": "创建用户",
    "description": {
      "content": "注册普通用户。是否开放注册，以及用户名、邮箱、手机和 QQ 是否必填、是否需要邮箱或手机验证码，均由系统的注册配置决定。无论配置如何，必须同意注册协议并提供符合规则的密码。",
      "type": "text/plain"
    },
    "url": {
      "path": [
        "v1",
        "user"
      ],
      "host": [
        "{{baseUrl}}"
      ],
      "query": [],
      "variable": []
    },
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json"
      },
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "method": "POST",
    "body": {
      "mode": "raw",
      "raw": "",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    }
  }
}