API Specification

Bus Booking API

v1.2.0 Active API Key Required

Confirm bus ticket booking after seat blocking

Endpoint

POST /api/b2b/bus/book.php

This API confirms the bus ticket booking using previously blocked seats. You must call the Block Seat API before booking.

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 bus result index
BoardingPointIdintegerRequiredBoarding point ID
DroppingPointIdintegerRequiredDropping point ID
PassengerarrayRequiredPassenger details (same as block seat)

Passenger Object

JSON Response
{
    "LeadPassenger": true,
    "Title": "Mr",
    "FirstName": "Rahul",
    "LastName": "Sharma",
    "Email": "rahul@example.com",
    "Phoneno": "9876543210",
    "Gender": "1",
    "Address": "New Delhi",
    "Age": "30",
    "SeatName": 1
}

Request Example

JSON Response
{
    "api_key": "YOUR_API_KEY",
    "SearchTokenId": "SEARCH_TOKEN_HERE",
    "ResultIndex": "TB-35",
    "BoardingPointId": 1,
    "DroppingPointId": 1,
    "Passenger": [
        {
            "LeadPassenger": true,
            "Title": "Mr",
            "FirstName": "Rahul",
            "LastName": "Sharma",
            "Email": "rahul@example.com",
            "Phoneno": "9876543210",
            "Gender": "1",
            "Address": "New Delhi",
            "Age": "30",
            "SeatName": 1
        }
    ]
}

cURL Example

curl -X POST "https://enjoyholidayhub.com/api/b2b/bus/book.php" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "X-API-Key: demo_123456789" \
  -d '{
    "SearchTokenId": "SEARCH_TOKEN",
    "ResultIndex": "TB-35",
    "BoardingPointId": 1,
    "DroppingPointId": 1,
    "api_key": "demo_123456789"
}'

Response (Success)

SUCCESS Booking confirmed successfully
JSON Response
{
    "status": true,
    "message": "Booking confirmed successfully",
    "data": {
        "booking_id": 12345,
        "pnr": "PNR987654",
        "status": "confirmed"
    }
}

Response (Error)

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

Important Notes

  • ๐Ÿงพ Booking can only be done after successful seat blocking
  • โณ Ensure booking is completed before block expiry
  • ๐Ÿ” Passenger details must match block seat request
  • ๐Ÿ“ฉ Booking confirmation includes PNR and ticket details
  • ๐ŸŒ User IP is handled internally by the system