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 14
  • children: Must be between 0 and 6
  • children_ages: Each age must be 17 or less
  • rooms: Must have between 1 and 8 rooms
  • hotel_ids: Maximum 2000 hotel IDs allowed
  • radius: Must be between 1 and 50000 meters
  • check_in / check_out: Must be in YYYY-MM-DD format
  • Location: Exactly one of place_id, destination_id, coordinates, or hotel_ids is 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

  1. Always check the success field before processing the response data
  2. Log error messages for debugging and support requests
  3. Implement retry logic for 500 errors with exponential backoff
  4. Handle expired sessions gracefully by starting a new availability search
  5. 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:

  1. Check that your request matches the API documentation
  2. Verify your API key and environment
  3. Review the error message for specific guidance
  4. Contact support with the full error response and request details

Was this page helpful?