You have to login to our system to access the api. You will get the username and password from amigo travels. You can use this credentials to get the token and do the booking and make the payment this will be the first activity.
you have to pass this token when you book the pass or ticket and secondly when you make the payment.
Endpoint:
https://ato.amigotravels.com/api/user/login
Method: POST
Headers:
Content-Type: application/json
Request Body:
{
"username": "This you will get from amigo travels",
"password": "This you will get from amigo travels"
}
All accommodation preferences are not mandatory. Accommodation preferences apply to all travelers and are controlled by the carrier and cannot always be guaranteed
Below is a sample JSON snippet to update accommodation preferences:
[ { "preferenceType": "SEATING_PREFERENCE", "values": ["aisle"] }, { "preferenceType": "DUPLEX_LEVEL", "values": ["lower_deck"] } ]Endpoint:
https://api-sandbox.era.raileurope.com/bookings/{bookingId}/items/{itemId}/accommodation-preferences
Method: PUT
Headers:
Content-Type: application/json
Request Body:
[
{
"preferenceType": "SEATING_PREFERENCE",
"values": [
"aisle"
]
},
{
"preferenType": "DUPLEX_LEVEL",
"values": [
"upper_deck"
]
}
]
Contains the id or ids of the booking item(s) you want to prebook
Endpoint:
https://api-sandbox.era.raileurope.com/bookings/{bookingId}/checkout/prebook
Method: POST
Headers:
Content-Type: application/json
Request Body:
[
"e0876c90-28d9-4b2d-b338-98dc385ba4d9"
]
The authentication is the very first action you will need to implement in order to interact with our system
The token must be provided in every call to API in an Authorization HTTP header's parameter, along with the Point-of-Sale.
Expected header format:
Authorization: <token_type> <access_token>
Endpoint:
https://authent-sandbox.era.raileurope.com/oauth2/token
Method: POST
{
"grant_type": "client_credentials",
"client_id": "your_client_id",
"client_secret": "your_client_secret"
}
{
"access_token": "eyJz93a...k4laUWw",
"token_type": "Bearer",
"expires_in": "3600"
}
Places are needed as input for each Search request
The Autocomplete API is limited to returning a maximum of 10 results by default. If certain cities are not boosted, they may not appear at the top of the results or be included within the 10 displayed entries.For cases where more results are needed, you can use the size parameter to increase the number of results retrieved. However, please be aware that without boosting, the order of cities within the results may vary based on relevance.
Types of Places:
In API concept, there are two main types of places:
station is a place known in the supplier system, it represents a real station or a meta-station
city is a pure API concept that refers to the city main station or directly the meta-station for better results
There are several types of identification:
id (ex: lRQOm40BbG1SH9yi0gf7) is a dynamic value that could change from one request to another.
code (ex: DE:berlin_hbf) and uicCode, when available, (ex: 8033452) are static values, that are even similar in both Sandbox and Production environments. We advise you to consider these values instead of the id for your Cache updating system and other operations.
The location refers to the GPS coordinates. Please note that it is optional and will be provided only when available.
localLabel is the name of the place (city or station) in the local language
label is the English translation of the place name.
Sometimes both values are similar (e.g. "Paris"), and sometimes they are different, e.g :
"Rome" as label ≠ "Roma" as localLabel
"Orleans" as label ≠ "Orléans" as localLabel
"Asslar" as label ≠ "Aßlar" as localLabel, etc.
The ticketOffice and ticketMachine refer to station has ticket machine or ticket
office. Both fields have values, true or false.
The fields need to be checked for TOD ticket booking. If the value is false, the
warning code era-bookings-no-ticket-collection-facilities will appear on the
booking creation response. Please show the warning message when completing the
booking to let the customer know where to retrieve the ticket.
Endpoint:
https://api-sandbox.era.raileurope.com/places/autocomplete
Method: GET
{
"query": "city_name",
"size": 10,
"type": "city or station",
"X-Point-Of-Sale": "your_point_of_sale"
}
[
{
"id": "uqNyT5UBsapZeKD77fOU",
"type": "city",
"code": "FR:paris",
"uicCode": "8724855",
"label": "Paris (All stations)",
"localLabel": "Paris (All stations)",
"country": {
"code": "FR",
"label": "France",
"localLabel": "France"
},
"location": {
"lat": 48.861496,
"lon": 2.33368
},
"timezone": "Europe/Paris"
}
]
Places Identification:
Labels:
Ticket Availability:
true/false).true/false).This function performs a search according to several criteria:
The maximum number of travelers is 9 through our API. The group bookings are not yet available on API.
It is possible to book travels with different rail operators under one single journey. ex: Madrid-London (operated by RENFE, SNCF and Eurostar) will return you some results.
A field multiProviderEnabled (boolean) can now be added to your input body of the Search Point to Point Offers endpoint. When set to true, the API response might include different rail operators, depending on the segment of your trip. Its default value will be false.
This field will also appear in the API response of the Search and Retrieve Point
to Point Offers. (but NOT in the Retrieve Point to Point single Offer nor in the
Bookings endpoints)
Please note that when this field is set to true, then the booking creation from
a UNIQUE offer could lead to SEVERAL booking items.
You can then follow the regular booking flow, being aware of the fact that :
some operations need to be made separately for each bookingItem. For example:
update traveler details, exchange, delete a booking item, etc.
some operations can be made once but imply to specify all bookingItemIds in the
input body. For example: prebook, refund etc
You don't need to preoccupate about the age categories of each carrier: our system will manage it for you. You just need to respect this rule: instead of accepting a total number of people per passenger type, API only accepts the age of each passenger. If your application only prompt your users for the number of people for each passenger type (child, youth, adult, senior), then you can build a basic mapping table on your side and use it in your API input request. This system will enable you not to bother about the different carriers' age categories.
Endpoint:
https://api-sandbox.era.raileurope.com/offers/point-to-point/searches
Method: POST
Request Body:
{
"travelers": [
{
"age": 30
},
{
"age": 10
}
],
"legs": [
{
"origin": {
"code": "FR:paris",
"type": "city"
},
"destination": {
"code": "FR:lyon",
"type": "station"
},
"departure": "2025-03-28T18:00:00",
"directOnly": false
}
]
}
This endpoint returns
a list of offers based on:
Family Card products will be in the STS results if an under 6 year-old-passenger is in the list of passengers. Free products will be in the EURAIL/STS results if a under 3/4 years old passengers is in the list of passengers. All these types of information can be found in the field tags.
The maximum number of travelers is 9 through our API. The group bookings are not yet available on API.
It is possible to book travels with different rail operators under one single journey. ex: Madrid-London (operated by RENFE, SNCF and Eurostar) will return you some results.
A field multiProviderEnabled (boolean) can now be added to your input body of the Search Point to Point Offers endpoint. When set to true, the API response might include different rail operators, depending on the segment of your trip. Its default value will be false.
This field will also appear in the API response of the Search and Retrieve Point to Point Offers. (but NOT in the Retrieve Point to Point single Offer nor in the Bookings endpoints)
Please note that when this field is set to true, then the booking creation from a UNIQUE offer could lead to SEVERAL booking items.
You can then follow the regular booking flow, being aware of the fact that : some operations need to be made separately for each bookingItem. For example: update traveler details, exchange, delete a booking item, etc. some operations can be made once but imply to specify all bookingItemIds in the input body. For example: prebook, refund etc.
You don't need to preoccupate about the age categories of each carrier: our system will manage it for you. You just need to respect this rule: instead of accepting a total number of people per passenger type, API only accepts the age of each passenger. If your application only prompt your users for the number of people for each passenger type (child, youth, adult, senior), then you can build a basic mapping table on your side and use it in your API input request. This system will enable you not to bother about the different carriers' age categories.
The basic passenger type - age mapping can look like this:
Endpoint:
https://api-sandbox.era.raileurope.com/offers/passes/searches
Method: POST
Request Body:
{
"place": {
"code": "FR",
"label": "France"
},
"validityStartDate": "2025-04-06",
"travelers": [
{
"age": 30
}
]
}
A booking is created with one or more offers picked up from the Search results. Offers are converted into Booking items. The maximum number of selected Offers (and thus, booking items) is 15 per booking.
when using this api you have to pass on the token, the one which you are going to get when login in to our system using the endpoint https://ato.amigotravels.com/api/user/login
Endpoint:
https://ato.amigotravels.com/api/user/booking
Method: POST
Request Body Example:
{
"offer_location" : {
"items": [
{
"offerLocations": [
"/offers/passes/searches/6943b732-34ab-4049-9599-20c693da4932/offers/pass-offer-1"
]
}
]
},
"correlation_id": "hdisdfisfdi87878wrfdsf"
}
To identify which traveler information are mandatory inputs for this step, you need to check the list returned at the Booking Creation step (in the field bookingItems[].travelerInformationRequired).
At this step, a lead traveler must be defined. Lead traveler required information and other travelers required information can be different.
The first name field can accept up to 25 characters.
As listed above, some carriers require a dateOfBirth. When a dateOfBirth is specified, the age fields needs to be present but its value will be ignored (no matter if the dateOfBirth is a required field for the carrier or not).
Please also pay attention to extra requirement for certain information (such as passport details) to be provided during this step. If the booking item requires PASSPORT information, the following details must be provided:
Traveler document type
Passport number
Passport expiration date
Passport country code
Even if the tag pointToPointBookingItem.travelerInformationRequired contains the value PASSPORT, you can actually provide any of the following document types:
PASSPORT (International Passport)
DNI (Spanish Identity Card)
NIE (Foreigner Identity Number)
EU (European Identity Card)
For including the traveler details then please follow the below format, do include the travelerDocument array with the values as below "travelerDocument": { "type": "PASSPORT", "documentNumber": "...", "expirationDate": "2030-03-25", "countryCode": "FR", "validDocument": true },
If the countryOfResidence is a required field for the carrier then you should
send the value countryOfResidence in the input body.
You can find the complete list of valid country of residence in this
spreadsheet.
Within the framework of a booking implying multiple providers, this Update Travelers service must be run once per booking item.
Endpoint:
https://api-sandbox.era.raileurope.com/bookings/{bookingId}/items/{itemId}/travelers
Method: PUT
{
bookingId:
itemId:
X-Point-Of-Sale:
}
Request Body Example:
[
{
"id": "traveler-1",
"type": "ADULT",
"leadTraveler": true,
"age": 31,
"emailAddress": "e@mail.com",
"phoneNumber": "0102030405",
"phoneCountryCode": "33",
"title": "MR",
"lastName": "Donovan",
"firstName": "Gwendolyn",
"dateOfBirth": "1980-01-01",
"countryOfResidence": "AS"
}
]
This service finalizes the booking by confirming items in the carrier inventory. The ticket information will be provided in the next step: the Print.
when using this api you have to pass on the token, the one which you are going to get when login in to our system using the endpoint
https://ato.amigotravels.com/api/user/login send the token in the authorization
Endpoint:
https://ato.amigotravels.com/api/user/confirmpayment
Method: POST
Request Body Example:
correlation_id:
booking_id: 12bfa7bc-e63e-4cca-98db-2f568dd5c1ba
Print a booking. This is the final and mandatory step no matter the type of product (Point-to-point or Passes) and or the Ticketing method.
Endpoint:
https://api-sandbox.era.raileurope.com/bookings/{bookingId}/print
Method: POST
bookingId:
X-Point-Of-Sale: 12bfa7bc-e63e-4cca-98db-2f568dd5c1ba
X-CorrelationId: