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


Using the APIs

All data within the Bus Open Data Service can be queried and accessed via API calls. A different API call is required for each type of data (timetables, bus location).

API Key

Use of the APIs 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 register before you can access your API key.

Data updates

Data is updated and cached on the service. This is what is provided using the API. You will need to cache the data to generate historical data.

Data type Cache type Update rate
Timetables Static Updates every 24 hours around 06:00 GMT
Fares data Static Updates every 24 hours around 06:00 GMT
Bus location data Real time Every 5 seconds

Timetables data

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