Getting Started with the Xeni Activities APIHow to Book an ActivityHow to Browse Activity Tags and CategoriesHow to Cancel an Activity BookingHow to Check Activity AvailabilityHow to Get Activity DetailsHow to Retrieve Activity Booking DetailsHow to Search for Activities with FiltersHow to Search for Activity DestinationsCar Rental API - Getting StartedCar Rental API - Understanding Response FieldsHow to Book a Car RentalHow to Get Rental Car Details and Equipment Add-OnsHow to Retrieve or Cancel a Car Rental BookingHow to Search for Available Rental CarsHow to Search for Pickup LocationsHow to Use Car Rental Search FiltersDeals API Best Practices for IntegrationDeals API Frequently Asked QuestionsGetting Started with the Xeni Deals APIDeals API Request Parameters and Headers ReferenceDeals API Supported Currencies and LocalizationHow to Display Deals in Your ApplicationHow to Fetch Hotel Deals by LocationFlights API Error Codes and TroubleshootingGetting Started with the Xeni Flights APIHow to Book a FlightHow to Check Flight Availability and PricingHow to Confirm or Cancel a Flight BookingHow to Retrieve Fare Rules for a FlightHow to Retrieve Flight Booking DetailsHow to Search for Airports Using AutocompleteHow to Search for FlightsHow to Use Flight Search Filters, Sorting, and PaginationHow to Check Room Availability and PricingHow to Filter Vacation Rental ResultsHow to Get Resort Property Details, Amenities, and AccessibilityHow to Hold and Confirm a Resort BookingHow to Release a Resort HoldHow to Retrieve Resort Booking DetailsHow to Search for Available ResortsHow to Search for Resort DestinationsHow to Search for Vacation Rental LocationsHow to Search for Vacation RentalsHow to Use Resort Search Filters and SortingGetting Started with the Xeni Resorts APIResorts API: Understanding Booking Statuses and PoliciesGetting Started with the Vacation Rentals APIVacation Rentals Frequently Asked QuestionsVacation Rentals Supported Property TypesUnderstanding Async Search for Vacation RentalsAuthentication & API SignaturesBooking Hotels — Direct API & SSO CheckoutError Handling, Rate Limits & Best PracticesGetting Started with the Xeni Hotels APIManaging Bookings: Status, Retrieval & CancellationPricing Confirmation & Token LifecycleRetrieving Hotel Details & Room AvailabilitySearching for Hotels: Locations, Filters & PaginationSearching for HotelsSession Management & Correlation IDsAPI authentication and getting your API keys

How to Search for Flights

Last updated: 2026-03-03

How to Search for Flights

The search endpoint returns available flights based on your route, dates, passenger counts, and cabin class. It supports both one-way and return trips.

Endpoint

POST /flights/api/v2/search

Headers

HeaderRequiredDescription
x-api-keyYesYour API key.
x-correlation-idYesCorrelation ID captured from the autocomplete response headers.

Request Body

FieldTypeRequiredDescription
flightinfoarrayYesArray of flight leg objects. One entry for one-way, two for return trips.
flightinfo[].departuredatestringYesDeparture date in YYYY-MM-DD format.
flightinfo[].originstringYesOrigin airport IATA code (e.g., SFO).
flightinfo[].destinationstringYesDestination airport IATA code (e.g., BLR).
routetypestringYes"Oneway" or "Return".
cabin_typestringYes"economy", "business", "premium", or "first".
adultsintegerYesNumber of adult passengers (12+ years).
childrenintegerNoNumber of child passengers (2-11 years). Defaults to 0.
infantsintegerNoNumber of infant passengers (under 2 years). Defaults to 0.
paginationobjectNoPagination settings. See Filters, Sorting, and Pagination.
sortingobjectNoSorting settings. See Filters, Sorting, and Pagination.
filtersobjectNoFilter criteria. See Filters, Sorting, and Pagination.

Example: One-Way Search

JSON
{
  "flight_info": [
    {
      "departure_date": "2026-04-15",
      "origin": "SFO",
      "destination": "BLR"
    }
  ],
  "route_type": "Oneway",
  "cabin_type": "economy",
  "adults": 1,
  "children": 0,
  "infants": 0,
  "pagination": {
    "page": 1,
    "limit": 10
  },
  "sorting": {
    "sort_by": "price",
    "sort_order": "asc"
  }
}

Example: Return Trip Search

For return trips, include two entries in flight_info — one for the outbound leg and one for the return leg.

JSON
{
  "flight_info": [
    {
      "departure_date": "2026-04-15",
      "origin": "SFO",
      "destination": "BLR"
    },
    {
      "departure_date": "2026-04-25",
      "origin": "BLR",
      "destination": "SFO"
    }
  ],
  "route_type": "Return",
  "cabin_type": "business",
  "adults": 2,
  "children": 1,
  "infants": 0
}

Response Structure

The response contains a list of flights, each with segments and cabin options.

JSON
{
  "status": "success",
  "data": {
    "flights": [
      {
        "segments": [
          {
            "flight_number": "UA123",
            "airline": "United Airlines",
            "origin": "SFO",
            "destination": "FRA",
            "departure_time": "2026-04-15T10:30:00",
            "arrival_time": "2026-04-16T06:45:00",
            "duration": "12h 15m"
          },
          {
            "flight_number": "LH456",
            "airline": "Lufthansa",
            "origin": "FRA",
            "destination": "BLR",
            "departure_time": "2026-04-16T09:00:00",
            "arrival_time": "2026-04-16T22:30:00",
            "duration": "9h 0m"
          }
        ],
        "cabins": [
          {
            "id": "cab_001",
            "cabin": "economy",
            "cabinclasstext": "Economy",
            "cabinsearchsessionid": "cssabc123def456",
            "base_rate": 450,
            "taxandfees": 85.5,
            "total_rate": 535.5,
            "currency_code": "USD",
            "baggage_details": {
              "cabin_baggage": "1 x 7kg",
              "checked_baggage": "1 x 23kg"
            },
            "penalties_info": {
              "cancellable": true,
              "exchangeable": true
            }
          }
        ]
      }
    ],
    "pagination": {
      "total": 45,
      "page": 1,
      "limit": 10,
      "total_pages": 5,
      "has_next": true,
      "has_prev": false
    },
    "available_airlines": [
      "United Airlines",
      "Lufthansa",
      "Air India",
      "Emirates"
    ]
  },
  "message": "Flights retrieved successfully"
}

Key Response Fields

FieldDescription
flightsArray of flight options, each containing segments and cabins.
flights[].segmentsIndividual flight legs with airline, times, and duration.
flights[].cabinsAvailable cabin options with pricing.
cabins[].cabinsearchsessionidToken required for the availability check. Save this value.
cabins[].totalrateTotal price including taxes and fees.
cabins[].baggagedetailsIncluded baggage allowances.
cabins[].penaltiesinfoSummary of cancellation and exchange policies.
paginationPagination metadata including total results and page info.
available_airlinesList of all airlines in the full result set. Useful for building filter UIs.

Passenger Types

TypeAge RangeNotes
Adult12+ yearsAt least 1 adult is required.
Child2-11 yearsMust be accompanied by an adult.
InfantUnder 2 yearsMust be accompanied by an adult. Cannot exceed the number of adults.

Next Steps

Was this article helpful?