Apinex API Documentation

Search hotels

Search is a two-step process: first you start the search (POST), then you poll for results (GET). This is because the search triggers real-time availability checks across multiple suppliers which takes a few seconds.


POST /api/Hotel/search

Initiates a hotel availability search. Returns a searchId to poll for results.

Request body

Field Type Required Description
city_id string Yes* City code to search in. Get this from /getCode or /destination-completion-list
hotel_codes integer[] No Search specific hotels by code instead of a city
checkin datetime Yes Check-in date and time (ISO 8601)
checkout datetime Yes Check-out date and time (ISO 8601)
rooms Room[] Yes Room configuration (see below)
user_id int64 Yes Your TravelExe user ID
currency string Yes 3-letter currency code (e.g. USD)
client_nationality string Yes 2-letter nationality code (e.g. IN)
cutoff_time integer Yes Minimum hours before check-in to allow booking
star_rating string No Filter by star rating (e.g. "3,4,5")
geolocation object No Search by lat/lng instead of city (see below)
options any No Additional supplier-specific options

Room object

Field Type Description
adults string Number of adults in this room
children_ages array Ages of children (empty array if none)

Geolocation object (optional, use instead of city_id)

Field Type Description
latitude double Latitude coordinate
longitude double Longitude coordinate

Example request

POST /api/Hotel/search
X-Api-Key: your_api_key
Content-Type: application/json

{
  "city_id": "DXB",
  "checkin": "2026-08-01T00:00:00",
  "checkout": "2026-08-05T00:00:00",
  "currency": "USD",
  "client_nationality": "IN",
  "user_id": 1001,
  "cutoff_time": 24,
  "star_rating": "4,5",
  "rooms": [
    { "adults": "2", "children_ages": [] },
    { "adults": "1", "children_ages": [7, 10] }
  ]
}

Example response

{
  "searchId": "srch_7f3a2b19e4",
  "status": "processing",
  "message": "Search initiated. Poll /api/Hotel/search/srch_7f3a2b19e4 for results."
}

Step 2 — Poll for results

`GET /api/Hotel/search/

Fetch the results of a search. Call this repeatedly until results are populated (typically 2–5 seconds).

Path parameters

Parameter Type Required Description
searchId string Yes The search ID returned from the POST step

Example request

GET /api/Hotel/search/srch_7f3a2b19e4
X-Api-Key: your_api_key

Example response

{
  "searchId": "srch_7f3a2b19e4",
  "status": "completed",
  "totalResults": 42,
  "hotels": [
    {
      "giataId": 12345,
      "name": "Grand Hyatt Dubai",
      "starRating": 5,
      "location": "Dubai Creek, Dubai",
      "thumbnail": "https://images.travelexe.com/hotels/12345/main.jpg",
      "lowestPrice": {
        "amount": 280.00,
        "currency": "USD",
        "perNight": 70.00
      },
      "availability": "available"
    },
    {
      "giataId": 12346,
      "name": "Jumeirah Beach Hotel",
      "starRating": 5,
      "location": "Jumeirah Beach, Dubai",
      "thumbnail": "https://images.travelexe.com/hotels/12346/main.jpg",
      "lowestPrice": {
        "amount": 420.00,
        "currency": "USD",
        "perNight": 105.00
      },
      "availability": "available"
    }
  ]
}

Destination autocomplete

Before searching, use this endpoint to resolve a city name to a city_id:

`GET /api/Hotel/destination-completion-list?prefixText=

Parameter Type Required Description
prefixText string Yes Partial city or hotel name to search

Example request

GET /api/Hotel/destination-completion-list?prefixText=dub
X-Api-Key: your_api_key

Example response

[
  { "label": "Dubai, UAE", "value": "DXB", "type": "city" },
  { "label": "Dublin, Ireland", "value": "DUB", "type": "city" },
  { "label": "Dubai Airport Hotel", "value": "HTL-00441", "type": "hotel" }
]

Code samples

var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-Api-Key", "your_api_key");

var searchRequest = new HotelSearchRequest
{
    CityId = "DXB",
    Checkin = new DateTime(2026, 8, 1),
    Checkout = new DateTime(2026, 8, 5),
    Currency = "USD",
    ClientNationality = "IN",
    UserId = 1001,
    CutoffTime = 24,
    Rooms = new[] { new Room { Adults = "2", ChildrenAges = new int[] {} } }
};

var response = await client.PostAsJsonAsync(
    "https://api.travelexe.com/api/Hotel/search", searchRequest);
var result = await response.Content.ReadFromJsonAsync<SearchResponse>();

var searchId = result.SearchId;

// Poll for results
HotelSearchResults results = null;
while (results?.Status != "completed")
{
    await Task.Delay(1500);
    var pollResponse = await client.GetAsync(
        $"https://api.travelexe.com/api/Hotel/search/{searchId}");
    results = await pollResponse.Content.ReadFromJsonAsync<HotelSearchResults>();
}
const headers = {
  'X-Api-Key': 'your_api_key',
  'Content-Type': 'application/json'
};

const { searchId } = await fetch('https://api.travelexe.com/api/Hotel/search', {
  method: 'POST',
  headers,
  body: JSON.stringify({
    city_id: 'DXB',
    checkin: '2026-08-01T00:00:00',
    checkout: '2026-08-05T00:00:00',
    currency: 'USD',
    client_nationality: 'IN',
    user_id: 1001,
    cutoff_time: 24,
    rooms: [{ adults: '2', children_ages: [] }]
  })
}).then(r => r.json());

// Poll until complete
let results;
do {
  await new Promise(r => setTimeout(r, 1500));
  results = await fetch(
    `https://api.travelexe.com/api/Hotel/search/${searchId}`,
    { headers }
  ).then(r => r.json());
} while (results.status !== 'completed');
import requests, time

headers = {'X-Api-Key': 'your_api_key'}

res = requests.post('https://api.travelexe.com/api/Hotel/search', headers=headers, json={
    'city_id': 'DXB',
    'checkin': '2026-08-01T00:00:00',
    'checkout': '2026-08-05T00:00:00',
    'currency': 'USD',
    'client_nationality': 'IN',
    'user_id': 1001,
    'cutoff_time': 24,
    'rooms': [{'adults': '2', 'children_ages': []}]
})
search_id = res.json()['searchId']

# Poll until complete
while True:
    time.sleep(1.5)
    results = requests.get(
        f'https://api.travelexe.com/api/Hotel/search/{search_id}',
        headers=headers
    ).json()
    if results['status'] == 'completed':
        break