API Specification
Bus Booking API
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 ParameterEnjoy 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:
Get your production key in Agent Portal
demo_123456789
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
SearchTokenId | string | Required | Token received from search API |
ResultIndex | string | Required | Selected bus result index |
BoardingPointId | integer | Required | Boarding point ID |
DroppingPointId | integer | Required | Dropping point ID |
Passenger | array | Required | Passenger 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