Create & cancel booking
After a successful prebook, confirm the reservation with guest details. You can also cancel bookings and generate vouchers.
POST /api/Hotel/book
Confirms the hotel booking with full guest details. Only call this after a successful prebook.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
rate_key |
string | Yes | The rate key from prebook |
user_id |
int64 | Yes | Your TravelExe user ID |
currency |
string | Yes | 3-letter currency code |
client_nationality |
string | Yes | 2-letter nationality code |
agent_ref_no |
string | No | Your internal reference for this booking |
company_name |
string | No | Company name for the booking |
message |
string | No | Special requests or notes |
rooms |
BookingRoomRequest[] | Yes | Room guest details |
BookingRoomRequest object
| Field | Type | Description |
|---|---|---|
adults |
BookingGuest[] | Adult guest details |
children |
BookingChild[] | Child guest details |
BookingGuest object
| Field | Type | Description |
|---|---|---|
title |
string | Guest title (Mr, Mrs, Ms, Dr) |
first_name |
string | Guest first name |
last_name |
string | Guest last name |
BookingChild object
| Field | Type | Description |
|---|---|---|
age |
integer | Child's age |
first_name |
string | Child's first name |
last_name |
string | Child's last name |
Example request
POST /api/Hotel/book
X-Api-Key: your_api_key
Content-Type: application/json
{
"rate_key": "RATE_a7b3c1d9e2f4",
"user_id": 1001,
"currency": "USD",
"client_nationality": "IN",
"agent_ref_no": "MY-REF-20260801-001",
"company_name": "Sunrise Travel Agency",
"message": "Late check-in requested, arriving at 11pm",
"rooms": [
{
"adults": [
{ "title": "Mr", "first_name": "Rahul", "last_name": "Sharma" },
{ "title": "Mrs", "first_name": "Priya", "last_name": "Sharma" }
],
"children": []
}
]
}
Example response
{
"status": "confirmed",
"refNo": "TXE-2026-00841",
"agentRefNo": "MY-REF-20260801-001",
"hotelName": "Grand Hyatt Dubai",
"checkin": "2026-08-01",
"checkout": "2026-08-05",
"totalPrice": {
"amount": 280.00,
"currency": "USD"
},
"guests": ["Mr Rahul Sharma", "Mrs Priya Sharma"],
"cancellationPolicy": {
"type": "free_cancellation",
"freeCancellationDeadline": "2026-07-28T23:59:00"
}
}
POST /api/Hotel/cancel
Cancels an existing hotel booking.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
ref_no |
string | Yes | The TravelExe booking reference (e.g. TXE-2026-00841) |
user_id |
string | Yes | Your TravelExe user ID |
Example request
POST /api/Hotel/cancel
X-Api-Key: your_api_key
Content-Type: application/json
{
"ref_no": "TXE-2026-00841",
"user_id": "1001"
}
Example response
{
"status": "cancelled",
"refNo": "TXE-2026-00841",
"cancellationFee": {
"amount": 0.00,
"currency": "USD"
},
"message": "Booking cancelled successfully. No cancellation fee applied."
}
Check the cancellation policy before cancelling. Non-refundable bookings may still be cancelled but the full amount will be charged. Use GET /api/Hotel/GetCancellationPolicy to check the policy first.
POST /api/Hotel/CreateVoucher
Generates a booking voucher for a confirmed reservation.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
refNo |
string | Yes | The TravelExe booking reference |
userId |
int64 | Yes | Your TravelExe user ID |
Example request
POST /api/Hotel/CreateVoucher
X-Api-Key: your_api_key
Content-Type: application/json
{
"refNo": "TXE-2026-00841",
"userId": 1001
}
Retrieve bookings
By TravelExe reference
GET /api/Hotel/GetBookingDetails?refNo=TXE-2026-00841&userId=1001
X-Api-Key: your_api_key
By your agent reference
GET /api/Hotel/GetBookingDetailsByAgentRef?agentRefNo=MY-REF-20260801-001
X-Api-Key: your_api_key
By any search term
GET /api/Hotel/GetBookingDetailsByAny?searchTerm=Sharma&userId=1001
X-Api-Key: your_api_key
Booking reports
GET /api/Hotel/GetBookingReports?bookerId=1001&type=upcoming
X-Api-Key: your_api_key
| Parameter | Type | Description |
|---|---|---|
bookerId |
integer | Your user ID |
type |
string | Report type: upcoming, past, cancelled, all |
Code samples
var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-Api-Key", "your_api_key");
var bookingRequest = new BookingRequest
{
RateKey = "RATE_a7b3c1d9e2f4",
UserId = 1001,
Currency = "USD",
ClientNationality = "IN",
AgentRefNo = "MY-REF-20260801-001",
Message = "Late check-in, arriving at 11pm",
Rooms = new[]
{
new BookingRoomRequest
{
Adults = new[]
{
new BookingGuest { Title = "Mr", FirstName = "Rahul", LastName = "Sharma" },
new BookingGuest { Title = "Mrs", FirstName = "Priya", LastName = "Sharma" }
},
Children = Array.Empty<BookingChild>()
}
}
};
var response = await client.PostAsJsonAsync(
"https://api.travelexe.com/api/Hotel/book", bookingRequest);
var booking = await response.Content.ReadFromJsonAsync<BookingResponse>();
Console.WriteLine($"Booking confirmed: {booking.RefNo}");
const booking = await fetch('https://api.travelexe.com/api/Hotel/book', {
method: 'POST',
headers: { 'X-Api-Key': 'your_api_key', 'Content-Type': 'application/json' },
body: JSON.stringify({
rate_key: 'RATE_a7b3c1d9e2f4',
user_id: 1001,
currency: 'USD',
client_nationality: 'IN',
agent_ref_no: 'MY-REF-20260801-001',
message: 'Late check-in, arriving at 11pm',
rooms: [{
adults: [
{ title: 'Mr', first_name: 'Rahul', last_name: 'Sharma' },
{ title: 'Mrs', first_name: 'Priya', last_name: 'Sharma' }
],
children: []
}]
})
}).then(r => r.json());
console.log(`Booking confirmed: ${booking.refNo}`);
import requests
booking = requests.post('https://api.travelexe.com/api/Hotel/book',
headers={'X-Api-Key': 'your_api_key'},
json={
'rate_key': 'RATE_a7b3c1d9e2f4',
'user_id': 1001,
'currency': 'USD',
'client_nationality': 'IN',
'agent_ref_no': 'MY-REF-20260801-001',
'message': 'Late check-in, arriving at 11pm',
'rooms': [{
'adults': [
{'title': 'Mr', 'first_name': 'Rahul', 'last_name': 'Sharma'},
{'title': 'Mrs', 'first_name': 'Priya', 'last_name': 'Sharma'}
],
'children': []
}]
}
).json()
print(f"Booking confirmed: {booking['refNo']}")