Getting Started with the Xeni Hotels API
The Xeni Hotels API gives you programmatic access to over 2 million hotel properties worldwide. With a single integration, you can search for hotels, check real-time availability and pricing, and complete bookings entirely via API — all through a clean, RESTful interface.
What You Can Do
The Hotels API v2 supports the full booking lifecycle:
- Search locations — Autocomplete city, region, or specific hotel names and retrieve geographic coordinates.
- Search hotels — Query available properties by location, dates, occupancy, star ratings, amenities, and price range.
- Get hotel details — Retrieve full property information including photos, amenities, policies, and guest reviews.
- Check room availability — View available room types with real-time pricing for specific dates and guest counts.
- Confirm pricing — Lock in a rate for up to 10 minutes and receive a final pricing token.
- Create bookings — Book programmatically via the API using your own payment processor, Xeni's merchant, or by redirecting guests to Xeni's hosted SSO checkout page.
- Manage bookings — Retrieve booking details and process cancellations by booking ID.
Environments
| Environment | Base URL | Purpose |
|---|---|---|
| UAT (Sandbox) | https://uat.travelapi.ai | Development and testing. No real bookings are created. |
| Production | https://api.travelapi.ai | Live environment. Real bookings with real charges. |
We recommend building and testing your integration against the UAT environment before switching to production. The API surface is identical across both environments.
API Versioning
All hotel endpoints use the v2 path prefix. For example:
GET /hotels/api/v2/autocompletePOST /hotels/api/v2/propertiesGET /hotels/api/v2/property/{propertyid}POST /hotels/api/v2/properties/availabilityGET /hotels/api/v2/properties/pricePOST /hotels/api/v2/bookingsGET /hotels/api/v2/bookings/{bookingid}PATCH /hotels/api/v2/bookings/{booking_id}
Prerequisites
Before you begin, you'll need:
- API Key — Your unique API key, provided during onboarding.
- API Secret — Your secret key, used alongside the API key to generate authentication signatures.
If you haven't received your credentials yet, contact your Xeni account representative.
Quick Start: Your First Hotel Search
Here's the minimum flow to search for hotels. Each step is covered in detail in subsequent articles.
Step 1 — Authenticate
Generate a signature by calling the authentication endpoint with your API key, secret, and a Unix timestamp.
POST /identity/v2/auth/generate
{ "api_key": "your-api-key", "secret": "your-api-secret", "timestamp": 1700000000}
// Response{ "signature": "eyJhbGciOi..."}
The signature is valid for 30 minutes. Include it in the Authorization header of all subsequent requests.
Step 2 — Search for a Location
Use the autocomplete endpoint to resolve a destination name to coordinates.
GET /hotels/api/v2/autocomplete?key=Miami
// Response{ "data": [ { "id": "12345", "name": "Miami", "full_name": "Miami, Florida, United States", "country": "United States", "state": "Florida", "location": { "lat": 25.7617, "long": -80.1918 } } ]}
Important: The response headers will include an x-correlation-id. Save this value — it must be passed in the headers of all subsequent API calls within this search session.
Step 3 — Search Hotels
Using the coordinates and correlation ID from the previous step, search for available hotels.
POST /hotels/api/v2/properties?page=1&limit=20
Headers: Authorization: {signature} x-correlation-id: {correlation_id}
{ "checkindate": "2025-03-15", "checkoutdate": "2025-03-18", "occupancy": [ { "adults": 2, "childs": 0, "childages": [] } ], "lat": 25.7617, "long": -80.1918, "countryofresidence": "US", "sort": [{ "key": "price", "order": "asc" }], "filters": { "ratings": [] }, "is_async": false}
// Response{ "data": { "total": 321, "hotels": [ { "propertyid": "XN00012345", "name": "Oceanview Resort & Spa", "ratings": { "starrating": 4, "userrating": 8.5 }, "rate": { "baserate": 189.00, "totalrate": 567.00, "currency": "USD", "taxandfees": 63.50 }, "amenities": ["Free WiFi", "Pool", "Spa"], "image": { "large": "https://..." }, "contact": { "address": { "line1": "123 Ocean Drive", "city": "Miami Beach", "state": "FL", "postal_code": "33139" } } } ] }}
What's Next?
From here, the typical flow continues with:
- Retrieving hotel details for a specific property
- Checking room availability to see room types and real-time pricing
- Confirming the price to lock in a rate
- Completing the booking — via direct API call (with your own or Xeni's payment processor) or by redirecting the guest to Xeni's SSO checkout page
Content Type & Headers
All requests should include the following headers:
| Header | Value | Required |
|---|---|---|
Content-Type | application/json | Yes |
Authorization | Your API signature | Yes |
x-correlation-id | Correlation ID from initial API response | After first call |
Response Format
All API responses return JSON. Successful responses wrap their payload in a data property:
{ "data": { ... }}
Error responses follow a consistent structure:
{
"message": "Description of the error",
"status": 400
} *
](#article-2)_