Search by State Endpoint

On this page, we'll dive into the state search endpoint you can use to find all postal codes within a specific state or province.


GET/v1/code/state

Search Codes by State

This endpoint returns all postal codes for a specified state or province.

Required attributes

  • Name
    state_name
    Type
    string
    Description

    State or province name. Example: Alaska

  • Name
    country
    Type
    string
    Description

    Two letter country code. Example: us

Optional attributes

  • Name
    limit
    Type
    integer
    Description

    Maximum number of results to return. If omitted, all postal codes for the state are returned, which can consume a large number of credits (1 credit per 10 codes). Example: 100

Request

GET
/v1/code/state
curl -G "https://api.zipcodestack.com/v1/code/state?state_name=Alaska&country=us&limit=100" \
    -H "apikey: YOUR-API-KEY"

Full Response

{
    "query": {
        "state": "Alaska",
        "country": "us"
    },
    "results": [
        "99501",
        "99502",
        "99503",
        "99504",
        "99505",
        "..."
    ]
}