Endpoints: Departures and Arrivals

The following set of endpoints allow you to get detailed information on train departures and arrivals for stations across the UK. There are 3 endpoints available here:


Endpoint Description
getDeparturesByCRS Shows train services departing from a specific station
getArrivalsByCRS Shows train services arriving to a specific station
getArrivalsAndDeparturesByCRS Shows train services arriving and departing from a specific train station


Get Departures by CRS

getDeparturesByCRS is used to get a list of services departing from a UK train station by the CRS (Computer Reservation System) code. This will typically return a list of train services, but will also return any replacement bus or ferry services that are in place.


HTTP Request

GET https://api.departureboard.io/api/v2.0/getDeparturesByCRS/{CRS}/


URL Parameters

Parameter Default Description
CRS
required
none The CRS (Computer Reservation System) for the station you wish to get departure information for, e.g. KGX for London Kings Cross.

Query Parameters

Parameter Default Description
apiKey
required
true none
numServices 10 The number of departing services to return. This is a maximum value, less may be returned if there is not a sufficient amount of services running from the selected station within the time window specified.
timeOffset 0 The time window in minutes to offset the departure information by. For example, a value of 20 will not show services departing within the next 20 minutes.
timeWindow 120 The time window to show services for in minutes. For example, a value of 60 will show services departing the station in the next 60 minutes.
serviceDetails true Should the response contain information on the calling points for each service? If set to false, calling points will not be returned.
filterStation none The CRS (Computer Reservation System) code to filter the results by. For example, performing a lookup for PAD (London Paddington) and setting filterStation to RED (Reading), will only show services departing from Paddington that stop at Reading.

Example Queries

Lookup departures from London Kings Cross, with default query parameters:
curl -X GET "https://api.departureboard.io/api/v2.0/getDeparturesByCRS/KGX/?apiKey=1234"

Lookup departures from London Kings Cross, showing 5 results:
curl -X GET "https://api.departureboard.io/api/v2.0/getDeparturesByCRS/KGX/?apiKey=1234&numServices=5"

Lookup departures from London Kings Cross, showing 5 results, including services from up to 20 minutes in the past:
curl -X GET "https://api.departureboard.io/api/v2.0/getDeparturesByCRS/KGX/?apiKey=1234&numServices=5&timeOffset=-20"


Example Response

curl -X GET "https://api.departureboard.io/api/v2.0/getDeparturesByCRS/KGX/?apiKey=1234&numServices=1"

Expand Response

{
"generatedAt": "2019-09-10T13:49:03.1769126+01:00",
"nationalRailResponseTimeMilliseconds": 127,
"locationName": "London Kings Cross",
"filterLocationName": null,
"filtercrs": null,
"filterType": null,
"crs": "KGX",
"nrccMessages": [
  {
    "message": "Additional trains to Great Northern destinations also operate from London St Pancras International (STP) which is a short walk from London Kings Cross."
  }
],
"platformAvailable": true,
"areServicesAvailable": null,
"trainServices": [
  {
    "serviceID": "FPhH5Dlqy19zPg8uHxCT1Q==",
    "serviceIDUrlSafe": "FPhH5Dlqy19zPg8uHxCT1Q--",
    "serviceType": "train",
    "isCancelled": null,
    "filterLocationCancelled": null,
    "cancelReason": null,
    "delayReason": null,
    "adhocAlert": null,
    "std": "13:48",
    "etd": "On time",
    "platform": "6",
    "operator": "Hull Trains",
    "operatorCode": "HT",
    "isCircularRoute": null,
    "length": null,
    "detachFront": null,
    "isReverseFormation": null,
    "rsid": null,
    "origin": [
      {
        "locationName": "London Kings Cross",
        "crs": "KGX",
        "via": null,
        "futureChangeTo": null,
        "assocIsCancelled": null
      }
    ],
    "destination": [
      {
        "locationName": "Hull",
        "crs": "HUL",
        "via": null,
        "futureChangeTo": null,
        "assocIsCancelled": null
      }
    ],
    "currentOrigins": null,
    "currentDestinations": null,
    "subsequentCallingPointsList": [
      {
        "subsequentCallingPoints": [
          {
            "locationName": "Grantham",
            "crs": "GRA",
            "st": "14:49",
            "et": "On time",
            "at": null,
            "length": null
          },
          {
            "locationName": "Hull",
            "crs": "HUL",
            "st": "16:18",
            "et": "On time",
            "at": null,
            "length": null
          }
        ]
      }
    ]
  }
],
"busServices": null,
"ferryServices": null
}


