> For the complete documentation index, see [llms.txt](https://developer.ghsv.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.ghsv.vn/api/dia-chi.md).

# Đị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 %}
