Boundaries API - get geometry and hierarchy

Administrative, political, postcode and other boundaries

Try lower-level subdivisions with our Playground or get an API key and start using it now! We have a Freemium pricing model. Start now for Free and extend when you need it!

Features and options

Boundaries API endpoints and parameters

Get boundaries the location is part of

Part Of - boundaries the location belongs to

The API endpoint lets to query all the boundaries the specified location belongs to. For example, get a county, state, and country for a city or coordinates.

API Documentation >>

Get boundaries the location is consists of

Consists Of - subdivisions of the location

Get all boundaries that belong to the specified location. Choose a level and boundary types. For example, get all states or counties of a country, districts or neighborhoods of a city.

API Documentation >>

Boundary types

The API support multiple boundary types - administrative, political, postcode, low emmision zones and other boundaries.

Geometry accuracy

The API allows to optimize responce size by choosing an accuracy of returned geometry. Moreover, you can query boundary details and get original geometry, polulation data and more with Place Details API.

GeoJSON as result

The API returns GeoJSON object as a result that can be natively visualized by client map libraries - MapLibre GL, Leaflet, OpenLayers.

Contact us if functionality required for your business case is missing in the current APIs! We will be happy to extend it!

Getting started

Works via HTTP and returns a GeoJSON object

Step 1. Register and get an API Key

You will require an API Key to use the API. Register on MyProject Geoapify and get an API key.

Step 2. Generate and call HTTP Get request

Generate an HTTP Get request with input data and make the call. Use our Playground and Documentation learn about Boundaries API request/response structure.

Boundaries API can be called with Latitude, Longitude coordinates or with a place id parameter returned by Geocoding API or Places API.

Here is an example of a "consists of" API request:


fetch("https://api.geoapify.com/v1/boundaries/consists-of?id=51ecbccfa440182740598d7dd2e49a134840f00101f901dcf3000000000000&geometry=geometry_1000&apiKey=YOUR_API_KEY")
.then(resp => resp.json())
.then((boundariesGeoJSON) => {
	console.log(boundariesGeoJSON);
});

FAQ

Can I store boundaries I received?

Yes, we allow storing data on your side. But please do not forget about the required OpenStreetMap attribution. By default, the attribution is provided as a part of the result object. If you are on a Free plan, please also provide a "follow" link on your website to attribute Geoapify as data provider: Powered by Geoapify.

How much does the Boundaries API cost? Which volumes are included to the Free plan?

The API is counted as a "geocoding & places" request. Depending on geometry type and the number of results 1 API call can be counted as multiple requests. You can find more details in the Boundaries API documentation. The Free plan includes 100.000 requests.

The API does not provide Postcode boundaries for my country. Can you add them?

As Postcodes(ZIP-codes) are not boundaries in nature, they are not present as boundaries for some countries. However, we have the postcode data. Contact us and we will find a solution for your business case!

Which data source do you use for the Boundaries API?

The OpenStreetMap database is the main source for the API. We enrich the data with other Open data sources when it's required.

How can I get original geometry for a boundary?

The Boundaries API provides simplified geometry for the boundaries to optimize response time and size. You can get original geometry for a boundary with the Place Details API by requesting the "details.full_geometry" feature.

Looking for a way to get boundaries data?

Try Geoapify Boundaries API! Get an API Key and start now!