Notes

When the serviceDetails query parameter is set to true for getDeparturesByCRS, only subsequent calling points will be returned. This is by design from National Rail.

To get subsequent and previous calling points in the same response, use the getArrivalsAndDeparturesByCRS or getServiceDetailsByID endpoint.

It is possible to have two sets of subsequentCallingPoints returned for a service (when looking up train services that split).

Consequently, subsequentCallingPoints are returned in the subsequentCallingPointsList array.

However, in 99% of circumstances there are only 1 set of subsequentCallingPoints returned. For services that do not split, you can use subsequentCallingPointsList[0].subsequentCallingPoints to access the previous calling points. The Python Code Samples have examples of how this works.




Get Arrivals by CRS

getArrivalsByCRS is used to get a list of services arriving to a UK train station by the CRS (Computer Reservation System) code. This will typically return a list of train services, but will also return any replacement bus or ferry services that are in place.


HTTP Request

GET https://api.departureboard.io/api/v2.0/getArrivalsByCRS/{CRS}/


URL Parameters

Parameter Default Description
CRS
required
none The CRS (Computer Reservation System) for the Station you wish to get arrival information for, e.g. KGX for London Kings Cross.

Query Parameters

Parameter Default Description
apiKey
required
none The National Rail OpenLDBWS API Key to use for looking up service information. You must register with National Rail to obtain this key and whitelist it with us.
numServices 10 The number of arriving train services to return. This is a maximum value, less may be returned if there is not a sufficient amount of services running to this station within the time window specified.
timeOffset 0 The time window in minutes to offset the arrival information by. For example, a value of 20 will not show services arriving within the next 20 minutes.
timeWindow 120 The time window to show train services for in minutes. For example, a value of 60 will show services arriving to the station in the next 60 minutes.
serviceDetails true Should the response contain information on the calling points for each service? If set to false, calling points will not be returned.
filterStation none The CRS (Computer Reservation System) code to filter the results by. For example, performing a lookup for PAD (London Paddington) and setting filterStation to RED (Reading), will only show services arriving to Paddington that stopped at Reading.

Example Queries

Lookup arrivals to London Kings Cross, with default query parameters:
curl -X GET "https://api.departureboard.io/api/v2.0/getArrivalsByCRS/KGX/?apiKey=1234"

Lookup arrivals to London Kings Cross, showing 5 results:
curl -X GET "https://api.departureboard.io/api/v2.0/getArrivalsByCRS/KGX/?apiKey=1234&numServices=5"

Lookup arrivals to London Kings Cross, showing 5 results, including services from up to 20 minutes in the past:
curl -X GET "https://api.departureboard.io/api/v2.0/getArrivalsByCRS/KGX/?apiKey=1234&numServices=5&timeOffset=-20"


Example Response

curl -X GET "https://api.departureboard.io/api/v2.0/getArrivalsByCRS/KGX/?apiKey=1234&numServices=1"

Expand Response

