Lite API SDK
Table of Contents
Introduction
Lite API The fastest way to build travel apps
Launch your hospitality product in minutes. Effortlessly monetize by selling accommodations at over 2 million properties worldwide.
Don't have an account yet? Sign Up Here
Installing
Using npm:
$ npm install lite-api-sdk
Or using yarn:
$ yarn add lite-api-sdk
Example
note: CommonJS usage
Using CommonJS imports with require()
use the following approach:
const sdk = require('lite-api-sdk')(API_KEY);
Static data
List of cities
The API returns a list of city names from a specific country. The country codes needs be is in ISO-2 format. To get the country codes in ISO-2 for all countries please use the GET Country list endpoint
const countryCode = "IT";
const result = await sdk.citiesList(countryCode);
List of available currencies
The API returns all available currency codes along with its name and the list of supported countries that the currency applies to.
const result = await sdk.currencies();
Hotels
The API returns a list of hotels available based on different search criterion. The minimum required information is the county code in ISO-2 format.
const countryCode = "IT";
const cityName = "Rome";
const offset = 1000;
const limit = 1000;
const longitude = "-115.16988";
const latitude = "36.12510";
const distance = 1000;
const result = await sdk.hotels(countryCode, cityName);
Hotel details
The hotel details API returns all the static contents details of a hotel or property if the hotel ID is provided. The static content include name, description, address, amenities, cancellation policies, images and more.
const hotelID = "lp24373";
const result = await sdk.hotelDetails(hotelID);
Country list
The API returns the list of countries available along with its ISO-2 code.
const result = await sdk.countries();
IATA code list
The API returns the IATA (International Air Transport Association) codes for all available airports along with the name of the airport, geographical coordinates and country code in ISO-2 format.
const result = await sdk.iataCodes();
Booking flow
Lite API is a comprehensive and simple to implement Hotel Booking API. The booking flow consists of 3 steps: Search, preBook, and Confirm. The API also allows booking cancellations as well as static data retrieval.
Search
Hotel Minimum Rates
is to search and return the minimum room rates that are available for a list of hotel ID's on the specified search dates.
For each hotel ID, the minimum room rate that is available is returned.
The API also has a built in loyalty rewards system. The system rewards return users who have made prior bookings.
If the search is coming from a known guest ID, the guest level is also returned along with the pricing that's appropriate for the guest level.
If it is a new user, the guest ID will be generated at the time of the first confirmed booking.
const checkin = "2023-07-15";
const checkout = "2023-07-16";
const currency = "USD";
const guestNationality = "US";
const hotelIdsList = ["lp3803c", "lp1f982", "lp19b70", "lp19e75"];
const adults = 2;
const childrenAges = [2,3];
const result = await sdk.getMinimumRates(checkin, checkout, currency, guestNationality, hotelIdsList, adults,childrenAges);
hotel full rates availability
The Full Rates API is to search and return all available rooms along with its rates, cancellation policies for a list of hotel ID's based on the search dates.
For each hotel ID, all available room information is returned.
The API also has a built in loyalty rewards system. The system rewards return users who have made prior bookings.
If the search is coming from a known guest ID, the guest level is also returned along with the pricing that's appropriate for the guest level.
If it is a new user, the guest ID will be generated at the time of the first confirmed booking.
const checkin = "2023-07-15";
const checkout = "2023-07-16";
const currency = "USD";
const guestNationality = "US";
const hotelIdsList = ["lp3803c", "lp1f982", "lp19b70", "lp19e75"];
const adults = 2;
const childrenAges = [2,3];
const result = await sdk.getFullRates(checkin, checkout, currency, guestNationality, hotelIdsList, adults,childrenAges);
Pre-book
This API is used to confirm if the room and rates for the search criterion. The input to the endpoint is a specific rate Id coming from the GET hotel full rates availability API.
In response, the API generates a prebook Id, a new rate Id and contains information if price, cancellation policy or boarding information has changed.
const rateId = "NRYDCZRZHAZHYMRQGIZS2MJRFUYTK7BS";
const result = await sdk.preBook(rateId)
Confirm booking
This API confirms a booking when the prebook Id and the rate Id from the pre book stage along with the guest and payment information are passed.
The guest information is an object that should include the guest first name, last name and email.
The payment information is an object that should include the name, credit card number, expiry and CVC number.
The response will confirm the booking along with a booking Id and a hotel confirmation code. It will also include the booking details including the dates, price and the cancellation policies.
const prebookID = "-4e0EKQMb";
const guestInfo = { guestFirstName: 'Kim', guestLastName: 'James', guestEmail: 'test@nlite.ml' };
const paymentMethod = "CREDIT_CARD";
const holderName = "Kim James";
const paymentInfo = { "card_number": "4242424242424242", "exp_month": 11, exp_year: "23", "cvc": 123 }
const result = await sdk.book(prebookID, guestInfo, paymentMethod, holderName, paymentInfo)
Cancel booking
This API is used to request a cancellation of an existing confirmed booking. Cancellation policies and conditions will be used to determine the success of the cancellation. For example a booking with non-refundable (NRFN) tag or a booking with a cancellation policy that was requested past the cancellation date will not be able to cancel the confirmed booking.
const bookingId = "FrT56hfty";
const result = await sdk.cancelBooking(bookingId);
Get booking details by id
The API returns the status and the details for the a specific booking Id.
const bookingId = "FrT56hfty";
const result = await sdk.retrievedBooking(bookingId);