Quickstart
This guide will get you set up and ready to use the TripEdge API. We will cover the complete booking flow from searching for hotels to confirming a reservation.
Before you begin, you will need your API key. Contact your account manager if you have not received one.
The booking flow
The TripEdge API follows a structured booking flow:
- Search for a destination using the Places API
- Search for availability to get hotels and their lowest rates
- Get hotel details to see all available rates for a specific hotel
- Create a prebook to validate the rate and prepare for booking
- Create the booking with guest details and payment
Step 1: Search for a destination
First, find the destination where the guest wants to stay. The Places API does not require authentication.
Request
curl -G https://api.tripedge.com/v1/places/search \
-d text_query="Miami Beach"
Response
{
"data": {
"results": [
{
"place_id": "ChIJEYrhU64D2YgRE9wTEn6h9lo",
"display_name": "Miami Beach, FL, USA",
"formatted_address": "Miami Beach, FL, USA",
"types": ["locality", "political"]
}
]
},
"success": true
}
Step 2: Search for availability
Use the place_id to search for available hotels. Poll this endpoint for approximately 10 seconds to receive results from all vendors.
Request
curl -X POST https://api.tripedge.com/v1/availability \
-H "Authorization: Bearer {your_api_key}" \
-H "Content-Type: application/json" \
-d '{
"place_id": "ChIJEYrhU64D2YgRE9wTEn6h9lo",
"check_in": "2024-03-15",
"check_out": "2024-03-18",
"rooms": [
{
"adults": 2,
"children": 0,
"children_ages": []
}
]
}'
Response
{
"data": {
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"search_completed": true,
"results": [
{
"hotel": {
"id": 12345,
"name": "Ocean View Resort",
"stars": 4.5,
"lowest_rate": {
"id": "rate-abc123",
"price_chargeable": 450.00,
"price_currency": "USD"
}
}
}
]
},
"success": true
}
Step 3: Get hotel details
When a guest selects a hotel, fetch all available rates. Poll for approximately 5 seconds.
Request
curl https://api.tripedge.com/v1/hotel/12345/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer {your_api_key}"
Response
{
"data": {
"hotel": {
"id": 12345,
"name": "Ocean View Resort",
"stars": 4.5,
"amenities": ["pool", "spa", "wifi", "gym"]
},
"rates": [
{
"id": "rate-abc123",
"rooms": [{ "name": "Deluxe Ocean View", "board": "BB" }],
"price_chargeable": 450.00,
"price_currency": "USD",
"cancellation_policy": "Refundable"
},
{
"id": "rate-def456",
"rooms": [{ "name": "Standard Room", "board": "RO" }],
"price_chargeable": 320.00,
"price_currency": "USD",
"cancellation_policy": "NonRefundable"
}
]
},
"success": true
}
Step 4: Create a prebook
Before booking, validate the rate is still available. This step also calculates the final price.
Request
curl https://api.tripedge.com/v1/prebook/12345/550e8400-e29b-41d4-a716-446655440000/rate-abc123/account \
-H "Authorization: Bearer {your_api_key}"
Response
{
"data": {
"hotel": { "id": 12345, "name": "Ocean View Resort" },
"nights": 3,
"rate": {
"id": "rate-abc123",
"price_chargeable": 450.00,
"cancellation_policy": "Refundable"
},
"remarks": "Check-in: 3:00 PM. Check-out: 11:00 AM.",
"is_booking_processing": false
},
"success": true
}
Step 5: Create the booking
Finally, create the booking with guest information.
Request
curl -X POST https://api.tripedge.com/v1/book/12345/550e8400-e29b-41d4-a716-446655440000/rate-abc123/account \
-H "Authorization: Bearer {your_api_key}" \
-H "Content-Type: application/json" \
-d '{
"rooms": [
{
"lead_first_name": "John",
"lead_last_name": "Smith"
}
],
"email": "john.smith@example.com",
"phone": "+1234567890"
}'
Response
{
"data": {
"id": 98765,
"status": "confirmed",
"booking_reference": ["HTL123456"],
"voucher_url": "https://api.tripedge.com/vouchers/98765.pdf",
"hotel_id": 12345,
"check_in": "2024-03-15",
"check_out": "2024-03-18",
"nights": 3,
"first_name": "John",
"last_name": "Smith",
"price_chargeable": 450.00,
"price_currency": "USD"
},
"success": true
}
What is next?
You have completed your first booking. Here are some next steps: