OSRMRoute Boundaries API
Explore geographic areas, locate points within boundaries and connect your business data to the map.
Authentication
Catalog and layer details cost no credits. Polygon and full outline results cost 1 credit per started group of 5; metadata and point results cost 1 credit per started group of 100. Other operation rates are listed below. A paid plan and a boundary-scoped API key are required.
Authorization: Bearer YOUR_KEY| Operation | Credit calculation |
|---|---|
| Catalog and layer details | 0 credits · paid plan required |
| Single boundary and known ancestors | 1 credit per request |
| Point lookup | 1 credit per submitted point |
| Polygon or full boundary outline | 1 credit per started group of 5 returned results |
| Metadata or point representation | 1 credit per started group of 100 returned results |
| CSV join by ID/code | 1 credit per started group of 100 input records |
| Coordinate aggregation | 1 credit per submitted point |
| Territory merge | 2 credits per started group of 10 distinct input polygons |
| Vector tile | 0.5 credits per tile |
Pages and CSV joins have a 1-credit minimum; territory merges have a 2-credit minimum. A page reserves its maximum quote, then charges only the returned results and refunds the difference. A successful empty page costs 1 credit. Failed operations are fully refunded.
Connecting, selecting a layer/country, changing worldview and searching the API load up to 100 polygons: at most 20 credits per page. Exporting already loaded data in the browser has no additional charge.
API
The new API uses [longitude,latitude]. The existing /api/1/boundary keeps point=latitude,longitude.
| HTTP | URL |
|---|---|
| GET | /api/v1/boundaries |
| GET | /api/v1/boundaries/layers/{id} |
| GET | /api/v1/boundaries/features/{id} |
| GET | /api/v1/boundaries/metadata |
| GET | /api/v1/boundaries/query |
| GET | /api/v1/boundaries/export |
| POST | /api/v1/boundaries/lookup |
| POST | /api/v1/boundaries/aggregate |
| POST | /api/v1/boundaries/join |
| POST | /api/v1/boundaries/territories |
| GET | /api/v1/boundaries/tiles/{layer}/{z}/{x}/{y} |
Boundary capabilities
Explore boundaries
curl "https://osrmroute.com/api/v1/boundaries" \
-H "Authorization: Bearer YOUR_KEY"Country-specific layers
curl "https://osrmroute.com/api/v1/boundaries/query?layer=aze-administrative-2&limit=25&geometry=true" \
-H "Authorization: Bearer YOUR_KEY"Find the areas containing a point
curl "https://osrmroute.com/api/v1/boundaries/query?layer=aze-administrative-2&point=49.8671,40.4093" \
-H "Authorization: Bearer YOUR_KEY"GeoJSON and vector tiles
curl "https://osrmroute.com/api/v1/boundaries/export?layer=deu-administrative-1&limit=100" \
-H "Authorization: Bearer YOUR_KEY"Batch spatial queries
curl -X POST "https://osrmroute.com/api/v1/boundaries/lookup" \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"layer":"aze-administrative-2","points":[[49.8671,40.4093]]}'Regional reports
curl -X POST "https://osrmroute.com/api/v1/boundaries/aggregate" \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"layer":"aze-administrative-2","records":[{"point":[49.8671,40.4093],"value":12}]}'Connect your business data
curl -X POST "https://osrmroute.com/api/v1/boundaries/join" \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"layer":"aze-administrative-2","records":[{"id":"COPY_ID_FROM_QUERY","value":12}]}'Branch and territory planning
curl -X POST "https://osrmroute.com/api/v1/boundaries/territories" \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"layer":"aze-administrative-2","ids":["COPY_ID_FROM_QUERY"],"name":"My territory"}'Download source metadata
Download names, source codes, hierarchy and licenses as CSV. API export is paginated: retain the version and follow the next cursor.
GET /api/v1/boundaries/metadata?layer=aze-administrative-2&format=csv&limit=100Choose polygon, point or line in the export controls. Derived points lie on the polygon surface; lines follow polygon rings.
GET /api/v1/boundaries/export?layer=deu-administrative-1&representation=point&limit=100Coverage
Coverage differs by country and boundary type. Only imported layers are selectable.
Hierarchy returns known relationships only. Geometry-derived parents are not authoritative administrative confirmation; parentId is null when no relationship is known.
Boundaries are not legal or cadastral certification. Respect geometry simplification, represented year and layer extent. ZCTAs are not USPS delivery boundaries.
limit ≤ 100 · lookup ≤ 100 · aggregate / join ≤ 1000 · POST ≤ 128 KiB · geometry union ≤ 50,000 vertices · 60 requests/min/key
GeoJSON / CSV
boundary_id,value / unit_code,value or longitude,latitude,value · up to 1,000 records.
longitude,latitude,value\n49.8671,40.4093,12Records are processed for this API operation and are not stored. ID/code joins cost 1 credit per started group of 100 input records; coordinate aggregation costs 1 credit per input point.
HTTP
400 invalid_boundary_parameter / invalid_boundary_point\n401 bearer_required\n403 paid_plan_required / service_restricted\n404 boundary_layer_not_found / boundary_not_found\n409 boundary_version_unavailable\n413 body_too_large / boundary_response_too_large / boundary_operation_too_large\n422 boundary_query_too_broad\n429 rate_limited\n503 boundary_catalog_unavailable