NewConnect Claude, Gemini, ChatGPT, and other AI agents to API Ninjas via our MCP server

County API

The County API enables you to look up detailed information for every county in the United States. You can search using various parameters including county name, ZIP code, or state.

(4.6)

From 2,421 users

3,000+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
388ms421ms462ms754ms1125ms

Didn't find what you were looking for? Suggest an improvement


/v1/county GET

https://api.api-ninjas.com/v1/county

Returns details for one or more counties matching the input parameters. For premium users, you can also specify the limit and offset parameters to paginate through results.

Parameters

At least one of the following parameters (except limit and offset) must be set:

  • county  optional

    Full name of the county to search.

  • zipcode  optional

    5-digit ZIP code to search.

  • state  optional

    2-letter state code (case-insensitive).

  • limit  optional  premium only

    Number of results to return. Must be between 1 and 30. Default is 1.

  • offset  optional  premium only

    Number of results to offset for pagination. Default is 0.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON array of objects, each containing the following fields, or an error if the request is unsuccessful.

  • county_name

    Name of the county.

  • county_fips

    FIPS (Federal Information Processing Standards) code for the county.

  • state_code

    2-letter state code.

  • state_name

    Full name of the state.

  • latitude  premium only

    Latitude coordinate of the centroid of the county.

  • longitude  premium only

    Longitude coordinate of the centroid of the county.

  • timezone

    Timezone of the county (e.g., "America/Los_Angeles").

  • zip_codes  premium only

    Array of ZIP codes within the county.

  • population

    County population count.

  • median_age

    Median age of the county population.

Sample Request Live Demo!

county

Try this API endpoint with all available parameters in our API playground

https://api.api-ninjas.com/v1/county?county=Multnomah County

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON
[
    {
      county_name:"Multnomah County",
      county_fips:"41051",
      state_code:"OR",
      state_name:"Oregon",
      latitude:"45.5468",
      longitude:"-122.4149",
      timezone:"America/Los_Angeles",
      zip_codes:[
        "97009",
        "97010",
        "97014",
        "97019",
        "97024",
        "97030",
        "97034",
        "..."
      ],
      population:803863,
      median_age:38.5
    }
]

Code Examples

1 2 curl -X GET "https://api.api-ninjas.com/v1/county?county=Multnomah%20County" \ -H "X-Api-Key: YOUR_API_KEY"

If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.

Frequently Asked Questions

  • Yes, but you must have a premium subscription. Commercial use of the County API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.
  • Sign up for a free account to instantly get your API key, then pass it in the X-Api-Key header on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.
  • Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.
  • The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.
  • Send a GET request to /v1/county with at least one of the county (full county name), zipcode (5-digit ZIP code), or state (2-letter state code) parameters set. For broader location lookups you can also try the City API or Zip Code API.
  • Each result returns fields such as county_name, county_fips, state_code, state_name, timezone, population, and median_age, while latitude, longitude, and the zip_codes array are available to premium subscribers.
  • Yes. Premium users can set the limit parameter (between 1 and 30, default 1) along with the offset parameter to paginate through results; see pricing for plan details.
  • It is useful for enriching addresses with FIPS codes via county_fips, building demographic dashboards using population and median_age, or mapping ZIP codes to counties; pair it with the Property Tax API for location-based financial tools or browse all API Ninjas APIs.