{
"generatedAt": "2019-09-10T13:47:43.2393326+01:00",
"nationalRailResponseTimeMilliseconds": 113,
"locationName": "London Kings Cross",
"filterLocationName": null,
"filtercrs": null,
"filterType": null,
"crs": "KGX",
"nrccMessages": [
  {
    "message": "Additional trains to Great Northern destinations also operate from London St Pancras International (STP) which is a short walk from London Kings Cross."
  }
],
"platformAvailable": true,
"areServicesAvailable": null,
"trainServices": [
  {
    "serviceID": "kIPdqWwazsxnPprAbvdDsQ==",
    "serviceIDUrlSafe": "kIPdqWwazsxnPprAbvdDsQ--",
    "serviceType": "train",
    "isCancelled": null,
    "filterLocationCancelled": null,
    "cancelReason": null,
    "delayReason": null,
    "adhocAlert": null,
    "sta": "13:44",
    "eta": "13:53",
    "platform": null,
    "operator": "Grand Central",
    "operatorCode": "GC",
    "isCircularRoute": null,
    "length": null,
    "detachFront": null,
    "isReverseFormation": null,
    "rsid": null,
    "origin": [
      {
        "locationName": "Bradford Interchange",
        "crs": "BDI",
        "via": null,
        "futureChangeTo": null,
        "assocIsCancelled": null
      }
    ],
    "destination": [
      {
        "locationName": "London Kings Cross",
        "crs": "KGX",
        "via": null,
        "futureChangeTo": null,
        "assocIsCancelled": null
      }
    ],
    "currentOrigins": null,
    "currentDestinations": null,
    "previousCallingPointsList": [
      {
        "previousCallingPoints": [
          {
            "locationName": "Bradford Interchange",
            "crs": "BDI",
            "st": "10:22",
            "et": null,
            "at": "On time",
            "length": null
          },
          {
            "locationName": "Doncaster",
            "crs": "DON",
            "st": "12:04",
            "et": null,
            "at": "12:09",
            "length": null
          }
        ]
      }
    ]
  }
],
"busServices": null,
"ferryServices": null
}


Notes

When the serviceDetails query parameter is set to true for getArrivalsByCRS, only previous calling points will be returned. This is by design from National Rail.

To get previous and subsequent Calling Points in the same response, use the getArrivalsAndDeparturesByCRS or getServiceDetailsByID endpoint.

It is possible to have two sets of previousCallingPoints returned for a service (when looking up train services that split).

Consequently, previousCallingPoints are returned in the previousCallingPointsList array.

However, in 99% of circumstances there are only 1 set of previousCallingPoints returned. For services that do not split, you can use previousCallingPointsList[0].previousCallingPoints to access the previous calling points. The Python Code Samples have examples of how this works.




Get Arrivals and Departures by CRS

getArrivalsAndDeparturesByCRS is used to get a list of services arriving to and departing from a UK train station by the CRS (Computer Reservation System) code. This will typically return a list of train services, but will also return any replacement bus or ferry services that are in place.


HTTP Request

GET https://api.departureboard.io/api/v2.0/getArrivalsAndDeparturesByCRS/{CRS}/


URL Parameters

Parameter Default Description
CRS
required
none The CRS (Computer Reservation System) for the Station you wish to get departure and arrival information for, e.g. KGX for London Kings Cross.

Query Parameters

Parameter Required Default Description
apiKey
required
none The National Rail OpenLDBWS API Key to use for looking up service information. You must register with National Rail to obtain this key and whitelist it with us.
numServices 10 The number of arriving and departing services to return. This is a maximum value, less may be returned if there is not a sufficient amount of services arriving to or departing from this station within the time window specified.
timeOffset 0 The time window in minutes to offset the arrival and departure information by. For example, a value of 20 will not show services arriving to or departing from the station within the next 20 minutes.
timeWindow 120 The time window in minutes to offset the arrival and departure information by. For example, a value of 20 will not show services arriving to or departing from the selected station within the next 20 minutes.
serviceDetails true Should the response contain information on the calling points for each service? If set to false, calling points will not be returned.
filterStation none The CRS (Computer Reservation System) code to filter the results by.

When setting this you must also set the filterType parameter.

For example, performing a lookup for PAD (London Paddington) and setting filterStation to RED (Reading) and filterType to from, will only show services arriving to London Paddington that stopped at Reading.

