# Tìm kiếm tài khoản

## &#x20;Tìm kiếm tài &#x20;

<mark style="color:blue;">`GET`</mark> `https://abc.hoola.vn/manage/api/users/search-user`

Để thực hiện truy vấn, phải có tối thiểu 1 tham số hoặc là email hoặc là username của tài khoản. Khi có đồng thời cả tham số email và username, tài khoản sẽ được ưu tiên tìm kiếm trước theo email, nếu không có kết quả trùng khớp theo email thì sẽ tiếp tục tìm kiếm tài khoản theo username.&#x20;

#### Query Parameters

| Name     | Type   | Description                      |
| -------- | ------ | -------------------------------- |
| token    | string | Token xác thực tài khoản của bạn |
| email    | string | Email của tài khoản              |
| username | string | Username của tài khoản           |

{% tabs %}
{% tab title="200  Truy vấn thành công " %}

```javascript
Mã phản hồi respCode "00". Truy vấn thành công. Data trả về
{
    "respCode": "00",
    "user": {
        "_id": "73chhLtPnxpPoekrx",
        "createdAt": "2021-05-27T08:38:15.067Z",
        "username": "vuvanhoang",
        "emails": [
            {
                "address": "hoangvuvan@abc.com",
                "verified": false
            }
        ],
        "profile": {
            "name": "Vu Van Hoang"
        },
        "myCourses": [
            {
                "courseId": "wSZpqbtWowmpLC68L",
                "activatedDate": "2021-05-29T06:19:24.107Z",
                "expiredAt": "2121-05-05T06:19:24.107Z"
            }
        ],
        "myCart": [
            {
                "courseId": "vivPteJNNC2P94Es8",
                "status": "DELETED"
            }
        ],
        "myTransactions": [
            "nTv5XgDMNcMLBuRM5"
        ]
    },
    "msg": "Success"
}
```

{% endtab %}

{% tab title="400 Thiếu thông tin tham số yêu cầu hoặc không tìm thấy tài khoản cần tìm kiếm " %}

```javascript
Mã phản hồi respCode "02". Thiếu tham số token tài khoản của bạn. Data trả về
{
    "respCode": "02",
    "user": null,
    "msg": "No token"
}


Mã phản hồi respCode "03". Thiếu tham số email hoặc username tài khoản cần tìm kiếm. Data trả về
{
    "respCode": "03",
    "user": null,
    "msg": "Search user require email or username parameter"
}


Mã phản hồi respCode "07". Không tìm thấy tài khoản cần tìm kiếm. Data trả về
{
    "respCode": "07",
    "user": null,
    "msg": "User not found"
}

```

{% endtab %}

{% tab title="401  Xác thực tài khoản của bạn không thành công  " %}

```javascript
Mã phản hồi respCode "05". Token xác thực tài khoản của bạn không có hiệu lực hoặc đã hết hạn . Data trả về
{
    "respCode": "05",
    "user": null,
    "msg": "Invalid token || Token has expired"
}
```

{% endtab %}

{% tab title="403  Tài khoản của bạn không được phân quyền để thực hiện truy vấn " %}

```javascript
Mã phản hồi respCode "06". Tài khoản của bạn không được phân quyền thực hiện truy vấn này. Data trả về 
{
    "respCode": "06",
    "user": null,
    "msg": "Your account does not have permission"
}
```

{% endtab %}

{% tab title="405  Phương thức truy vấn không hợp lệ " %}

```javascript
Mã phản hồi respCode "01". Phương thức không hợp lệ . Data trả về 
{
    "respCode": "01",
    "user": null,
    "msg": "Request method should be GET"
}
```

{% endtab %}

{% tab title="500 Lỗi server " %}

```javascript
Mã phản hồi respCode "04". Server không xác thực được tài khoản của bạn. Data trả về 
{
    "respCode": "04",
    "user": null,
    "msg": "Server not able to authenticate your account"
}
```

{% endtab %}
{% endtabs %}

Ví dụ về tìm kiếm một tài khoản:&#x20;

```javascript
Tìm kiếm một tài khoản theo email:
GET:
https://abc.hoola.vn/manage/api/users/search-user?token=sdhg23797sdbv9186jdvk58&email=abc@abc.com


Tìm kiếm một tài khoản theo username:
GET:
https://abc.hoola.vn/manage/api/users/search-user?token=sdhg23797sdbv9186jdvk58&username=abc


Tìm kiếm một tài khoản theo email hoặc theo username:
GET:
https://abc.hoola.vn/manage/api/users/search-user?token=sdhg23797sdbv9186jdvk58&email=abc@abc.com&username=abc
```

&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hoola.vn/v5.0.0/ket-noi-api/search-user.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
