Prebook
The prebook endpoint validates a selected rate and prepares the booking session. This is a required step before creating a booking, ensuring the rate is still available and the price has not changed.
The prebook response model
PrebookCreateResponse
- Name
search- Type
- PrebookSearch
- Description
Original search parameters.
- Name
hotel- Type
- HotelDetails
- Description
Hotel details for the selected property.
- Name
nights- Type
- integer
- Description
Number of nights for the stay.
- Name
rooms- Type
- array of Room
- Description
Room configuration with adults, children, and children_ages.
- Name
rate- Type
- HotelRate
- Description
The validated rate with current pricing.
- Name
remarks- Type
- string
- Description
Important booking remarks (check-in time, requirements, etc.).
- Name
is_booking_processing- Type
- boolean
- Description
Whether a booking is already being processed for this prebook.
- Name
booking_id- Type
- integer
- Description
Existing booking ID if booking is already processing.
- Name
payment_session_token- Type
- string
- Description
Token for credit card payment processing (only for credit_card payment method).
- Name
promo_code_response- Type
- PromoCodeResponse
- Description
Promo code validation result if a code was applied.
PrebookSearch object
- Name
destination_id- Type
- string
- Description
Internal destination identifier (if used).
- Name
place_id- Type
- string
- Description
Google Places ID (if used).
- Name
coordinates- Type
- Coordinates
- Description
Search coordinates (if used).
- Name
radius- Type
- integer
- Description
Search radius in meters (if used).
- Name
check_in- Type
- string
- Description
Check-in date (YYYY-MM-DD).
- Name
check_out- Type
- string
- Description
Check-out date (YYYY-MM-DD).
- Name
rooms- Type
- array of RoomRequest
- Description
Room configuration from original search.
RoomRequest object
- Name
adults- Type
- integer
- Description
Number of adults.
- Name
children- Type
- integer
- Description
Number of children.
- Name
children_ages- Type
- array of integers
- Description
Ages of children.
Room object
- Name
adults- Type
- integer
- Description
Number of adults (1-14).
- Name
children- Type
- integer
- Description
Number of children (0-6).
- Name
children_ages- Type
- array of integers
- Description
Array of child ages (0-17 each).
PromoCodeResponse object
- Name
success- Type
- boolean
- Description
Whether the promo code was valid.
- Name
message- Type
- string
- Description
Validation message.
- Name
discount_amount- Type
- number
- Description
Discount amount if valid.
HotelDetails object
See the Hotel documentation for the full HotelDetails schema.
HotelRate object
See the Hotel documentation for the full HotelRate schema.
Create prebook (Account)
Creates a prebook for account-based payment. Validates the rate and checks if the client has sufficient funds.
Path parameters
- Name
hotel_id- Type
- integer
- Description
The hotel identifier.
- Name
session_id- Type
- uuid
- Description
The session ID from availability search.
- Name
rate_id- Type
- uuid
- Description
The rate identifier to prebook.
Error responses
400 Bad Request- Insufficient funds in client account404 Not Found- Rate not available or session expired
Request
curl https://api.tripedge.com/v1/prebook/1234/550e8400-e29b-41d4-a716-446655440000/a1b2c3d4-e5f6-7890-abcd-ef1234567890/account \
-H "Authorization: Bearer {token}"
Response
{
"data": {
"search": {
"destination_id": null,
"place_id": "ChIJOwg_06VPwokRYv534QaPC8g",
"coordinates": null,
"radius": null,
"check_in": "2024-03-15",
"check_out": "2024-03-18",
"rooms": [
{
"adults": 2,
"children": 1,
"children_ages": [5]
}
]
},
"hotel": {
"id": 1234,
"name": "Grand Hotel New York",
"stars": 5.0,
"rating": 4.5,
"review_count": 1200,
"lowest_rate": null,
"lowest_brand_loyalty_rate": null,
"minimum_age": 18,
"amenities": ["pool", "spa", "wifi", "gym", "restaurant"],
"check_in_begin_time": "15:00",
"check_in_end_time": "23:00",
"check_out_before_time": "11:00",
"description": "Luxury hotel in the heart of Manhattan...",
"images": ["https://images.tripedge.com/hotels/1234/main.jpg"],
"coordinates": { "lat": 40.7128, "lng": -74.0060 },
"address": {
"address": "123 Main Street",
"city": "New York",
"country": "US",
"postal_code": "10001",
"region": "NY"
},
"type": "hotel",
"exclusive": false
},
"nights": 3,
"rooms": [
{
"adults": 2,
"children": 1,
"children_ages": [5]
}
],
"rate": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"hotel_id": 1234,
"rooms": [
{
"name": "Deluxe King Room",
"board": "BB",
"room_data": {
"images": ["https://images.tripedge.com/rooms/deluxe-king.jpg"],
"size_sqft": 450,
"size_sqm": 42,
"max_occupancy": 3,
"beds": [{ "name": "King", "size": "king", "quantity": 1 }],
"amenities": ["minibar", "safe", "balcony"],
"room_id": 101
},
"price_per_night_avg": 250.00,
"price_per_night": [250.00, 250.00, 250.00],
"price_chargeable": 750.00,
"price_per_room": 750.00,
"price_before_fees": 700.00,
"price_fees": 50.00,
"price_due_at_hotel": 0.00,
"price_inclusive": 750.00,
"price_currency": "USD",
"fees": [
{ "name": "City Tax", "price": 30.00, "due_at_hotel": false, "price_currency": "USD" },
{ "name": "Service Fee", "price": 20.00, "due_at_hotel": false, "price_currency": "USD" }
],
"adults": 2,
"children": 1,
"children_ages": [5]
}
],
"price_per_night_avg": 250.00,
"price_per_night": [250.00, 250.00, 250.00],
"price_chargeable": 750.00,
"price_per_room": [750.00],
"price_per_night_per_room": [[250.00, 250.00, 250.00]],
"price_before_fees": 700.00,
"price_fees": 50.00,
"price_due_at_hotel": 0.00,
"price_inclusive": 750.00,
"price_currency": "USD",
"price_retail": 850.00,
"cancellation_policy": "Refundable",
"cancellation_policy_datetime": "2024-03-14T23:59:00Z",
"cancellation_policy_data": [
{
"from_datetime": "2024-03-14T23:59:00Z",
"price_cancellation_penalty": 250.00,
"price_currency": "USD"
}
],
"brand_loyalty_eligible": true,
"brand_loyalty_required": false,
"brand_loyalty_name": "Marriott Bonvoy",
"elite": null,
"price_commission": 75.00,
"price_commission_currency": "USD",
"payment_type": "account"
},
"remarks": "Check-in time: 3:00 PM. Photo ID required at check-in. Credit card required for incidentals.",
"is_booking_processing": false,
"booking_id": null,
"payment_session_token": null,
"promo_code_response": null
},
"success": true,
"message": null
}
Create prebook (Credit Card)
Creates a prebook for credit card payment. Returns a payment session token for processing the credit card transaction.
Path parameters
- Name
hotel_id- Type
- integer
- Description
The hotel identifier.
- Name
session_id- Type
- uuid
- Description
The session ID from availability search.
- Name
rate_id- Type
- uuid
- Description
The rate identifier to prebook.
Request
curl https://api.tripedge.com/v1/prebook/1234/550e8400-e29b-41d4-a716-446655440000/a1b2c3d4-e5f6-7890-abcd-ef1234567890/credit_card \
-H "Authorization: Bearer {token}"
Response
{
"data": {
"search": {
"destination_id": null,
"place_id": "ChIJOwg_06VPwokRYv534QaPC8g",
"coordinates": null,
"radius": null,
"check_in": "2024-03-15",
"check_out": "2024-03-18",
"rooms": [{ "adults": 2, "children": 0, "children_ages": [] }]
},
"hotel": {
"id": 1234,
"name": "Grand Hotel New York",
"stars": 5.0,
"rating": 4.5,
"review_count": 1200,
"amenities": ["pool", "spa", "wifi"],
"address": {
"address": "123 Main Street",
"city": "New York",
"country": "US",
"postal_code": "10001",
"region": "NY"
},
"type": "hotel",
"exclusive": false
},
"nights": 3,
"rooms": [{ "adults": 2, "children": 0, "children_ages": [] }],
"rate": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"hotel_id": 1234,
"price_chargeable": 750.00,
"price_currency": "USD",
"cancellation_policy": "Refundable",
"payment_type": "credit_card"
},
"remarks": "Check-in time: 3:00 PM.",
"is_booking_processing": false,
"booking_id": null,
"payment_session_token": "ps_1234567890abcdef",
"promo_code_response": null
},
"success": true,
"message": null
}
Get cancellation details
Retrieves cancellation penalty information for an existing booking. Call this before cancelling to show the user the cancellation cost.
Path parameters
- Name
booking_id- Type
- integer
- Description
The booking identifier.
Response model
- Name
price_cancellation_penalty- Type
- number
- Description
The penalty amount that will be charged if cancelled.
- Name
price_currency- Type
- string
- Description
Currency code for the penalty.
Request
curl https://api.tripedge.com/v1/book/precancel/12345 \
-H "Authorization: Bearer {token}"
Response
{
"data": {
"price_cancellation_penalty": 250.00,
"price_currency": "USD"
},
"success": true,
"message": null
}
Cancel booking
Cancels an existing booking. The cancellation penalty from precancel will be applied.
Path parameters
- Name
booking_id- Type
- integer
- Description
The booking identifier.
Request
curl -X POST https://api.tripedge.com/v1/book/cancel/12345 \
-H "Authorization: Bearer {token}"
Response
{
"data": {
"cancelled": true,
"cancellation_reference": "CXL123456"
},
"success": true,
"message": null
}