Best fares, easy and straightforward integration

Designed with for developers

Create Booking

Introduction

On this page you'll learn how to create bookings. Bookings created via Create Booking are only saved in our database and no further action is taken. This allows you to verify the returned response.

You will have to Issue the booking, which will create reservations, make payments and ticket the reservations all at once.

Request

POST https://faresapi.com/api/v1/booking/create

Creating a booking is done in two steps:

  • Send relevant flight and passenger counts data, which first verifies that the flights are still available for booking
  • Send relevant passenger and booker data, which is required by our airlines in order to create reservations

You will have to POST a JSON object like the example below. Please keep reading for full reference.

Please note that some fields may or may not be required depending on the policy of each individual airline.
Please refer to Flights for additional information.
Each individual flight will contain the passengerFields and bookerFields fields which will let you know whether a field is required or not for that particular flight.

{
    "flights":{
        "residents":{
            "adults":1
        },
        "flightId":6
    },
    "booking":{
        "booker":{
            "title":1,
            "firstName":"John",
            "lastName":"Wick",
            "email":"john.wick@flight.co.tz",
            "nationality":33
            "phone":{
                "phoneCode":33, # This is a Country ID
                "phoneNumber":"12345789"
            },
        },
        "passengers":[
            {
                "type":1,
                "title":1,
                "firstName":"John",
                "lastName":"Wick",
                "email":"john.wick@flight.co.tz",
                "nationality":207,
                "phone":{
                    "phoneCode":33, # This is a Country ID
                    "phoneNumber":"12345789"
                },
                "birthDate":{
                    # 3rd of March 1981
                    "year":"1981", # 4 digit year
                    "month":"3", # Note: no leading zeros
                    "day":"3" # Note: no leading zeros
                },
                "passport":{
                    "number":"1234",
                    "expiry":{
                        "year":"2040",
                        "month":"3",
                        "day":"3"
                    },
                    "issuer":33,
                    "issueDate":{
                        "year":"2013",
                        "month":"3",
                        "day":"3"
                    }
                },
                "nationalId":{
                    "number":"1234",
                    "expiry":{
                        "year":"2040",
                        "month":"3",
                        "day":"3"
                    },
                    "issuer":33,
                    "issueDate":{
                        "year":"2013",
                        "month":"3",
                        "day":"3"
                    }
                },
                "placeOfBirth":"Vidin"
            }
        ]
    }
}
            

Response

Upon successful booking, you will get an HTTP 201 CREATED status code with a Location header pointing to the correct Get Booking URL for this booking.

The Response body will contain exactly the same content as returned by Get Booking

Flights

Under the flights key you will have to provide information about the flight(s) and passenger counts by their type and residency.

Flights

flightId Mandatory Departure Flight ID see Search
returnFlightId Mandatory Return Flight ID see Search
Can't be the same as flightId
residents Optional Residents See Passenger Counts below
nonResidents Optional Residents See Passenger Counts below

Passenger Counts

adults Optional Adults
children Optional Children
infants Optional Infants
  • There MUST be at least one adult total traveling (Resident or Non-Resident).
  • Infants can't be more than adults.

The minimal data required for an adult traveling one way would be the flightId and 1 adult passenger (either resident or non-resident, depending on whether you know their nationality beforehand or your business logic)

Please note that upon passenger data submission, passenger residency may change on a per-carrier basis.
This means that a passenger may or may not be eligible for a resident (cheaper) fare.

This is done automatically. You can compare our computed price upon creating a booking with yours.
Sometimes, if a fare is no longer available, you may get a higher price. This can also happen if a passenger is not eligible for a resident fare.

You may also get a cheaper price for your passengers if any of them is eligible for a resident fare, but you submitted them as non-residents.

Please look at Issue Booking for additional information.
In case there's a cheaper fare found for a passenger, it will automatically be booked for them.
If, however, the price has gone up due to a fare no longer available or a passenger not eligible for a resident fare, then you'll get an error. Please refer to Issue Booking for additional information on how to handle that.

Booker

Under the booker key you will have to provide information about the person that creates the reservation. They do not have to be necessarily flying.

title Mandatory Title ID. Please refer to Static Data for additional information.
firstName Mandatory First Name
lastName Mandatory Last Name
email Mandatory A valid email is required
nationality Optional

This value represents a Country. There are three options for submitting data to this field.
Please refer to Countries for additional information.

phone Optional Please refer to Common Fields - Phone

Passengers

Passengers are represented by an array of objects. Each object consists of the following fields

type Mandatory Passenger Type ID. Please refer to Static Data for additional information.
title Mandatory Title ID. Please refer to Static Data for additional information.
firstName Mandatory First Name
lastName Mandatory Last Name
email Mandatory A valid email is required for ADULTS only
nationality Optional

This value represents a Country. There are three options for submitting data to this field.
Please refer to Countries for additional information.

phone Optional Please refer to Common Fields - Phone
birthDate Optional Please refer to Common Fields - Date
passport Optional Passport information. Please refer to Common Fields - Document
nationalId Optional National ID information. Please refer to Common Fields - Document
placeOfBirth Optional Place of birth. String. Free-text submitted by the passenger.

Common Fields

Phone

"phone":{
    # In this case, Tanzania.
    # Can be:
    # 1. integer 207
    # 2. two letter code string "TZ"
    # 3. or phone code string with a leading plus sign "+255"
    "phoneCode":207,
    "phoneNumber":"12345789"
}
phoneCode Mandatory

This value represents a Country. There are three options for submitting data to this field.
Please refer to Countries for additional information.

phoneNumber Mandatory The phoneNumber field is the phone number withOUT the country code.

Date

"birthDate":{
    # 3rd of March 1981
    "year":"1981", # 4 digit year
    "month":"3", # Note: no leading zeros
    "day":"3" # Note: no leading zeros
}
year Mandatory 4-digit Year
month Mandatory Month, no leading zeros, starting from 1
day Mandatory Day, no leading zeros, starting from 1

Document

"passport":{
    "number":"1234",
    "expiry":{
        "year":"2040",
        "month":"3",
        "day":"3"
    },
    # In this case, Tanzania.
    # Can be:
    # 1. integer 207
    # 2. two letter code string "TZ"
    # 3. or phone code string with a leading plus sign "+255"
    "issuer":207,
    "issueDate":{
        "year":"2013",
        "month":"3",
        "day":"3"
    }
}
number Mandatory Passenger document number
expiry Mandatory Document expiry date. Please refer to Date above.
issuer Mandatory

This value represents a Country. There are three options for submitting data to this field.
Please refer to Countries for additional information.

issueDate Mandatory Document issue date. Please refer to Date above.