Match Code Pairs Endpoint

On this page, we'll dive into the match code pairs endpoint you can use to find postal code pairs that are within a specified distance.


GET/v1/match

Match Postal Code Pairs

This endpoint returns pairs of postal codes from a given list where the distance between them is less than the specified maximum distance.

Required attributes

  • Name
    codes
    Type
    string
    Description

    Comma-separated list of zip codes (max 100). Example: 99501,99502,99503

  • Name
    distance
    Type
    integer
    Description

    Maximum distance between codes to be considered a match. Example: 100

  • Name
    country
    Type
    string
    Description

    Two letter country code. Example: us

Optional attributes

  • Name
    unit
    Type
    string
    Description

    Unit for distance calculation. Options: km, miles. Default: km

Request

GET
/v1/match
curl -G https://api.zipcodestack.com/v1/match?codes=99501%2C99502%2C99503&distance=100&country=us&unit=km \
    -H "apikey: YOUR-API-KEY"

Full Response

{
    "query": {
        "codes": [
            "99501",
            "99502",
            "99503"
        ],
        "distance": 100,
        "unit": "km",
        "country": "us"
    },
    "results": [
        {
            "code_1": "99501",
            "code_2": "99502",
            "distance": 5.23
        },
        {
            "code_1": "99501",
            "code_2": "99503",
            "distance": 8.45
        },
        {
            "code_1": "99502",
            "code_2": "99503",
            "distance": 4.12
        }
    ]
}