Search by City Endpoint
On this page, we'll dive into the city search endpoint you can use to find postal codes for a specific city.
This endpoint costs 1 credit per 10 postal codes returned (minimum 1 credit). For example, 25 results = 3 credits, 100 results = 10 credits.
GET/v1/code/city
Search Codes by City
This endpoint returns all postal codes for a specified city, optionally filtered by state.
Required attributes
- Name
city- Type
- string
- Description
City name. Example: Anchorage
- Name
country- Type
- string
- Description
Two letter country code. Example: us
Optional attributes
- Name
state_name- Type
- string
- Description
State or province name to filter results. Example: Alaska
- Name
limit- Type
- integer
- Description
Maximum number of results to return. Example: 10
Request
GET
/v1/code/citycurl -G https://api.zipcodestack.com/v1/code/city?city=Anchorage&state_name=Alaska&country=us \
-H "apikey: YOUR-API-KEY"
Full Response
{
"query": {
"city": "Anchorage",
"state": "Alaska",
"country": "us"
},
"results": [
"99501",
"99502",
"99503",
"99504",
"99505"
]
}