Login API - Amigo Travels

Description

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.

Note:

you have to pass this token when you book the pass or ticket and secondly when you make the payment.

API Details

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"
                }
                                    
API Response

Update accomodation details - Amigo Travels

Description

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"] } ]
API Details

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"
    ]
  }
]
                                    
API Response

Prebook Booking Items

Description

Contains the id or ids of the booking item(s) you want to prebook

API Details

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"
]
                                    
API Response

Authentication API Details

API Description

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 Information

Endpoint: https://authent-sandbox.era.raileurope.com/oauth2/token

Method: POST

Request Body (JSON)
{
    "grant_type": "client_credentials",
    "client_id": "your_client_id",
    "client_secret": "your_client_secret"
}
                                    
Sample Response (JSON)
{
    "access_token": "eyJz93a...k4laUWw",
    "token_type": "Bearer",
    "expires_in": "3600"
}
                                    

Places API Details

API Description

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

Places identification

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.

Places location

The location refers to the GPS coordinates. Please note that it is optional and will be provided only when available.

Places labels

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.

Place ticketOffice and ticketMachine

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 Information

Endpoint: https://api-sandbox.era.raileurope.com/places/autocomplete

Method: GET

Request Parameters
{
    "query": "city_name",
    "size": 10,
    "type": "city or station",
    "X-Point-Of-Sale": "your_point_of_sale"
}
                                    
Sample Response (JSON)
[
    {
        "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"
    }
]
                                    
Additional Information

Places Identification:

  • ID: A dynamic value that may change with each request.
  • Code & UIC Code: Static values recommended for caching and updating.

Labels:

  • localLabel: The place name in the local language.
  • label: The English translation of the place name.

Ticket Availability:

  • ticketOffice: Whether the station has a ticket office (true/false).
  • ticketMachine: Whether the station has a ticket machine (true/false).

Search Offers

Description

This function performs a search according to several criteria:

  • A one-way or roundtrip travel
  • An origin & destination of the travel (stations or cities)
  • A travel date
  • A number of travelers with their age/type (child, youth, adult, senior)
Focus: Max number of passengers

The maximum number of travelers is 9 through our API. The group bookings are not yet available on API.

Focus: Multi-provider support

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.

How to implement it ?

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

Focus: Passenger Age/Type

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:
  • Child/Youth: Exact age at travel date
  • Adult: Default age 30
  • Senior: Default age 65
API Details

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
    }
]
}
                                    
API Response

Pass Offers Search

Description

This endpoint returns
a list of offers based on:

  • Specific conditions All the conditions must be displayed or accessible to the final client.
  • a list of Pass Offers associated with:
    • Price
    • Product code
    • Comfort category
    • Number of days
    • Validity & activation duration

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.

Focus: Max number of passengers

The maximum number of travelers is 9 through our API. The group bookings are not yet available on API.

Focus: Multi-provider support

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.

How to implement it ?

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.

Focus: Passenger Age/Type

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:

  • Child/Youth: Exact age at travel date
  • Adult: Default age 30
  • Senior: Default age 65
API Details

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
    }
]
}
                                    
API Response

Booking API - Amigo Travels

Description

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.

Note:

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

API Details

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"
    }
                                          
                                    
API Response

Update travelers details - Amigo Travels

Description

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).

Focus: Lead traveler

At this step, a lead traveler must be defined. Lead traveler required information and other travelers required information can be different.

Focus: First name

The first name field can accept up to 25 characters.

Focus: Age and Date of birth

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).

Focus: Passport information

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 },

Focus: Country of Residence

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.

Focus: Multi-providers

Within the framework of a booking implying multiple providers, this Update Travelers service must be run once per booking item.

API Details

Endpoint: https://api-sandbox.era.raileurope.com/bookings/{bookingId}/items/{itemId}/travelers

Method: PUT

Request Parameters
{
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"
}
]
                                      
                                          
                                    
API Response

Make Payment

Description

This service finalizes the booking by confirming items in the carrier inventory. The ticket information will be provided in the next step: the Print.

Note:

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

API Details

Endpoint: https://ato.amigotravels.com/api/user/confirmpayment

Method: POST

Request Body Example:

correlation_id:
booking_id: 12bfa7bc-e63e-4cca-98db-2f568dd5c1ba
                                    
API Response

Print a Booking

Description

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.

API Details

Endpoint: https://api-sandbox.era.raileurope.com/bookings/{bookingId}/print

Method: POST

Request Parameters
bookingId:
X-Point-Of-Sale: 12bfa7bc-e63e-4cca-98db-2f568dd5c1ba
X-CorrelationId:                                                 
                                    
API Response