> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ariacompute.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 在咏唱引擎 ROUTER 上注册账户

> POST /v1/router/auth/register 在咏唱引擎 ROUTER 上创建新用户账户。可通过 GET /v1/router/auth/register-status 检查注册状态。

在咏唱引擎 ROUTER 上创建新用户账户。注册前，请先调用 `GET /v1/router/auth/register-status` 检查是否开启了开放注册。当开放注册开启时，此接口为公开接口。

## 接口

```http theme={null}
POST /v1/router/auth/register
```

## 认证

开放注册开启时无需认证。

## 请求体

<ParamField body="username" type="string" required>
  新账户的期望用户名。
</ParamField>

<ParamField body="password" type="string" required>
  新账户的密码。
</ParamField>

<ParamField body="email" type="string">
  可选的、与账户关联的邮箱地址。
</ParamField>

## 响应

<ResponseField name="id" type="string">
  新创建用户的唯一标识符。
</ResponseField>

<ResponseField name="username" type="string">
  新创建用户的用户名。
</ResponseField>

<ResponseField name="email" type="string | null">
  若提供了邮箱则为邮箱，否则为 null。
</ResponseField>

<ResponseField name="role" type="string">
  分配的角色，通常为 `"user"`。
</ResponseField>

<ResponseField name="disabled" type="boolean">
  账户是否被禁用。创建时恒为 `false`。
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://router.example.com:8080/v1/router/auth/register \
    -H "Content-Type: application/json" \
    -d '{"username":"alice","password":"secret123","email":"alice@example.com"}'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "user-abc123",
    "username": "alice",
    "email": "alice@example.com",
    "role": "user",
    "disabled": false
  }
  ```
</ResponseExample>

## 注册状态

使用以下接口检查是否开启了开放注册。

```http theme={null}
GET /v1/router/auth/register-status
```

### 响应

<ResponseField name="open" type="boolean">
  开放注册开启时为 `true`，否则为 `false`。
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl https://router.example.com:8080/v1/router/auth/register-status
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "open": true
  }
  ```
</ResponseExample>
