Search boundaries
Finds administrative boundaries (countries, states, counties, cities, districts), postcode areas and airports by name, in any language; an airport also by its IATA or ICAO code ("JFK", "EGLL"), returned first with kind airport, an outline you can pass to get_boundary like any boundary. Filter by country, kind or admin_level; bias toward a point with near. Free and public. A name we hold (the place's own name or a translation, optionally followed by ", <where it lies>" such as "Paris, France" or "Springfield, IL") is answered from our own index with no upstream call; anything else is looked up in OpenStreetMap. A US ZIP code ("11249", "11249-1234", "ZIP 11249") returns its ZIP code area first, id zcta-<code> and kind postal_code, from the Census Bureau's ZCTAs (OpenStreetMap does not map US ZIP codes); without a country, other countries' postcodes with the same digits follow it. A ZIP code with no area of its own (a PO box) is answered as a located point. A neighbourhood OpenStreetMap maps only as a point ("Williamsburg, Brooklyn") returns its outline from Who's On First (id wof-…, kind neighbourhood), after any boundaries of the same name. Time zones and maritime zones are boundaries too, from our own copy with no upstream call: an IANA name ("America/New_York") or "time zone Berlin" returns the time zone (id tz-…, kind timezone, from timezone-boundary-builder), and "EEZ France" or kind=eez with a country name the Exclusive Economic Zones (id eez-…, kind eez, from Marine Regions); kind=timezone with any word of a zone name searches time zones. US Census areas are boundaries too, from our own copy (source us_census): a congressional district by its code ("NY-10", "CA-AL", kind congressional_district), and metro areas ("Austin metro area", "New York-Newark-Jersey City", kinds metro_area, micro_area, combined_statistical_area), school districts ("Los Angeles Unified School District", kind school_district) and census-designated places (unincorporated communities such as "Brandon, FL", kind census_place) by name; naming the family or passing its kind returns only those, while a plain place name lists them after the boundaries OpenStreetMap names so, never ahead of a city. The UK's electoral wards, Westminster constituencies and 2021 census areas (LSOA, MSOA) come from the ONS (id ons-<GSS code>, kinds ward, constituency, census_area): a GSS code ("E14001290"), "<name> constituency" or "<name> ward", or kind=constituency|ward|census_area with a name or its start, answers them; a plain name lists at most three of them named exactly so after the places it found, never instead of them. Returns candidates with id, kind, admin_level, country, parents, bbox, centroid and population, but no polygon: pass the id to get_boundary for that. Choose by kind: admin_level is OpenStreetMap's number and is null for a result whose level we do not hold. A street address or a landmark is not a boundary: when nothing is named that but the text matched one, located gives its point (name, kind, lat, lon) and results are the boundaries containing that point, most local first, with matched: "containing" (country, state, county, city: no reverse_boundaries call needed), or empty with a hint to call reverse_boundaries where we hold none there; for the shape of a park, reef or region with no boundary, use create_area. When nothing at all matched, results is empty with a hint naming the call that gets somewhere instead (a city or district name, reverse_boundaries, create_area); do not retry other spellings of a shop or street. A city OpenStreetMap maps only as a point under another name ("Christchurch" inside "Christchurch City") returns the boundaries containing it with matched: "containing" and a hint; check the first result is the area meant. Searches we do not hold (every street address, a name nobody asked before) share OpenStreetMap's one request a second with every caller: send them one at a time, not in parallel. While OpenStreetMap's search is down or that queue is full, a name nobody searched before is answered from the boundaries already cached under it, marked partial: true with retry_after and a hint (others with the same name may be missing), or 503 upstream_unavailable or upstream_busy with retry_after when none is cached.
MCP tool search_boundaries · CLI geocode search-boundaries · RPC POST /v1/ops/search_boundaries
Input
| Field | Type | Description |
|---|---|---|
qquery, required | string | A place name, e.g. "Berlin", "Alameda County", "75011". A street address returns located (its point) and the boundaries containing it as results. |
countryquery | string | Limit to countries: ISO 3166-1 alpha-2, comma-separated (e.g. US or de,at,ch). |
kindquery | "country" | "state" | "region" | "province" | "county" | "district" | "municipality" | "city" | "borough" | "ward" | "neighbourhood" | "postal_code" | "airport" | "timezone" | "eez" | "metro_area" | "micro_area" | "combined_statistical_area" | "congressional_district" | "school_district" | "census_place" | "constituency" | "census_area" | Only this kind (normalized across countries): country, state, region, province, county, district, municipality, city, borough, ward, neighbourhood, postal_code, airport, timezone (IANA time zones), eez (Exclusive Economic Zones), and in the US metro_area, micro_area, combined_statistical_area, congressional_district, school_district, census_place (census-designated places, unincorporated communities), and in the UK constituency (Westminster constituencies) and census_area (LSOAs and MSOAs). |
admin_levelquery | integer | Only this OSM admin_level (2 = country; meaning varies by country below that). Leaves out results whose level we do not hold; prefer kind. |
nearquery | string | lat,lon to prefer results near, e.g. 37.77,-122.42. |
limitquery | integer | At most this many results (1–40, default 10). Default 10. |
Example request
curl "https://geocodeai.dev/v1/boundaries/search?q=Alameda%20County&country=US"Example response
Errors
Failures are RFC 9457 problems. Common ones here: 400 invalid_input, 429 rate_limited.