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

Base URL

EnvironmentURL
Productionhttps://production-api.shoutaboutus.com
Developmenthttps://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

ParameterInTypeRequiredDescription
country_codequerystringYesThe country's ISO code, for example US. Must be a known country code.
state_codequerystringYesThe 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.

FieldTypeDescription
data.data[].valueintegerThe city's id. Use it as city_id.
data.data[].labelstringThe 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."
}
StatusMeaning
200The state's cities, or [].
422country_code or state_code is missing or unknown.
429More than 100 requests in a minute from your IP address.
500Unexpected 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'

Did this page help you?