Flights API Error Codes and Troubleshooting
This article covers error responses you may encounter across all Flights API v2 endpoints, along with common issues and how to resolve them.
HTTP Status Codes
| Status Code | Meaning | Description |
|---|---|---|
| 200 | OK | Request succeeded. |
| 400 | Bad Request | The request is malformed, missing required fields, or contains invalid values. |
| 401 | Unauthorized | Missing or invalid x-api-key. |
| 403 | Forbidden | Your API key does not have permission for this endpoint or action. |
| 404 | Not Found | The requested resource does not exist (e.g., invalid booking ID or expired token). |
| 422 | Unprocessable Entity | The request is well-formed but contains semantic errors (e.g., departure date in the past). |
| 429 | Too Many Requests | Rate limit exceeded. Slow down your request rate. |
| 500 | Internal Server Error | An unexpected error occurred on the server. Retry the request. |
| 502 | Bad Gateway | Upstream service temporarily unavailable. Retry after a short delay. |
| 503 | Service Unavailable | The API is temporarily down for maintenance. Retry later. |
Error Response Format
All error responses follow a consistent format:
{
"status": "error",
"data": null,
"message": "A human-readable description of the error."
}Errors by Endpoint
Autocomplete
| Error | Cause | Resolution |
|---|---|---|
| 400 - Invalid key parameter | The key query parameter is missing, empty, or contains invalid characters. | Provide a valid airport name or IATA code with at least 1 character. |
| 500 - Internal server error | Unexpected server failure. | Retry the request. If the issue persists, contact support. |
Search
| Error | Cause | Resolution |
|---|---|---|
| 400 - Missing required fields | Required fields like flightinfo, routetype, cabintype, or adults are missing. | Check your request body against the required fields documented in How to Search for Flights. |
| 400 - Invalid routetype | routetype is not "Oneway" or "Return". | Use exactly "Oneway" or "Return" (case-sensitive). |
| 400 - Invalid cabintype | cabintype is not one of the accepted values. | Use "economy", "business", "premium", or "first" (lowercase). |
| 400 - Invalid date format | departuredate is not in YYYY-MM-DD format. | Use the format YYYY-MM-DD. |
| 400 - Missing x-correlation-id | The x-correlation-id header is not present. | Capture the x-correlation-id from the autocomplete response headers and include it in your search request. |
| 422 - Departure date in the past | The departure date has already passed. | Use a future date. |
| 422 - Invalid passenger count | Infant count exceeds adult count, or passenger count is zero. | Ensure at least 1 adult. Infants cannot exceed the number of adults. |
Availability
| Error | Cause | Resolution |
|---|---|---|
| 404 - Session not found | The cabinsearchsessionid is invalid or has expired. | Run a new search to obtain a fresh cabinsearchsessionid. Search sessions expire after a period of inactivity. |
| 400 - Missing x-correlation-id | The correlation ID header is missing. | Include the x-correlation-id header. |
Fare Rules
| Error | Cause | Resolution |
|---|---|---|
| 404 - Token not found | The cabinavailabilitytoken is invalid or has expired. | Run a new availability check to obtain a fresh token. |
Create Booking
| Error | Cause | Resolution |
|---|---|---|
| 400 - Missing traveler information | Required traveler fields are missing or incomplete. | Ensure every traveler has type, gender, title, firstname, lastname, and dateofbirth. |
| 400 - Missing passport details | Passport details are required but not provided. | If ispassportrequired was true in the availability response, include passport with passportnumber, expirydate, and country for each traveler. |
| 400 - Invalid token | The cabinavailabilitytoken is invalid or expired. | Run a new availability check. Tokens have a limited validity window. |
| 400 - Passenger count mismatch | The number of entries in traveler_info does not match the passenger count from the original search. | Ensure the array length equals adults + children + infants. |
| 422 - Token expired | The availability token has expired since it was issued. | Request a new availability check and proceed with the fresh token. |
Confirm / Cancel Booking
| Error | Cause | Resolution |
|---|---|---|
| 404 - Booking not found | The bookingid does not exist. | Verify the booking ID is correct. |
| 400 - Invalid bookingstatus | The booking_status value is not "Confirm" or "Cancel". | Use exactly "Confirm" or "Cancel" (case-sensitive). |
| 422 - Booking already cancelled | Attempting to confirm or modify a cancelled booking. | The booking cannot be modified once cancelled. Create a new booking. |
| 422 - Booking already ticketed | Attempting to confirm an already ticketed booking. | The booking is already confirmed. No further action is needed. |
| 422 - Ticket time limit exceeded | The ticket time limit has passed for a BOOKED reservation. | The reservation has been released. Create a new booking. |
Get Booking Details
| Error | Cause | Resolution |
|---|---|---|
| 400 - Missing bookingid | The bookingid query parameter is missing. | Include booking_id as a query parameter. |
| 404 - Booking not found | No booking exists with the given ID. | Verify the booking ID. |
Common Issues and Troubleshooting
"Missing x-correlation-id" on every request after autocomplete
The x-correlation-id is returned in the response headers (not the response body) of the autocomplete call. Make sure your HTTP client captures response headers and forwards the value to subsequent requests.
Search returns empty results
- Verify the origin and destination airport codes are valid IATA codes.
- Check that the departure date is in the future.
- Try broadening your filters (remove stop or airline restrictions).
- Ensure
cabin_typematches available inventory for the route.
"Session not found" on availability check
Search sessions expire after a period of inactivity. If too much time has passed since the search, run a new search to get a fresh cabinsearchsession_id.
"Token expired" when creating a booking
The cabinavailabilitytoken has a limited validity window. Complete the booking promptly after the availability check. If the token expires, run the availability check again.
Booking status remains "TICKETINPROCESS"
Ticketing can take a few moments to complete. Poll the Get Booking Details endpoint at reasonable intervals (e.g., every 10-15 seconds) to check for a final status.
Cancellation penalties applied unexpectedly
Review the fare rules before cancelling. Use the Fare Rules endpoint to check whether the fare is cancellable and what penalties apply per passenger type.
Best Practices
- Always capture the
x-correlation-idfrom autocomplete response headers and pass it through the entire flow. - Handle token expiration gracefully. Build retry logic that re-runs availability checks when tokens expire.
- Validate inputs before sending requests. Check date formats, required fields, and passenger counts on the client side to reduce 400 errors.
- Implement exponential backoff for 429, 500, 502, and 503 errors.
- Log correlation IDs. Include the
x-correlation-idin your logs to help Xeni support trace issues across the flow.
Getting Help
If you encounter persistent errors or unexpected behavior, contact Xeni support at customersupport@xeni.com with:
- The
x-correlation-idfor the affected request chain - The full request and response (with sensitive data redacted)
- The endpoint and HTTP method
- Timestamps of when the error occurred
Related Articles
- Getting Started with the Xeni Flights API — Overview of the API and booking flow.
- How to Search for Airports Using Autocomplete — First step in the flow where the correlation ID is obtained.