> For the complete documentation index, see [llms.txt](https://en.help.firstline.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://en.help.firstline.cc/developer/api/country-city.md).

# Country, city, and region

## Country

```javascript
GET https://{API_DOMAIN}/api/v1/state
```

```javascript
curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/country?per_page=3"
```

### Parameters

| PARAMETER     | REQUIRED | DEFAULT | TYPE   | DESCRIPTION         |
| ------------- | -------- | ------- | ------ | ------------------- |
| **page**      | false    | 1       | Number | Current page number |
| **per\_page** | false    | 15      | Number | Items per page      |

### Response

| PROPERTY | TYPE             | DESCRIPTION                                                        |
| -------- | ---------------- | ------------------------------------------------------------------ |
| **data** | Array of objects | [Country array](/developer/api/response-object.md#guo-jia-country) |
| **meta** | Object           | Pagination meta                                                    |

```javascript
{
    "data": [
        {
            "id": 1,
            "name": "Taiwan",
            "abbrev": null
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "per_page": "3",
        "to": 1,
        "total": 1
    }
}
```

## State/County

```javascript
GET https://{API_DOMAIN}/api/v1/state‌
```

```javascript
curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/state?per_page=3"
```

### Parameters

| PARAMETER     | REQUIRED | DEFAULT | TYPE   | DESCRIPTION         |
| ------------- | -------- | ------- | ------ | ------------------- |
| **page**      | false    | 1       | Number | Current page number |
| **per\_page** | false    | 15      | Number | Items per page      |
| **name**      | false    | NULL    | String | State/County name   |

### Response

| PROPERTY | TYPE             | DESCRIPTION                                                             |
| -------- | ---------------- | ----------------------------------------------------------------------- |
| **data** | Array of objects | [State/County array](/developer/api/response-object.md#guo-jia-country) |
| **meta** | Object           | Pagination meta                                                         |

```javascript
{
    "data": [
        {
            "id": 2,
            "country_id": 1,
            "name": "Keelung City",
            "country": {
                "id": 1,
                "name": "Taiwan",
                "abbrev": null
            }
        },
        {
            "id": 3,
            "country_id": 1,
            "name": "Taipei City",
            "country": {
                "id": 1,
                "name": "Taiwan",
                "abbrev": null
            }
        },
        {
            "id": 4,
            "country_id": 1,
            "name": "New Taipei City",
            "country": {
                "id": 1,
                "name": "Taiwan",
                "abbrev": null
            }
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 8,
        "per_page": "3",
        "to": 3,
        "total": 23
    }
}
```

## District

```javascript
GET https://{API_DOMAIN}/api/v1/city
```

```javascript
curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/city?per_page=3"
```

### Parameters

| PARAMETER     | REQUIRED | DEFAULT | TYPE   | DESCRIPTION                                                             |
| ------------- | -------- | ------- | ------ | ----------------------------------------------------------------------- |
| **page**      | false    | 1       | Number | Current page number                                                     |
| **per\_page** | false    | 15      | Number | Items per page                                                          |
| **state\_id** | false    | NULL    | Number | [State/County](/developer/api/response-object.md#cheng-shi-state)the id |
| **zipcode**   | false    | NULL    | Number | Postal code                                                             |
| **name**      | false    | NULL    | String | Postal area name                                                        |

### Response

| PROPERTY | TYPE             | DESCRIPTION                                                 |
| -------- | ---------------- | ----------------------------------------------------------- |
| **data** | Array of objects | [District array](/developer/api/response-object.md#ou-city) |
| **meta** | Object           | Pagination meta                                             |

```javascript
{
    "data": [
        {
            "id": 1,
            "state_id": 2,
            "state": {
                "id": 2,
                "country_id": 1,
                "name": "Keelung City"
            },
            "name": "Renai District",
            "zipcode": "200"
        },
        {
            "id": 2,
            "state_id": 2,
            "state": {
                "id": 2,
                "country_id": 1,
                "name": "Keelung City"
            },
            "name": "Xinyi District",
            "zipcode": "201"
        },
        {
            "id": 3,
            "state_id": 2,
            "state": {
                "id": 2,
                "country_id": 1,
                "name": "Keelung City"
            },
            "name": "Zhongzheng District",
            "zipcode": "202"
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 124,
        "per_page": "3",
        "to": 3,
        "total": 371
    }
}
```