Setting a filter for getArrivalsAndDeparturesByCRS is similar to performing a getArrivalsByCRS or getDeparturesByCRS lookup, with the appropriate filterStation parameter. However using the getArrivalsAndDeparturesByCRS endpoint shows more details for each of the returned services.
filterType
required if filterStation is set
none Determines if the filterStation parameter should be applied for services arriving to, or leaving from the selected station.

Example Queries

Lookup arrivals to, and departures from London Kings Cross, with default query parameters: curl -X GET "https://api.departureboard.io/api/v2.0/getArrivalsAndDeparturesByCRS/KGX/?apiKey=1234"

Lookup arrivals to, and departures from London Kings Cross, showing 5 results: curl -X GET "https://api.departureboard.io/api/v2.0/getArrivalsAndDeparturesByCRS/KGX/?apiKey=1234&numServices=5"

Lookup services for arriving to Reading, that stopped at Hayes & Harlington on the way: curl -X GET "https://api.departureboard.io/api/v2.0/getArrivalsAndDeparturesByCRS/RED/?apiKey=1234&filterStation=HAY&filterType=from"


Example Response

curl -X GET "https://api.departureboard.io/api/v2.0/getArrivalsAndDeparturesByCRS/HUN/?apiKey=1234&numServices=1"

Expand Response

{
"generatedAt": "2019-09-10T13:45:31.0349152+01:00",
"nationalRailResponseTimeMilliseconds": 117,
"locationName": "Huntingdon",
"filterLocationName": null,
"filtercrs": null,
"filterType": null,
"crs": "HUN",
"nrccMessages": null,
"platformAvailable": true,
"areServicesAvailable": null,
"trainServices": [
  {
    "serviceID": "A/A9aZIIFKIkHdE9sMyrng==",
    "serviceIDUrlSafe": "A_A9aZIIFKIkHdE9sMyrng--",
    "serviceType": "train",
    "isCancelled": null,
    "filterLocationCancelled": null,
    "cancelReason": null,
    "delayReason": null,
    "adhocAlert": null,
    "std": "13:49",
    "etd": "On time",
    "sta": "13:48",
    "eta": "On time",
    "platform": "3",
    "operator": "Thameslink",
    "operatorCode": "TL",
    "isCircularRoute": null,
    "length": 12,
    "detachFront": null,
    "isReverseFormation": null,
    "rsid": null,
    "origin": [
      {
        "locationName": "Horsham",
        "crs": "HRH",
        "via": null,
        "futureChangeTo": null,
        "assocIsCancelled": null
      }
    ],
    "destination": [
      {
        "locationName": "Peterborough",
        "crs": "PBO",
        "via": null,
        "futureChangeTo": null,
        "assocIsCancelled": null
      }
    ],
    "currentOrigins": null,
    "currentDestinations": null,
    "subsequentCallingPointsList": [
      {
        "subsequentCallingPoints": [
          {
            "locationName": "Peterborough",
            "crs": "PBO",
            "st": "14:05",
            "et": "On time",
            "at": null,
            "length": null
          }
        ]
      }
    ],
    "previousCallingPointsList": [
      {
        "previousCallingPoints": [
          {
            "locationName": "Horsham",
            "crs": "HRH",
            "st": "11:25",
            "et": null,
            "at": "On time",
            "length": null
          },
          {
            "locationName": "St Neots",
            "crs": "SNO",
            "st": "13:41",
            "et": null,
            "at": "On time",
            "length": null
          }
        ]
      }
    ]
  }
],
"busServices": null,
"ferryServices": null
}


Notes

It is possible to have two sets of previousCallingPoints or subsequentCallingPoints returned for a service (when looking up train services that split).

Consequently, previousCallingPoints and subsequentCallingPoints are returned in the previousCallingPointsList and subsequentCallingPointsList arrays.

However, in 99% of circumstances there are only 1 set of previousCallingPoints and subsequentCallingPoints returned. For services that do not split, you can use previousCallingPointsList[0].previousCallingPoints or subsequentCallingPointsList[0].subsequentCallingPoints to access the calling points. The Python Code Samples have examples of how this works.