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


API reference

The API reference contains details of API calls, query parameters and error codes. You can try out API calls in an interactive sandbox, Access interactive API.

All data API reference

You can use the call all data APIs in your code. This will provide all data currently available.

Data Call all data APIs
Timetables https://data.bus-data.dft.gov.uk/api/v1/dataset/?api_key=[API_KEY]
Bus location https://data.bus-data.dft.gov.uk/api/v1/datafeed/?api_key=[API_KEY]
Fares https://data.bus-data.dft.gov.uk/api/v1/fares/dataset/?api_key=[API_KEY]

Timetables data API parameters

Data sets provided may contain multiple TransXChange files. Therefore, query parameters will return any data sets which contains at least one TransXChange file that satisfies your query parameters.

Name Description
adminArea adminArea is a field within the data, and therefore if any of the TransXChange files within a specific data set has the specified adminArea the whole data set will be returned. A list of adminAreas can be found on the NPTG website: https://data.gov.uk/dataset/3b1766bf-04a3-44f5-bea9-5c74cf002e1d/national-public-transport-gazetteer-nptg
endDateStart Limit results to data sets with services with end dates after this date. String formatted as YYYY-MM-DDTHH:MM:SS.
endDateEnd Limit results to data sets with services with end dates before this date. String formatted as YYYY-MM-DDTHH:MM:SS.
limit The maximum number of records to return.
modifiedDate Limit results to data sets that have been created/updated since the specified date. String formatted as YYYY-MM-DDTHH:MM:SS.
noc Input a comma separated list of National Operator Codes to limit results to data sets of the publishers associated to the specified National Operator Code. A publisher may have multiple National Operator Codes associated with it. Your response will include data for all National Operator Codes associated with that publisher. Not just those included in the query parameter. National Operator codes can be found on the Traveline website, https://www.travelinedata.org.uk/traveline-open-data/transport-operations/about-2/
offset Return results that match the query starting from the specified offset. e.g. &offset=10&limit=25 returns results from 11 to 36. The default is set to 0.
search Return data sets where the data set name, data set description, organisation name, or admin area name contain the specified value.
status Limit results to data sets with the specified status String, accepted values are published, error, expired.
startDateStart Limit results to data sets with services with start dates after this date. String formatted as YYYY-MM-DDTHH:MM:SS.
startDateEnd Limit results to data sets with services with start dates before this date. String formatted as YYYY-MM-DDTHH:MM:SS.
datasetID ID of dataset to return.
boundingBox Limit results to timetables data sets that contain information for the area within the rectangular boundingBox you set using co-ordinates: minLongitude, minLatitude, maxLongitude, maxLatitude.

Fare data API parameters

Data sets provided may contain multiple NeTEx files. Therefore, query parameters will return all data sets which contain at least one NeTEx file that satisfied your query parameters.

Name Description
noc Input a comma separated list of National Operator Codes to limit results to data sets of the publishers associated to the specified National Operator Code. A publisher may have multiple National Operator Codes associated with it. Your response will include data for all National Operator Codes associated with that publisher. Not just those included in the query parameter. National Operator codes can be found on the Traveline website, https://www.travelinedata.org.uk/traveline-open-data/transport-operations/about-2/ .
status Limit results to data sets with the specified status. Accepted values are: published and inactive.
boundingBox Limit results to fares data sets that contain information for the area within the rectangular boundingBox you set using co-ordinates: minLongitude, minLatitude, maxLongitude, maxLatitude.
operator Limit results to data sets which contain data with the specified operator. The National Operator Code (noc) is used as the input for this by operators and all codes can be found on the Traveline website: https://www.travelinedata.org.uk/traveline-open-data/transport-operations/about-2/ .

Bus location data API parameters

Bus location data is provided within feeds. The metadata query parameters noc and status will return whole feeds. Whereas the other query parameters will only return the bus location data that satisfies your chosen parameters.

Name Description
noc Input a comma separated list of National Operator Codes to limit results to bus location data of the publishers associated to the specified National Operator Code. A publisher may have multiple National Operator Codes associated with it. Your response will include data for all National Operator Codes associated with that publisher. Not just those included in the query parameter. National Operator codes can be found on the Traveline website, https://www.travelinedata.org.uk/traveline-open-data/transport-operations/about-2/
status

Limit results to bus location data with the specified status. Accepted values are published, error or deactivated. Bus location data will only be returned for data with a published status. Feeds with an error or deactivated status are not providing data and will just return the data feed ID.

A feed is in an error state if no heartbeat has been received or the feed cannot re-connect for over 5 minutes from 7am - 9pm.

boundingBox Limit results to bus location data with vehicle position within the rectangular bounding box you set using co-ordinates: minLongitude, minLatitude, maxLongitude, maxLatitude.
operatorRef Limit results to data feeds with the operatorRef. The National Operator Code is often used by publishers as the input for operatorRef, which can be found on the Traveline website, https://www.travelinedata.org.uk/traveline-open-data/transport-operations/about-2/
lineRef Limit results to bus location data with the specified Line Ref.
producerRef Limit results to bus location data with the specified Producer Ref.
originRef Limit results to bus location data with the specified Origin Ref. Inputs for Origin Ref are normally National Public Transport Access Nodes (NaPTAN), which can be found on the following website: https://data.gov.uk/dataset/ff93ffc1-6656-47d8-9155-85ea0b8f2251/national-public-transport-access-nodes-naptan
destinationRef Limit results to bus location data with the specified Destination Ref. Inputs for Destination Ref are normally National Public Transport Access Nodes (NaPTAN), which can be found on the following website: https://data.gov.uk/dataset/ff93ffc1-6656-47d8-9155-85ea0b8f2251/national-public-transport-access-nodes-naptan
Previous Using the APIs
Next Data formats

Other development resources