Overview
Finds shortest/fastest route between a start point and one or more stop points on British Columbia's public road network. The BC Route planner [webpage](https://www2.gov.bc.ca/gov/content?id=9D99E684CCD042CD88FADC51E079B4B5) provides additional information. Here are some geocoded addresses to play with:<br>18 Douglas St,Victoria -123.36962,48.40892<br>1002 Johnson St, Victoria -123.355745,48.426206<br>543 Johnson St, Victoria, BC -123.36907,48.42770 <br>14 Centennial Sq, Victoria, BC -123.36564,48.42863<br>1105 Royal Ave,New Westminster -122.92009,49.20063<br>808 Jackson Cres, New Westminster -122.90762,49.22558<br>10810 McDonald Rd, Chilliwack -121.93808,49.19859<br>3950 June Springs Rd, Kelowna -119.40751,49.83960<br>1201 Riondel Rd, Kootenay Bay -116.85402,49.74448<br>1201 Riondel Rd, Kootenay Bay -116.832759,49.730500 (parcelPoint)<br>2499 Walbran Pl, Courtenay -124.97295,49.71518<br>2013 Smoke Bluff Rd, Squamish -123.13946,49.70401<br>235 Kelvin Grove Way, Lions Bay -123.23524,49.45035<br> Please see our <a href=https://github.com/bcgov/api-specs/blob/master/COLLECTION_NOTICE.md#collection-notice target="_blank">data collection notice</a>. Please note that you may experience issues when submitting requests to the delivery or test environment if using this [OpenAPI specification](https://github.com/bcgov/api-specs) in other API console viewers. [API keys](https://api.gov.bc.ca/devportal/api-directory/740) are unique and can be acquired with a GitHub or IDIR account.
BC Route Planner REST API is an open data API from gov.bc.ca. Requests are authenticated with an API key. It is served over HTTPS. Its OpenAPI description documents 24 endpoints.
At a glance
- Authentication
- API key
- HTTPS
- Yes
- CORS
- Unknown
- Category
- Open Data
- Base URL
https://router.api.gov.bc.ca/- Version
- 2.0.0
- Endpoints
- 24
- OpenAPI
- Specification ↗
- Spec updated
- 2023-03-06
Make a first request
Replace the placeholders; the documentation says exactly where credentials go.
curl -X GET "https://router.api.gov.bc.ca/directions.OUTPUTFORMAT" \
-H "Accept: application/json" \
-H "X-API-Key: YOUR_API_KEY"const response = await fetch("https://router.api.gov.bc.ca/directions.OUTPUTFORMAT", {
method: "GET",
headers: {
"Accept": "application/json",
"X-API-Key": "YOUR_API_KEY",
},
});
const data = await response.json();
console.log(data);import requests
response = requests.request(
"GET",
"https://router.api.gov.bc.ca/directions.OUTPUTFORMAT",
headers={
"Accept": "application/json",
"X-API-Key": "YOUR_API_KEY",
},
timeout=30,
)
print(response.json())Endpoints
| Method | Path | What it does |
|---|---|---|
| GET | /directions.{outputFormat} | Get the directions, path, distance and travel time between a series of geographic points |
| POST | /directions.{outputFormat} | Get the directions, path, distance and travel time between a series of geographic points |
| GET | /distance.{outputFormat} | Get distance and travel time between two geographic points |
| POST | /distance.{outputFormat} | Get distance and travel time between two geographic points |
| GET | /distance/betweenPairs.{outputFormat} | Get distance and travel time between each pair of geographic points |
| POST | /distance/betweenPairs.{outputFormat} | Get distance and travel time between each pair of geographic points |
| GET | /optimalDirections.{outputFormat} | Get the directions, optimal path, distance and travel time between a start point and a series of end points which are reordered to minimize total distance or ti |
| POST | /optimalDirections.{outputFormat} | Get the directions, optimal path, distance and travel time between a start point and one or more end points which are reordered to minimize total distance or ti |
| GET | /optimalRoute.{outputFormat} | Get the optimal path, distance and travel time between a start point and a series of end points which are reordered to minimize total distance or time. |
| POST | /optimalRoute.{outputFormat} | Get the path, distance and travel time between a start point and a series of end points which are reordered to minimize total distance or time. |
| GET | /route.{outputFormat} | Get the path, distance and travel time between a series of geographic points |
| POST | /route.{outputFormat} | Get the path, distance and travel time between a series of geographic points |
| GET | /truck/directions.{outputFormat} | Get the directions, path, distance and travel time between a series of geographic points for a commercial vehicle |
| POST | /truck/directions.{outputFormat} | Get the directions, path, distance and travel time between a series of geographic points |
| GET | /truck/distance.{outputFormat} | Get distance and travel time between two geographic points for a commercial vehicle |
| POST | /truck/distance.{outputFormat} | Get distance and travel time between two geographic points |
| GET | /truck/distance/betweenPairs.{outputFormat} | Get distance and travel time between each pair of geographic points for a commercial vehicle |
| POST | /truck/distance/betweenPairs.{outputFormat} | Get distance and travel time between each pair of geographic points |
| GET | /truck/optimalDirections.{outputFormat} | Get the directions, optimal path, distance and travel time between a start point and a series of end points which are reordered to minimize total distance or ti |
| POST | /truck/optimalDirections.{outputFormat} | Get the directions, optimal path, distance and travel time between a start point and one or more end points which are reordered to minimize total distance or ti |
| GET | /truck/optimalRoute.{outputFormat} | Get the optimal path, distance and travel time between a start point and a series of end points which are reordered to minimize total distance or time for a com |
| POST | /truck/optimalRoute.{outputFormat} | Get the path, distance and travel time between a start point and a series of end points which are reordered to minimize total distance or time. |
| GET | /truck/route.{outputFormat} | Get the path, distance and travel time between a series of geographic points for a commercial vehicle |
| POST | /truck/route.{outputFormat} | Get the path, distance and travel time between a series of geographic points |
Questions
Does the BC Route Planner REST API API need an API key?
Yes. The BC Route Planner REST API API uses API key authentication; the documentation explains how to get credentials.
Does the BC Route Planner REST API API support HTTPS?
Yes, the BC Route Planner REST API API is served over HTTPS.
How many endpoints does the BC Route Planner REST API API have?
Its OpenAPI description lists 24 endpoints in version 2.0.0. All of them are shown on this page.
What are alternatives to the BC Route Planner REST API API?
Other Open Data APIs include Search Services, Wayback API, Wikipedia, Nasdaq Data Link, University of Oslo.
Similar open data APIs
Compare alternatives →Search Services
Open DataAPI for Internet Archive's Search-related services
Wayback API
Open DataAPI for Internet Archive's Wayback Machine
Wikipedia
Open DataMediawiki Encyclopedia
Nasdaq Data Link
Open DataThe source for financial, economic, and alternative datasets, serving investment professionals.
University of Oslo
Open DataCourses, lecture videos, detailed information for courses etc. for the University of Oslo (Norway)
Data API
Open DataServes the Clever Data API
Listed from APIs.guru (CC0).