This is a new service – your feedback will help us to improve it.

Developer documentation

What you need to know to find and use bus data published through the Bus Open Data Service.


Using the API

All data within the Bus Open Data Service can be queried and accessed via an API.

Use of the API requires an API key which can be obtained from Account Settings. This key is linked to your account and should not be shared. If you have not already done so you will need to create an account before you can access your API key.

To access the metadata associated with an individual data set, use the following API call:

https://data.bus-data.dft.gov.uk/api/v1/dataset/[DATASET_ID]/?api_key=[API_KEY]

where DATASET_ID is the id of the data set and API_KEY is your personal API key.

To search for data sets using the API, use the following API call:

https://data.bus-data.dft.gov.uk/api/v1/dataset/?[QUERY_PARAMS]&api_key=[API_KEY]

where QUERY_PARAMS are the query parameters as defined in the API reference and API_KEY is your personal API key.

Results are returned as JSON. For example,


{

  "id": 649,

  "created": "2019-11-19T15:23:22.334498Z",

  "modified": "2019-11-19T15:23:30.314457Z",

  "operatorName": "Operatoe",

  "noc": ["NOC1", "NOC2"],

  "name": "Operator_Cambridge_1|Citi_20191029_102",

  "description": "Line 1 services until Summer 2020",

  "comment": "First publication",

  "status": "published",

  "url": "https://operator.com/MyData/Line1.xml",

  "lines": ["1|Citi"],

 ; "firstStartDate": "2019-10-29T00:00:00Z",

  "firstEndDate": "2020-05-01T00:00:00+01:00",

  "lastEndDate": "2020-05-01T00:00:00+01:00",

  "admin_areas": [{
   "atco_code": "050",
   "name": "Cambridgeshire"
   },
   {
   "atco_code": "150",
   "name": "Essex"
   }],

  "localities": [
   {"gazetteer_id":"N0080359","name":"Addenbrooke's (Cambs)"},
   {"gazetteer_id":"N0061155","name":"Arbury (Cambs)"},
   {"gazetteer_id":"E0055326","name":"Cambridge (Cambs)"},
   {"gazetteer_id":"N0061157","name":"Cherry Hinton"},
   {"gazetteer_id":"N0061156","name":"Chesterton (Cambs)"},
   {"gazetteer_id":"E0043826","name":"Fulbourn"},
   {"gazetteer_id":"N0061158","name":"Kings Hedges"},
   {"gazetteer_id":"E0044128","name":"Teversham"},
  }]

}

The url parameter provides a link to the published data.

Previous Downloading data
Next API reference

Other development resources