Errors
This guide covers the error responses you may encounter when using the TripEdge API. Understanding these errors will help you handle edge cases and debug issues in your integration.
All API responses include a success field indicating whether the request succeeded. When success is false, the message field contains a description of the error.
Error response format
{
"success": false,
"message": "Description of what went wrong"
}
HTTP status codes
The TripEdge API uses standard HTTP status codes to indicate the success or failure of requests.
Success codes
- Name
200 OK- Description
The request succeeded. The response body contains the requested data.
- Name
201 Created- Description
A resource was successfully created (e.g., a new booking).
Client error codes
- Name
400 Bad Request- Description
The request was malformed or contained invalid parameters. Check the error message for details.
- Name
401 Unauthorized- Description
Authentication failed. Your API key is missing, invalid, or expired.
- Name
404 Not Found- Description
The requested resource does not exist. This may occur when a session has expired or a rate is no longer available.
Server error codes
- Name
500 Internal Server Error- Description
An unexpected error occurred on our servers. If this persists, contact support.
Common errors
Availability errors
Errors that may occur when searching for availability.
- Name
Validation error- Description
The request contained invalid parameters. The response includes field-specific errors.
- Name
Error in availability search- Description
An internal error occurred while searching for availability.
- Name
No results found for session- Description
The session ID does not exist or has expired.
Validation rules:
adults: Must be between 1 and 14children: Must be between 0 and 6children_ages: Each age must be 17 or lessrooms: Must have between 1 and 8 roomshotel_ids: Maximum 2000 hotel IDs allowedradius: Must be between 1 and 50000 meterscheck_in/check_out: Must be in YYYY-MM-DD format- Location: Exactly one of
place_id,destination_id,coordinates, orhotel_idsis required
Validation error
{
"success": false,
"message": "Validation error",
"errors": {
"adults": [
{ "code": "range", "message": null }
]
}
}
Session and rate errors
Errors related to session and rate management.
- Name
Session not found- Description
The session ID is invalid or has expired. Start a new availability search.
- Name
Rate not available- Description
The rate is no longer available. This may occur if the rate sold out or the vendor no longer offers it.
Session not found
{
"success": false,
"message": "Session not found"
}
Rate not available
{
"success": false,
"message": "Rate not available"
}
Prebook errors
Errors that may occur when creating a prebook.
- Name
Insufficient funds- Description
For account payments, your account balance is insufficient to cover the booking cost.
- Name
Error checking available funds- Description
An internal error occurred while checking your account balance.
- Name
Rate not available- Description
The rate is no longer available or the session has expired.
Insufficient funds
{
"success": false,
"message": "Insufficient funds"
}
Booking errors
Errors that may occur when creating bookings.
- Name
Session not found or expired- Description
The prebook session has expired. Create a new prebook before booking.
- Name
Room count mismatch- Description
The number of rooms in your request does not match the prebook.
- Name
Loyalty number is required for this rate- Description
The selected rate requires a loyalty program number.
- Name
Hotel does not allow booking multiple rooms- Description
Some hotels restrict bookings to a single room.
- Name
Payment failed- Description
The payment could not be processed.
- Name
Payment method error- Description
There was an issue with the payment method.
Session expired
{
"success": false,
"message": "Session not found or expired"
}
Room mismatch
{
"success": false,
"message": "Room count mismatch: expected 2 rooms, got 1"
}
Credit card payment errors
Errors specific to credit card payments.
- Name
Payment token is required- Description
A payment token must be provided for credit card payments.
- Name
Payment first name is required- Description
The cardholder first name is required.
- Name
Payment last name is required- Description
The cardholder last name is required.
- Name
Payment postal code is required- Description
The billing postal code is required.
- Name
Payment expiration (MM/YY) is required for credit card payments- Description
The card expiration date is required.
- Name
Payment expiration must be in MM/YY format- Description
The expiration date format is invalid.
- Name
Invalid month in payment expiration- Description
The month must be between 01 and 12.
- Name
Credit card has expired- Description
The provided card expiration date is in the past.
Missing payment token
{
"success": false,
"message": "Payment token is required"
}
Invalid expiration
{
"success": false,
"message": "Payment expiration must be in MM/YY format (e.g., 09/29)"
}
Cancellation errors
Errors when cancelling bookings.
- Name
Error retrieving cancellation details- Description
An error occurred while fetching cancellation information.
- Name
Error cancelling booking- Description
The cancellation request could not be processed.
Cancellation error
{
"success": false,
"message": "Error cancelling booking"
}
Handling errors
Best practices
- Always check the
successfield before processing the response data - Log error messages for debugging and support requests
- Implement retry logic for 500 errors with exponential backoff
- Handle expired sessions gracefully by starting a new availability search
- Validate input client-side to reduce 400 errors
Example error handling
async function makeApiRequest(url, options) {
const response = await fetch(url, options)
const data = await response.json()
if (!response.ok || !data.success) {
// Handle specific error cases
if (response.status === 401) {
throw new Error('Authentication failed. Check your API key.')
}
if (data.message === 'Session not found' ||
data.message === 'Session not found or expired') {
// Session expired - trigger new search
throw new SessionExpiredError(data.message)
}
if (data.message === 'Rate not available') {
// Rate no longer available - refresh hotel rates
throw new RateUnavailableError(data.message)
}
if (data.message === 'Insufficient funds') {
// Account balance too low
throw new InsufficientFundsError(data.message)
}
if (response.status >= 500) {
// Server error - retry with backoff
throw new ServerError(data.message)
}
throw new ApiError(data.message, response.status)
}
return data
}
Getting help
If you encounter persistent errors or need assistance:
- Check that your request matches the API documentation
- Verify your API key and environment
- Review the error message for specific guidance
- Contact support with the full error response and request details