API Specification

Flight Booking API

v1.2.0 Active API Key Required

Confirm flight booking after fare confirmation

Endpoint

POST /api/b2b/flights/book.php

This API is used to confirm a flight booking after fare confirmation. Ensure that you have completed the fare validation/confirmation step before calling this API.

API Key Authentication

Authenticate requests via HTTP Header or Request Parameter
Required for all endpoints

Enjoy Holiday Hub APIs authenticate requests using your unique secret API Key. You can provide your key in either of the following standard formats:

Method 1: Header (Recommended)

Send key in standard HTTP header:

X-API-Key: demo_123456789
Method 2: Body / Query

Send key in JSON payload or query param:

"api_key": "demo_123456789"
Demo Sandbox Key: demo_123456789
Get your production key in Agent Portal

Request Parameters

FieldTypeRequiredDescription
SearchTokenIdstringRequiredToken received from search API
ResultIndexstringRequiredSelected fare_id/result_index from search or fare confirmation
PassengersarrayRequiredPassenger details
ContactobjectRequiredBooking contact details

Passenger Object

JSON Response
{
    "Title": "Mr",
    "FirstName": "Rahul",
    "LastName": "Sharma",
    "PaxType": 1,
    "DateOfBirth": "1995-05-10",
    "Gender": 1,
    "PassportNo": "A1234567",
    "PassportExpiry": "2030-05-10"
}

Contact Object

JSON Response
{
    "Email": "rahul@example.com",
    "Phone": "9876543210"
}

Request Example

JSON Response
{
    "api_key": "YOUR_API_KEY",
    "SearchTokenId": "SEARCH_TOKEN_HERE",
    "ResultIndex": "TOB0",
    "Passengers": [
        {
            "Title": "Mr",
            "FirstName": "Rahul",
            "LastName": "Sharma",
            "PaxType": 1,
            "DateOfBirth": "1995-05-10",
            "Gender": 1
        }
    ],
    "Contact": {
        "Email": "rahul@example.com",
        "Phone": "9876543210"
    }
}

cURL Example

curl -X POST "https://enjoyholidayhub.com/api/b2b/flights/book.php" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "X-API-Key: demo_123456789" \
  -d '{
    "SearchTokenId": "SEARCH_TOKEN_HERE",
    "ResultIndex": "TOB0",
    "api_key": "demo_123456789"
}'

Response (Success)

SUCCESS Flight booked successfully
JSON Response
{
    "status": true,
    "message": "Flight booked successfully",
    "data": {
        "booking_id": 56789,
        "pnr": "ABC123",
        "status": "confirmed"
    }
}

Response (Error)

ERROR / NOTICE Booking failed or fare expired
JSON Response
{
    "status": false,
    "message": "Booking failed or fare expired"
}

Important Notes

  • ✈️ Booking requires prior fare confirmation
  • ⏳ Prices may change if booking is delayed
  • 📩 PNR is generated after successful booking
  • 🔁 Passenger details must match fare confirmation
  • 🌐 System handles all internal processing securely