# Địa chỉ

## Lấy danh sách các tỉnh thành trong CSDL của GHSV.

<mark style="color:blue;">`GET`</mark> `https://api.ghsv.vn/v1/address/provinces`

Public API.

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "success": true,
    "msg": "",
    "provinces": [
        {
            "code": "1",
            "name": "Thành phố Hà Nội"
        },
        {
            "code": "79",
            "name": "Thành phố Hồ Chí Minh"
        },
        {
            "code": "92",
            "name": "Thành phố Cần Thơ"
        },
        //...
    ]
}
```

{% endtab %}
{% endtabs %}

## Lấy danh sách các quận / huyện trong CSDL của GHSV.

<mark style="color:blue;">`GET`</mark> `https://api.ghsv.vn/v1/address/districts`

Public API.

#### Headers

| Name                                           | Type   | Description      |
| ---------------------------------------------- | ------ | ---------------- |
| Content-Type<mark style="color:red;">\*</mark> | String | application/json |

#### Request Body

| Name                                             | Type   | Description                                                                                                                                                 |
| ------------------------------------------------ | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| province\_code<mark style="color:red;">\*</mark> | String | <p>mã tỉnh thành</p><p><a data-mention href="#lay-danh-sach-cac-tinh-thanh-trong-csdl-cua-ghsv.">#lay-danh-sach-cac-tinh-thanh-trong-csdl-cua-ghsv.</a></p> |

{% tabs %}
{% tab title="200: OK Lấy danh sách thành công" %}

```javascript
{
    "success": true,
    "msg": "",
    "districts": [
        {
            "code": "164",
            "name": "Thành phố Thái Nguyên"
        },
        {
            "code": "165",
            "name": "Thành phố Sông Công"
        },
        //... Array<District_name>
    ]
}
```

{% endtab %}

{% tab title="200: OK Lấy danh sách thất bại" %}

```javascript
{
    "success": false,
    "msg": "Không tìm thấy tỉnh thành này."
}
```

{% endtab %}
{% endtabs %}

## Lấy danh sách các xã / phường trong CSDL của GHSV.

<mark style="color:blue;">`GET`</mark> `https://api.ghsv.vn/v1/address/wards`

Public API.

#### Headers

| Name                                           | Type   | Description      |
| ---------------------------------------------- | ------ | ---------------- |
| Content-Type<mark style="color:red;">\*</mark> | String | application/json |

#### Request Body

| Name                                             | Type   | Description                                                                                                                                                   |
| ------------------------------------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| district\_code<mark style="color:red;">\*</mark> | String | <p>Mã quận / huyện</p><p><a data-mention href="#lay-danh-sach-cac-quan-huyen-trong-csdl-cua-ghsv.">#lay-danh-sach-cac-quan-huyen-trong-csdl-cua-ghsv.</a></p> |

{% tabs %}
{% tab title="200: OK Lấy danh sách thành công" %}

```javascript
{
    "success": true,
    "msg": "",
    "wards": [
        {
            "code": "30463",
            "name": "Thị trấn Cái Dầu"
        },
        {
            "code": "30499",
            "name": "Xã Bình Chánh"
        },
        {
            "code": "30484",
            "name": "Xã Bình Long"
        },
        //...
    ]
}
```

{% endtab %}

{% tab title="200: OK Lấy danh sách thất bại" %}

```javascript
{
    "success": false,
    "msg": "Không tìm thấy quận / huyện này."
}
```

{% endtab %}
{% endtabs %}


---

# 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://developer.ghsv.vn/api/dia-chi.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.
