Find boundaries containing a place
Signed in? Open this endpoint in the dashboard playground, which uses your organization automatically. Signed out, use Try in Playground below with your API key.
Find boundaries that contain one place. Use exactly one lookup method: a Place id (recommended), a lat and lon pair, or an osm_id and osm_type pair; combining methods or giving none returns 400. Use boundaries to restrict the returned boundary types and geometry to choose representative points or simplified boundary polygons.
Data layers: administrative (OpenStreetMap admin_level 2 to 11, Nominatim placex); postal_code (Census ZCTA5 for the US, StatCan FSA for Canada); timezone (timezone-boundary-builder, place_id gp:tz:<tzid>); and OpenStreetMap polygons for neighborhood, place, region, political, historic, protected_area (includes leisure=nature_reserve), national_park (boundary=national_park, or a nature reserve named "... National Park"), aboriginal_lands, census, school_district, forest, hazard, regional_park, religious_administration, low_emission_zone, public_transport and traditional. Coverage is the US and Canada.
Deviation (empty): the types religious, municipality, barony, town, health and historic:administrative are accepted and validated but have no data layer, so they never contribute features. The response lists every requested type in layers (layer: false for these), and when any such type is requested it carries an X-Boundaries-Note header. A layer with data can still contribute nothing at a given point (layer: true, within: 0).
Deviation (extra): boundaries accepts the extra types protected_area, national_park, aboriginal_lands, census, school_district, forest, hazard and regional_park, and the special value all; there is no cap on the number of types (Geoapify allows 10). The response adds a top-level layers summary and a boundary_type property on each feature.
Deviation (extra): datasource and place_id follow our own formats (see the property docs); datasource.attribution carries the licence attribution that must be shown to end users.
Deviation (empty): Geoapify's optional descriptive fields (formatted, address_line1, address_line2, categories, name_international, name_other, website, population, and the descriptive timezone property object, ...) are never returned. (A timezone boundary feature is different: it is returned when you request boundaries=timezone.) Address fields are limited to name, continent, country, country_code, state, state_code, iso3166_2, county, county_district, city, city_district, suburb, neighbourhood, postcode, postal_code, lon, lat, place_id, datasource.
Deviation (unsupported): id accepts only Place IDs of kind gp:osm: and gp:pc:. IDs of kind gp:addr:, gp:iso: and gp:tz: (and Geoapify's hex place IDs) are not resolved and return an empty FeatureCollection with layers within 0 (malformed gp: IDs return 400). gp:tz:<tzid> appears as the place_id of timezone features but does not resolve as an id.
Not supported: none of Geoapify's parameters for this endpoint are removed; all are read.
Example: GET /boundaries/part-of?lat=39.7684&lon=-86.1581&apiKey=YOUR_API_KEY returns the administrative boundaries containing downtown Indianapolis (city, township, county, state, country).
apiKey<token>Your API key from the dashboard, sent as ?apiKey=<key>.
id?stringDeviation (unsupported): Geoapify hex place IDs are not accepted by this service; gp:addr, gp:tz and gp:iso IDs return an empty result (gp:tz:<tzid> is returned as place_id on timezone features but does not resolve as an id).
3 <= length <= 2048lat?numberLatitude of the place. Alternative to id; provide together with lon.
-90 <= value <= 90lon?numberLongitude of the place. Alternative to id; provide together with lat.
-180 <= value <= 180osm_id?integerNumeric OpenStreetMap object identifier. Alternative to id; use together with osm_type.
1 <= valueosm_type?stringOpenStreetMap object type used with osm_id: n for node, w for way, or r for relation (case-insensitive).
"r""w""n"boundaries?array<|string|>Boundary types to return. Multiple values are comma-separated; duplicates are collapsed and there is no cap on the number of types. Defaults to administrative when omitted. The special value all (not an enum item) expands to every type below, including the types without a data layer.
Deviation (extra): protected_area, national_park, aboriginal_lands, census, school_district, forest, hazard and regional_park are our additions, and all is ours; Geoapify caps the list at 10 types.
Deviation (empty): religious, municipality, barony, town, health and historic:administrative are accepted but have no data layer (layer: false in the response layers).
1 <= itemsgeometry?stringGeometry representation for returned boundaries. point returns representative points and is the default. The geometry_* values return simplified Polygon or MultiPolygon geometry at the specified accuracy in meters.
Deviation (approximated): simplification uses PostGIS ST_SimplifyPreserveTopology with a tolerance of N meters converted to degrees (N / 111320), so accuracy differs slightly from Geoapify's.
"point""point""geometry_1000""geometry_5000""geometry_10000"lang?stringLanguage used for boundary names and address fields (ISO 639-1). Uses the OSM name:<lang> tag and falls back to the default name when a boundary has no translation.
"en""ab""aa""af""ak""sq""am""ar""an""hy""as""av""ae""ay""az""bm""ba""eu""be""bn""bh""bi""bs""br""bg""my""ca""ch""ce""ny""zh""cv""kw""co""cr""hr""cs""da""dv""nl""en""eo""et""ee""fo""fj""fi""fr""ff""gl""ka""de""el""gn""gu""ht""ha""he""hz""hi""ho""hu""ia""id""ie""ga""ig""ik""io""is""it""iu""ja""jv""kl""kn""kr""ks""kk""km""ki""rw""ky""kv""kg""ko""ku""kj""la""lb""lg""li""ln""lo""lt""lu""lv""gv""mk""mg""ms""ml""mt""mi""mr""mh""mn""na""nv""nb""nd""ne""ng""nn""no""ii""nr""oc""oj""cu""om""or""os""pa""pi""fa""pl""ps""pt""qu""rm""rn""ro""ru""sa""sc""sd""se""sm""sg""sr""gd""sn""si""sk""sl""so""st""es""su""sw""ss""sv""ta""te""tg""th""ti""bo""tk""tl""tn""to""tr""ts""tt""tw""ty""ug""uk""ur""uz""ve""vi""vo""wa""cy""wo""fy""xh""yi""yo""za"Boundaries containing the requested place (possibly an empty FeatureCollection).
application/json- response
GeoJSON FeatureCollection of the boundaries that contain the requested place, smallest first (administrative), then postal codes. Empty features when nothing matches, every requested type has no data layer, or the Place ID has no boundary geometry.
type*unknownfeatures*array<>layers?array<>One entry per requested type: layer = a data layer exists; within = how many of its boundaries contain the point.
curl -X GET 'https://api.data.graphitelab.ai/v1/boundaries/part-of?id=gp%3Aosm%3Ar161816&lat=39.7684&lon=-86.1581&osm_id=161816&osm_type=r&boundaries=administrative%2Cpostal_code&geometry=point&lang=en'{ "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "name": "Indianapolis", "country": "United States", "continent": "North America", "country_code": "us", "state": "Indiana", "state_code": "IN", "iso3166_2": "US-IN", "county": "Marion County", "county_district": "Center Township", "city": "Indianapolis", "lon": -86.0932472869693, "lat": 39.7798447, "place_id": "gp:osm:r18438530", "datasource": { "sourcename": "openstreetmap", "attribution": "© OpenStreetMap contributors", "license": "Open Database License", "url": "https://www.openstreetmap.org/copyright", "raw": { "osm_id": 18438530, "osm_type": "r", "admin_level": 8, "wikidata": "Q6346", "wikipedia": "en:Indianapolis" } } }, "geometry": { "type": "Point", "coordinates": [ -86.093247, 39.779845 ] }, "bbox": [ -86.3281207, 39.6321626, -85.9380401, 39.9275253 ] }, { "type": "Feature", "properties": { "name": "Center Township", "country": "United States", "continent": "North America", "country_code": "us", "state": "Indiana", "state_code": "IN", "iso3166_2": "US-IN", "county": "Marion County", "county_district": "Center Township", "lon": -86.13982193886923, "lat": 39.75229160000001, "place_id": "gp:osm:r21364355", "datasource": { "sourcename": "openstreetmap", "attribution": "© OpenStreetMap contributors", "license": "Open Database License", "url": "https://www.openstreetmap.org/copyright", "raw": { "osm_id": 21364355, "osm_type": "r", "admin_level": 7, "wikidata": "Q5059398", "wikipedia": "en:Center Township, Marion County, Indiana" } } }, "geometry": { "type": "Point", "coordinates": [ -86.139822, 39.752292 ] }, "bbox": [ -86.1973736, 39.7216856, -86.0824946, 39.8255186 ] } ]}