List cities
Overview
Get the cities in a state.
Use this to find the city_id for an address.
You'll need the state.
Returns cities with ids, sorted by name. Use a city's value as city_id, for example in Save the billing address.
Prerequisites
- A
country_code, from List countries, and astate_code, from List states.
Base URL
| Environment | URL |
|---|---|
| Production | https://production-api.shoutaboutus.com |
| Development | https://development-api.shoutaboutus.com |
Endpoint
GET /api/v1/address/cities
Authentication
Public (no token)
- Anyone gets the same global list.
Rate limit
100 requests per minute, counted per client IP address. See Rate limits.
Request parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
country_code | query | string | Yes | The country's ISO code, for example US. Must be a known country code. |
state_code | query | string | Yes | The state's code, for example CA. Must be a known state code. A state code from a different country returns an empty list. |
Request body
None.
Request payload
None.
Response body
The payload is inside data.data: one entry per city. An empty array when the state has no cities in that country.
| Field | Type | Description |
|---|---|---|
data.data[].value | integer | The city's id. Use it as city_id. |
data.data[].label | string | The city's name. |
Response payload
{
"data": {
"data": [
{
"value": 133434,
"label": "Acalanes Ridge"
},
{
"value": 133435,
"label": "Acton"
},
{
"value": 133436,
"label": "Adelanto"
}
]
}
}Examples
Success payload
A state code that isn't in the country (here country_code=AU&state_code=CA):
{
"data": {
"data": []
}
}Error payload
422 Codes missing
{
"message": "The state code field is required. (and 1 more error)",
"errors": {
"state_code": [
"The state code field is required."
],
"country_code": [
"The country code field is required."
]
}
}429 Too many requests
{
"message": "Too Many Attempts."
}| Status | Meaning |
|---|---|
200 | The state's cities, or []. |
422 | country_code or state_code is missing or unknown. |
429 | More than 100 requests in a minute from your IP address. |
500 | Unexpected server error. |
Example request
curl --request GET \
--url "https://production-api.shoutaboutus.com/api/v1/address/cities?country_code=US&state_code=CA" \
--header 'Accept: application/json'Updated 17 days ago
Did this page help you?
