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 the postal codes for a specified state or province, in the order they were added. total is the number of postal codes of the state; when has_more is true, request the next page.

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

    Postal codes per page, at most 10000 (a larger limit reads as 10000). If omitted, a page holds 10000 postal codes, which can count as many requests (1 request per 10 codes). Example: 100

  • Name
    page
    Type
    integer
    Description

    The page of the results, from 1. Default: 1.

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",
        "..."
    ],
    "total": 238,
    "page": 1,
    "limit": 100,
    "has_more": true
}