Techtalks: Traveltech

How to save the details of several travelers within the time of booking using loop?

I don't know how to save the details of several travelers within the time of booking using loop?

I would like to store multiple travelers' information while booking using the loop method. I am working with the Amadeus Node.js software development kit; hope someone know to give me a guide?

image placeholder
Christian Evan

asked  Aug 24, 2022

image placeholder
Ivan Mosiev, Solution Architect at AltexSoft

answered  Sep 7, 2022


Hi Christian!

Can you share the code that creates difficulties? You can publish it on or create a gist on and share a link here.

image placeholder
Hasim Can

answered  Sep 25, 2023


Hi there! Saving multiple travelers' details during booking using loops in Amadeus can be tricky. Here are a few tips that may help:

  • Set up an array to store each traveler's information as you loop through and collect it. For example:
  • let travelers = [];

    for(let i = 0; i < numTravelers; i++) {
      let traveler = {
        firstName: /* get first name*/, 
        lastName: /* get last name*/,
        // other details  


  • When making the booking, loop through the travelers array and add each object to the booking payload.
  • To identify each traveler separately in the booking, use indexes like travelers[0]travelers[1] etc and attach an identifier like "id": "1".
  • After booking, save the travelers array to your database to persist the details.

The key points are structuring the data properly for the API, keeping track of indexes/IDs, and saving the array afterwards. Let me know if any part needs more clarification!