> For the complete documentation index, see [llms.txt](https://docs.hoola.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hoola.vn/english/api/create-single-user.md).

# Create an account

## &#x20;Create an account

<mark style="color:green;">`POST`</mark> `https://abc.hoola.vn/manage/api/users/create-single-user`

Note: To avoid too many queries leading to server overload, the time interval between each query to create an account should be at least 5 seconds&#x20;

#### Query Parameters

| Name  | Type   | Description                  |
| ----- | ------ | ---------------------------- |
| token | string | Account Authentication Token |

#### Request Body

| Name     | Type   | Description                                                                                      |
| -------- | ------ | ------------------------------------------------------------------------------------------------ |
| job      | string | Job Title                                                                                        |
| gender   | string | Gender                                                                                           |
| street   | string | Street                                                                                           |
| district | string | District                                                                                         |
| city     | string | City                                                                                             |
| phone    | string | Phone                                                                                            |
| name     | string | Full name in string format and has at least 3 characters                                         |
| username | string | Username in string format with no space and special character and a length of 3 to 20 characters |
| email    | string | Email                                                                                            |
| password | string | Password with a length of 6 to 35 characters                                                     |

{% tabs %}
{% tab title="200 Create an account successfully" %}

```javascript
// Response Code "00". Create an account successfully.
// Return data:
{
    "respCode": "00",
    "user": {
        "userId": "zKpEoZmyDwMP9gtGr",
        "name": "Nguyễn Văn A",
        "username": "nguyenvana",
        "email": "nguyenvana@abc.com",
        "status": "Success created"
    },
    "msg": "Create user success"
}
```

{% endtab %}

{% tab title="400  Query is missing parameters or the account has been created" %}

```javascript
// Response Code "02". No request body.
// Return data:
{
    "respCode": "02",
    "user": null,
    "msg": "No request body"
}


// Response Code "03". No name in request body.
// Return data:
{
    "respCode": "03",
    "user": null,
    "msg": "No name in request body"
}



// Response Code "04". No name in request body.
// Return data:
{
    "respCode": "04",
    "user": null,
    "msg": "No name in request body"
}


// Response Code "05". No name in request body.
// Return data:
{
    "respCode": "05",
    "user": null,
    "msg": "No name in request body"
}


// Response Code "06". No password in request body.
// Return data:
{
    "respCode": "06",
    "user": null,
    "msg": "No password in request body"
}


// Response Code "07". No token provided.
// Return data:
{
    "respCode": "07",
    "user": null,
    "msg": "No token"
}


// Response Code "13". Email already in use.
// Return data:
{
    "respCode": "13",
    "user": null,
    "msg": "Email already in use"
}


// Response Code "14". Username already in use.
// Return data:
{
    "respCode": "14",
    "user": null,
    "msg": "Username already in use"
}
```

{% endtab %}

{% tab title="401 Fail to verify your account" %}

```javascript
// Response Code "09". Token is invalid or has expired.
// Return data:
{
    "respCode": "09",
    "user": null,
    "msg": "Invalid token || Token has expired"
}
```

{% endtab %}

{% tab title="403 Your account is not authorized to perform the query, or the server has reached the maximum number of accounts" %}

```javascript
// Response Code "10". Your account is not authorized to perform the query.
// Return data:
{
    "respCode": "10",
    "user": null,
    "msg": "Your account does not have permission"
}


// Response Code "12". The server has reached the maximum number of accounts.
// Return data:
{
    "respCode": "12",
    "user": null,
    "msg": "The number of accounts has run out"
}
```

{% endtab %}

{% tab title="405 Wrong request method" %}

```javascript
// Response Code "01". Wrong request method.
// Return data: 
{
    "respCode": "01",
    "user": null,
    "msg": "Request method should be POST"
}
```

{% endtab %}

{% tab title="500 Server error" %}

```javascript
// Response Code "08". Server not able to authenticate your account.
// Return data: 
    "respCode": "08",
    "user": null,
    "msg": "Server not able to authenticate your account"
}


// Response Code "11". Server is not able to check your website resources.
// Return data: 
{
    "respCode": "11",
    "user": null,
    "msg": "Server is not able to check your website resources"
}


// Response Code "15". Server is not able to create new user.
// Return data: 
{
    "respCode": "15",
    "user": null,
    "msg": "Server is not able to create new user"
}
```

{% endtab %}
{% endtabs %}

Example:&#x20;

```javascript
// POST:
https://abc.hoola.vn/manage/api/users/create-single-user?token=sdhg23797sdbv9186jdvk58

body: {
    name: "Nguyễn Văn A",
    username: "nguyenvana",
    email: "nguyenvana@abc.com",
    password: "1234567890",
    phone: "0987654321",
    city: "Hà Nội",
    district: "Quận Cầu Giấy",
    street: "40 Hoàng Đạo Thuý",
    gender: "Nam",
    job: "Giáo viên THCS"
}
```

&#x20;
