Train Schedule Search

GET

Train Schedule Search

This API allows you to find all the possible destinations in the Rail Instant Search cache (used by Extensive Search above) from a given origin station on a given day. You can use this to help build network maps, journey planners or provide inspiration for rail travel.

This API has continuous content from SNCF.
All the options returned are single-leg trips - where a single train takes you directly from the origin to the destination. In general, only departure dates up to 90 days in the future are supported

Currently agglomeration stations are not supported

Resource URL

https://api.sandbox.amadeus.com/v1.2 /trains/schedule-search

Query Parameters


Name Values Description
apikey
(required)

API Key provided for your account, to identify you for API access. Make sure to keep this API key secret.

origin
(required)

Identifier of the rail station where you would like to depart from.

departure_date
(required)

The date on which you would like to depart from the origin station to go to the destination.


Request Body

Make a request and see the response.

Make a request and see the response.

Make a request and see the response.

Working...

 

Response format - Train Schedule Search

The response is returned in JSON with the following elements:

Element Meaning Multiplicity
results Array of result objects for this search. 0..n
Result object
origin_station_id Station ID of the origin station for this search. 1
date The search date provided in the input. 1
services Array of Rail-Service objects to describe service to the destinations. 1..n
Rail-Service object
destination_station_id ID of the destination rail station. 1
departure_times An array of departure times at which trains depart from the origin station to this destination station. Times are in the ISO 8601 YYYY-MM-DDTHH:mm format. 1..n

 

Errors

In the case that the station code is invalid or no results are found, an empty result set is returned, accompanied by a HTTP 200 response, for example:

{
  "results" : [ ]
}

In the case of a critical service error, you may receive an error object with an error 500 response.

If the input is invalid or not useful, you may receive a HTTP 400 response like this:

http://api.sandbox.amadeus.com/v1.2/trains/schedule-search?origin=VENTIMIGLIA&departure_date=2014-10-13&apikey= YOUR KEY HERE

You will receive a HTTP 400 response like this:

{
  "status" : 400,
  "message" : "VENTIMIGLIA is not a valid origin. Expected a 7 character rail station code"
}
 

Example - Train Schedule Search

Here's a simple search example. Just copy the following URLs in your browser. Don't forget to adjust the departure-date as necessary, and use your own API key.

This API allows you to find all the possible destinations in the Rail Instant Search cache (used by Extensive Search above) from a given origin station on a given day. You can use this to help build network maps, journey planners or provide inspiration for rail travel.

This API has content from SNCF (French trains) and Trenitalia (Italian Trains). All the options returned are single-leg trips - where a single train takes you directly from the origin to the destination. In general, only departure dates up to 90 days in the future are supported

Currently agglomeration stations are not supported

 

The required parameters are:

  • origin   8768600
  • departure_date   2014-10-13

 

The following request will return the available trains from Venezia Mestre Station (8302589) on 2014-10-13:

http://api.sandbox.amadeus.com/v1.2/trains/schedule-search?origin=8302589&departure_date=2014-10-13&apikey= YOUR API KEY HERE

You will receive a response like this

{
	"results": [
		{
			"origin_station_id": "8302589",
			"date": "2014-10-13",
			"services": [
				{
					"destination_station_id": "8300035",
					"departure_times": [
						"2014-10-13T06:32", "2014-10-13T14:32", "2014-10-13T17:32", "2014-10-13T18:32"
					]
				}, {
					"destination_station_id": "8306421",
					"departure_times": [
						"2014-10-13T14:37"
					]
				}, {
					"destination_station_id": "8311145",
					"departure_times": [
						"2014-10-13T07:09", "2014-10-13T15:09"
					]
				}
			]
		}
	]
}