ZIP to county API
GET /v1/zip/{zip} returns the county a ZIP code is in, with its name and five digit FIPS code, and every other county the ZIP code crosses with the share of its land in each. The reverse, every ZIP code in a county, is GET /v1/county/{fips}/zips.
Get a free API key
1,000 requests a day, free · no card · the key appears on the next page
GET /v1/zip/{zip}
Everything about one ZIP code: USPS city, other place names, state, every county it touches with a weight, coordinates, time zone, metro area, census demographics, business counts, IRS figures and the nearest ZIP codes. ZIP+4 input is accepted and cut to five digits.
curl "https://zipcodes.pro/v1/zip/78666" \
-H "Authorization: Bearer YOUR_API_KEY"const res = await fetch("https://zipcodes.pro/v1/zip/78666", {
headers: { Authorization: "Bearer YOUR_API_KEY" },
});
if (!res.ok) throw new Error((await res.json()).message);
const data = await res.json();import requests
r = requests.get(
"https://zipcodes.pro/v1/zip/78666",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=10,
)
r.raise_for_status()
data = r.json() Response 200
{
"zip": "78666",
"city": "San Marcos",
"state": "TX",
"county": {
"fips": "48209",
"name": "Hays County",
"short_name": "Hays"
},
"counties": [
{
"county_fips": "48209",
"name": "Hays County",
"short_name": "Hays",
"weight": 0.7792,
"basis": "land_area"
},
{
"county_fips": "48187",
"name": "Guadalupe County",
"short_name": "Guadalupe",
"weight": 0.1573,
"basis": "land_area"
},
{
"county_fips": "48091",
"name": "Comal County",
"short_name": "Comal",
"weight": 0.0433,
"basis": "land_area"
},
{
"county_fips": "48055",
"name": "Caldwell County",
"short_name": "Caldwell",
"weight": 0.0202,
"basis": "land_area"
}
],
"…": "14 more fields"
} | Parameter | Meaning |
|---|---|
zippath, required | Five digit ZIP code, or ZIP+4 (95014-2083). |
What you get
- county is the primary county: name, short name and FIPS code.
- counties lists every county the ZIP code touches, largest share first, with weight (0 to 1) and the basis it was measured on.
- A ZIP code is a mail route, not a boundary, so about one in four crosses a county line. The weights tell you how much.
- County FIPS codes join directly to Census, BLS and CDC county data.
ZIP codes in a county: GET /v1/county/{fips}/zips
Every ZIP code in a county, by five digit county FIPS code (state FIPS + county FIPS).
curl "https://zipcodes.pro/v1/county/06085/zips" \
-H "Authorization: Bearer YOUR_API_KEY"const res = await fetch("https://zipcodes.pro/v1/county/06085/zips", {
headers: { Authorization: "Bearer YOUR_API_KEY" },
});
if (!res.ok) throw new Error((await res.json()).message);
const data = await res.json();import requests
r = requests.get(
"https://zipcodes.pro/v1/county/06085/zips",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=10,
)
r.raise_for_status()
data = r.json() Response 200
{
"county_fips": "06085",
"count": 109,
"zips": [
{
"zip": "94022",
"type": "standard",
"usps_city": "Los Altos",
"state": "CA",
"county_fips": "06085",
"timezone": "America/Los_Angeles",
"lat": 37.35536,
"lng": -122.144935,
"population": 20027,
"median_household_income": 250001,
"median_home_value": 2000001,
"land_sqmi": 17.689,
"density_per_sqmi": 1132.2
},
{
"zip": "94023",
"type": "unknown",
"usps_city": "Los Altos",
"state": "CA",
"county_fips": "06085",
"timezone": "America/Los_Angeles",
"lat": 37.3852,
"lng": -122.1141,
"population": null,
"median_household_income": null,
"median_home_value": null,
"land_sqmi": null,
"density_per_sqmi": null
},
{
"zip": "94024",
"type": "standard",
"usps_city": "Los Altos",
"state": "CA",
"county_fips": "06085",
"timezone": "America/Los_Angeles",
"lat": 37.350388,
"lng": -122.098686,
"population": 23051,
"median_household_income": 250001,
"median_home_value": 2000001,
"land_sqmi": 8.273,
"density_per_sqmi": 2786.3
},
"… 106 more"
]
} Limits
The free plan includes 1,000 requests a day, reset at 00:00 UTC, and 60 a minute. Every response says where you stand:
| Header | Meaning |
|---|---|
X-RateLimit-Limit | Requests your plan includes in the current window (1,000 a day on Free). |
X-RateLimit-Remaining | Requests left in the window, after this one. |
X-RateLimit-Reset | When the window resets, ISO 8601 in UTC. Free resets at 00:00 UTC. |
Retry-After | Seconds to wait, on a 429 for the per-minute limit only. |
Over the limit, the API answers 429 with the reset time; nothing is
billed. Paid plans for higher volume (Starter 100,000 a month, Pro 500,000 a month, Business 3,000,000 a month)
are listed on the pricing page and are not on sale yet.
Questions
What county is a ZIP code in?
The county field of the /v1/zip response is the county holding the largest share of the ZIP code's land. For a ZIP code that crosses county lines, the counties array lists all of them with their shares.
What is a county FIPS code?
A five digit code: two digits for the state and three for the county. 06085 is Santa Clara County, California. It is the key most US government county data is published under.
How are the county shares measured?
From the Census 2020 ZCTA-to-county relationship file, by land area. The basis field says which measure was used.
Can I get every ZIP code in a county?
Yes: GET /v1/county/{fips}/zips, for example /v1/county/06085/zips for Santa Clara County.
What about ZIP codes with no area, like PO boxes?
A ZIP code without a delivery area (PO boxes, and ZIP codes for a single organisation) has no land to split, so counties is an empty array and county is the county of the point it is published at.
More
- Full API reference: every endpoint, error and header.
- No code needed? What county am I in?.
- ZIP code API
- Free ZIP code API
- ZIP code radius API
- ZIP code distance API