Get States & Cities
Returns valid state and city values for a country.
Endpoint
GET /v1/country/list
Request
Header Parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
Authorization | string | Yes | Bearer YOUR_ACCESS_TOKEN | Bearer token used for authentication. |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| country | string | Yes | Country name or ISO 3166-1 alpha-2 code (e.g. HK). |
Example request
curl -X GET "${API_URL}/v1/country/list?country=HK" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Responses
200 Success
200 Success
Response schema:
application/jsondata.countriesarrayInformation of matched country.
data.countries
array
Information of matched country.
code
name
string
Country full name.
Example:
Hong KongstatesarrayList of states for matched country.
states
array
List of states for matched country.
name
string
State, province, or district name.
citiesarrayList of cities under this state.
cities
array
List of cities under this state.
name
string
City name.
data.message
string
Informational message.
Response sample
{
"data": {
"countries": [
{
"code": "HK",
"name": "Hong Kong",
"states": [
{
"name": "Central and Western",
"cities": [
{ "name": "Central" },
{ "name": "Sheung Wan" }
]
},
{
"name": "Eastern District",
"cities": [
{ "name": "North Point" },
{ "name": "Quarry Bay" }
]
}
]
}
],
"message": "OK"
}
}
400 Bad Request
400 Bad Request
Response schema:
application/jsoncode
string
Error code
Example:
400000code_reason
string
Error reason.
Example:
BAD_REQUESTmessage
string
Human-readable message.
Example:
country parameter is requiredResponse sample
{
"error": {
"code": "400000",
"code_reason": "BAD_REQUEST",
"message": "country parameter is required"
}
}
401 Unauthorized
401 Unauthorized
Response schema:
application/jsoncode
string
Error code.
Example:
401000code_reason
string
Error reason.
Example:
UNAUTHORIZEDmessage
string
Human-readable message.
Example:
UnauthorizedResponse sample
{
"error": {
"code": "401000",
"code_reason": "UNAUTHORIZED",
"message": "Unauthorized"
}
}
403 Forbidden
403 Forbidden
Response schema:
application/jsonerror
json-string
Access forbidden for this resource.
404 Not Found
404 Not Found
Response schema:
application/jsonerror
json-string
Resource or endpoint not found.
500 Failure
500 Failure
Response schema:
application/jsoncode
string
Error code
Example:
500999code_reason
string
Error reason.
Example:
API_ERRORmessage
string
Human-readable message.
Example:
Api Error, please contact customer serviceResponse sample
{
"error": {
"code": "500999",
"code_reason": "API_ERROR",
"message": "Api Error, please contact customer service"
}
}