The API has two top-level endpoints:

  • Boundary sets: see what groups of boundaries are available
  • Boundaries: find boundaries by latitude and longitude and draw boundaries

All endpoints output JSON.


Results are paginated 20 per page by default. Set the number of results per page by adding a limit query parameter. Change pages using the offset query parameter or using the next and previous links under the meta field in the response to navigate to the next and previous pages (if any). Under the meta field, total_count is the number of results. For example:

  "objects": [
  "meta": {
    "total_count": 300,
    "next": "/boundaries/?limit=20&offset=20",
    "offset": 0,
    "limit": 20,
    "previous": null

Filtering results

Filter results with query parameters. Each endpoint below lists the fields on which you can filter results. To filter for boundaries with the name “Toronto”, for example, request /boundaries/?name=Toronto.

Perform substring searches by appending __querytype to the parameter name, where querytype is one of:

  • iexact
  • contains or icontains
  • startswith or istartswith
  • endswith or iendswith
  • isnull

A leading i makes the search case-insensitive. For example, to find boundaries with a name starting with “M” or “m”, request /boundaries/?name__istartswith=m.


For a browsable, HTML version of the JSON response, add a format=apibrowser query parameter. Add pretty=1 to just indent the raw JSON. When using format=apibrowser, the pretty parameter and any JSONP parameter are ignored.

Cross-domain requests

JSONP is supported – just add a callback query parameter.

To enable CORS, add an Access-Control-Allow-Origin header by setting BOUNDARIES_ALLOW_ORIGIN to * in my_project/

Boundary sets

A boundary set is a group of boundaries.

  • Get one page of boundary sets' summaries

  • Get one boundary set's details

  • Filter boundary sets by name or domain


To see responses to these API requests, try them on


  • Get one page of boundaries' summaries

  • Get one page of boundaries from a boundary set

  • Get one page of boundaries from multiple boundary sets (comma-separated)

  • Get one boundary's details

  • Filter boundaries by name or external_id


While the sets query parameter can be used on any boundary endpoint, it only makes sense on the top-level endpoint.

To see responses to these API requests, try them on

Geospatial queries

  • Find boundaries by latitude and longitude

  • Find boundaries that touch

  • Find boundaries that intersect (“covers or overlaps” in PostGIS lingo)


The intersects query parameter will always return the filtering boundary, since it intersects itself.

To see responses to these API requests, try them on

Drawing boundaries

The default geospatial output format is GeoJSON. Add a format=kml or format=wkt query parameter to get KML or Well-Known Text.

The simple_shape endpoint simplifies the shape, looks fine and loads fast. Represent Boundaries uses a tolerance of 0.0002 by default to simplify the shape. You can change the tolerance by setting BOUNDARIES_SIMPLE_SHAPE_TOLERANCE in my_project/ If you change the tolerance, run loadshapefiles with the --reload switch.

  • Get all simple shapes

  • Get all original shapes

  • Get all centroids

  • Get all simple shapes from a boundary set

  • Get all original shapes from a boundary set

  • Get all centroids from a boundary set

  • Get one boundary's simple shape

  • Get one boundary's original shape

  • Get one boundary's centroid


The API will by default not return more than 350 geospatial results, to avoid slow queries. This limit can be configured by setting BOUNDARIES_MAX_GEO_LIST_RESULTS in my_project/

To see responses to these API requests, try them on