Socket
Socket
Sign inDemoInstall

liteapi-travel

Package Overview
Dependencies
0
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    liteapi-travel

The **liteAPI** can be used to to do the following Get room rates & availability for a set of hotels Select a specific hotel with room availability and make a booking Manage the bookings - retrieve and cancel existing bookings Get static content for hote


Version published
Weekly downloads
4
decreased by-69.23%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

liteAPI SDK

Table of Contents

Introduction

liteAPI The fastest way to build travel apps Launch your hospitality product in minutes. Effortlessly monetize by selling accommodations at over 2 million properties worldwide.

The liteAPI can be used to to do the following:

  • Get room rates & availability for a set of hotels.
  • Select a specific hotel with room availability and make a booking
  • Manage the bookings
  • retrieve and cancel existing bookings.
  • Get static content for hotels.
  • Search hotels by destination.

Don't have an account yet? Sign Up Here.

Installing

Install the package with:

npm install liteapi-travel
# or
yarn add liteapi-travel

Usage

The package needs to be configured with your account's apikey, which is available in the liteAPI Dashboard. Require it with the key's value:

const liteApi = require('liteapi-travel')(YOUR_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

  • Example :
    const countryCode = "IT";
    const result = await liteApi.getCitiesByCountryCode(countryCode);
  • Parameters :
NameTypeDescriptionNotes
countryCodestringCountry code in iso-2 format (example: US)[required]
  • Return type :

An array of city objects containing the following properties:

FieldTypeDescription
citystringThe name of the city.

List of Countries

The API returns the list of countries available along with its ISO-2 code.

  • Example :
      const result = await liteApi.getCountries();
  • Parameters :

This endpoint does not need any parameter.

  • Return type :

An array of country objects containing the following properties:

FieldTypeDescription
codestringThe country code in iso-2 format.
namestringThe name of the country.

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.

  • Example :
    const result = await liteApi.getCurrencies();
  • Parameters :

This endpoint does not need any parameter.

  • Return type :

An array of currency objects containing the following properties:

NameTypeDescription
codestringThe currency code.
currencystringThe name of the currency.
countriesArrayAn array of countries where the currency is used.

List of 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.

  • Example :
    const countryCode = "IT";
    const cityName = "Rome";
    //Optional values
    const offset = 1000;
    const limit = 1000;
    const longitude = "-115.16988";
    const latitude = "36.12510";
    const distance = 1000;

    const result = await liteApi.getHotels(countryCode, cityName);

To utilize optional values, you can invoke the function as follows:

    const result = await liteApi.getHotels(countryCode, cityName, offset, limit, longitude, latitude, distance)
  • Parameters :
NameTypeDescriptionNotes
countryCodestringcountry code ISO-2 code - example (US)[required]
cityNamestringname of the city[required]
offsetnumberspecifies the number of rows to skip before starting to return rows[optional]
limitnumberlimit number of results (max 1000)[optional]
longitudestringlongitude geo coordinates[optional]
latitudestringlatitude geo coordinates[optional]
distancenumberdistance in meters (min 1000m)[optional]
  • Return type :

An array of hotel objects containing the following properties:

NameTypeDescription
idstringThe unique identifier of the hotel.
namestringThe name of the hotel.
hotelDescriptionstringThe description of the hotel.
currencystringThe currency used in the hotel.
countrystringThe country code of the hotel.
citystringThe city where the hotel is located.
latitudenumberThe latitude coordinates of the hotel's location.
longitudenumberThe longitude coordinates of the hotel's location.
addressstringThe address of the hotel.
zipstringThe postal code of the hotel.
main_photostringThe URL of the main photo of the hotel.
starsnumberThe star rating of the hotel.

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.

  • Example :
    const hotelID = "lp24373";
    const result = await liteApi.getHotelDetails(hotelID);
  • Parameters :
NameTypeDescriptionNotes
hotelIdstringUnique ID of a hotel[required]
  • Return type :
NameTypeDescription
idstringThe unique identifier of the hotel.
namestringThe name of the hotel.
hotelDescriptionstringThe description of the hotel.
checkinCheckoutTimesObjectAn object containing the check-in and check-out times of the hotel.
         checkoutstringThe check-out time of the hotel.
         checkinstringThe check-in time of the hotel.
hotelImagesArrayAn array of hotel image objects containing the following properties:
         urlstringThe URL of the hotel image.
        thumbnailUrlstringThe thumbnail URL of the hotel image.
         captionstringThe caption of the hotel image.
         orderstringThe order of the hotel image (null if not applicable).
         defaultImagebooleanIndicates whether the hotel image is the default image or not.
currencystringThe currency used in the hotel.
countrystringThe country code of the hotel.
citystringThe city where the hotel is located.
starRatingnumberThe star rating of the hotel.
locationObjectAn object containing the latitude and longitude coordinates of the hotel's location.
         latitudenumberThe latitude coordinate of the hotel's location.
         longitudenumberThe longitude coordinate of the hotel's location.
addressstringThe address of the hotel.
zipstringThe postal code of the hotel.
chainIdstringThe unique identifier of the hotel chain.
hotelFacilitiesArrayAn array of hotel facilities offered by the hotel.

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.

  • Example :
    const result = await liteApi.getIataCodes();
  • Parameters :

This endpoint does not need any parameter.

  • Return type :

An array of IATA objects with the following properties:

NameTypeDescription
codestringThe IATA code.
namestringThe name of the IATA.
latitudenumberThe latitude coordinates of the IATA.
longitudenumberThe longitude coordinates of the IATA.
countryCodestringThe country code of the IATA.

Booking flow

liteAPI is a comprehensive and simple to implement Hotel Booking API. The booking flow consists of 3 section: Search, Book, and booking management.


Minimum Rates availability


Hotel Minimum Rates API 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.

  • Example :
    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;
    //Optional values
    const childrenAges = [2,3];
    const travelerID = "traveler1";

    const result = await liteApi.getMinimumRates(checkin, checkout, currency, guestNationality, hotelIdsList, adults);

To utilize optional values, you can invoke the function as follows:

    const result = await liteApi.getMinimumRates(checkin, checkout, currency, guestNationality, hotelIdsList, adults,childrenAges,travelerID);
  • Parameters :
NameTypeDescriptionNotes
hotelIdsarray of stringsList of hotelIds[required]
checkinstringCheck in data in YYYY-MM-DD format[required]
checkoutstringCheck out data in YYYY-MM-DD format[required]
currencystringCurrency code - example (USD)[required]
guestNationalitystringGuest nationality ISO-2 code - example (SG)[required]
adultsnumberNumber of adult guests staying[required]
childrenarray of numbersNumber of children staying if any[optional]
guestIdstringUnique traveler ID if available[optional]
  • Return type :

An array of hotel minimum rates objects with the following properties:

NameTypeDescription
hotelIdstringThe ID of the hotel.
currencystringThe currency code for the price.
pricenumberThe price of the hotel.
supplierIdnumberThe ID of the supplier.
supplierstringThe name of the supplier.

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.

  • Example :
    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;
    //Optional values
    const childrenAges = [2,3];
    const travelerID = "traveler1";

    const result = await liteApi.getFullRates(checkin, checkout, currency, guestNationality, hotelIdsList, adults);

To utilize optional values, you can invoke the function as follows:

    const result = await liteApi.getFullRates(checkin, checkout, currency, guestNationality, hotelIdsList, adults,childrenAges,travelerID);
  • Parameters :
NameTypeDescriptionNotes
hotelIdsarray of stringsList of hotelIds[required]
checkinstringCheck in data in YYYY-MM-DD format[required]
checkoutstringCheck out data in YYYY-MM-DD format[required]
currencystringCurrency code - example (USD)[required]
guestNationalitystringGuest nationality ISO-2 code - example (SG)[required]
adultsnumberNumber of adult guests staying[required]
childrenarray of numbersNumber of children staying if any[optional]
guestIdstringUnique traveler ID if available[optional]
  • Return type :

An array of hotel full rates with the following properties:

NameTypeDescription
roomTypeIdstringThe ID of the room type.
supplierstringThe name of the supplier.
supplierIdnumberThe ID of the supplier.
ratesArrayAn array of rate objects containing the pricing and details for each rate within the room type.
         rateIdstringThe ID of the rate.
         namestringThe name of the rate.
         maxOccupancynumberThe maximum occupancy of the room.
         boardTypestringThe type of board included (e.g., Bed Only).
         boardNamestringThe name of the board (e.g., Bed Only).
         priceTypestringThe type of pricing (e.g., commission).
         commissionArrayAn array of commission objects containing the commission amount and currency.
         retailRateObjectAn object containing the retail rate information, including total price, MSP (Marked Selling Price), and taxes and fees.
                 totalArrayAn array of total price objects containing the amount and currency.
                 mspArrayAn array of MSP (Marked Selling Price) objects containing the amount and currency.
                 taxesAndFeesArrayAn array of taxes and fees objects containing information about included or additional charges.
         cancellationPoliciesObjectAn object containing cancellation policy information.
             cancelPolicyInfosArrayAn array of cancellation policy info objects containing information about cancellation time, amount, currency, and type.
             hotelRemarksArrayAn array of hotel remarks.
             refundableTagstringThe tag indicating if the rate is refundable or non-refundable.

Book

Hotel rate prebook


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.

  • Example :
    const rateId = "NRYDCZRZHAZHYMRQGIZS2MBXFUYTK7BSGAZDGLJQG4WTCNT4GJ6HYVKTPRDVSWSEJVMVUV2HIUZUOS2OKJKEOWKZKRCU2QSXJVETGRCTJZKEMR2ZGNMFSTKKIRDUSWKEIVGVUUKHGRMVISZXIJJUOQK2IRDU2QSYI5CTGSCZLJGE6TBVJNLEON2DKZFU4NSGJNKTERKQKFNEKQ2NINCFAUK2IRCU6QSUKBJEWVCFKZJVST2KGZCEGTSSLFEEKWKEINHFUV2HKUZVIUKOJJNE6QSELBHVKQSEI5CVURCTJZBFER2BKJKEOTKKJZDUKWSEKNHEEUSHII3EMRKSKNHVAUK2IRAU2USUI5ATGVCDJVJFCR2FLFCECN2CKRIFCWKUJFHEEVCHLFJFMRKULJCEWSSEIU2ESWSTI5AVURCHJRFFCRZUK5KEGTKRPRKVGRD4PR6DCNRWFYYDC7BSGAZDGLJQG4WTCMT4IJHXYMJSHE2DCMD4GI";
    const result = await liteApi.preBook(rateId)
  • Parameters :
NameTypeDescriptionNotes
rateIdstringrate id retrieved from getFullRates response[required]
  • Return type :

An object containing prebook information and room type details.

NameTypeDescription
prebookIdstringThe ID of the prebook.
hotelIdstringThe ID of the hotel.
currencystringThe currency used for pricing.
termsAndConditionsstringThe terms and conditions (if available).
roomTypesArrayAn array of room type objects containing the following properties:
         ratesArrayAn array of rate objects containing pricing and details for each rate within the room type.
                 rateIdstringThe ID of the rate.
                 namestringThe name of the rate.
                 maxOccupancynumberThe maximum occupancy of the room.
                 boardTypestringThe type of board included (e.g., Bed Only).
                 boardNamestringThe name of the board (e.g., Bed Only).
                 priceTypestringThe type of pricing (e.g., commission).
                 commissionObjectAn array of commission objects containing the commission amount and currency.
                 retailRateObjectAn object containing the retail rate information, including total price, MSP (Marked Selling Price), and taxes and fees.
                          totalObjectAn array of total price objects containing the amount and currency.
                          mspObjectAn array of MSP (Marked Selling Price) objects containing the amount and currency.
                          taxesAndFeesObjectAn array of taxes and fees objects containing information about included or additional charges.
                 cancellationPoliciesObjectAn object containing cancellation policy information.
                          cancelPolicyInfosObjectAn array of cancellation policy info objects containing information about cancellation time, amount, and type.
                          hotelRemarksArrayAn array of hotel remarks.
                          refundableTagstringThe tag indicating if the rate is refundable or non-refundable.
mspnumberThe Marked Selling Price (MSP) for the prebook.
commissionnumberThe commission amount for the prebook.
pricenumberThe price of the prebook.
priceTypestringThe type of pricing (e.g., commission).
priceDifferencePercentnumberThe percentage difference between the retail rate and the Marked Selling Price (MSP).
cancellationChangedbooleanIndicates if there were changes to the cancellation policy.
boardChangedbooleanIndicates if there were changes to the board type.
supplierstringThe name of the supplier.
supplierIdnumberThe ID of the supplier.

Hotel rate book


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.

  • Example :
const prebookId = "8iaO7PXBU";
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,"token":null }

const result = await liteApi.book(prebookId, guestInfo, paymentMethod, holderName, paymentInfo)

  • Parameters :
NameTypeDescriptionNotes
prebookIdstringprebook id retrieved from prebook response[required]
guestInfoobjecttraveler informations[required]
         guestFirstNamestringtraveler first name[required]
         guestLastNamestringtraveler last name[required]
         guestEmailstringtraveler email[required]
paymentMethodstringmethodEnum: "CREDIT_CARD" or "STRIPE_TOKEN"[required]
holderNamestringname of the cardholder[required]
paymentInfoobjectpayment informations[required]
         card_numberstringthe card number associated with the credit card[required if paymentMethod is CREDIT_CARD]
         exp_monthnumberthe expiration month of the credit card[required if paymentMethod is CREDIT_CARD]
         exp_yearnumberthe expiration year of the credit card[required if paymentMethod is CREDIT_CARD]
         cvcnumberthe card verification code (CVC) associated with the credit card[required if paymentMethod is CREDIT_CARD]
         tokenstringtoken provided by Stripe for the payment method.[required if paymentMethod is STRIPE_TOKEN]
  • Return type :

An object containing booking information and room details.

NameTypeDescription
bookingIdstringThe ID of the booking.
clientReferencestringThe client reference.
supplierBookingIdstringThe supplier booking ID.
supplierBookingNamestringThe supplier booking name.
supplierstringThe supplier.
supplierIdnumberThe ID of the supplier.
statusstringThe status of the booking.
hotelConfirmationCodestringThe hotel confirmation code.
checkinstringThe check-in date.
checkoutstringThe check-out date.
hotelobjectAn object containing hotel details.
bookedRoomsarrayAn array of booked room objects.
        roomTypeobjectAn object containing room type details.
        adultsnumberThe number of adults.
        childrennumberThe number of children.
        rateobjectAn object containing rate details.
               maxOccupancynumberThe maximum occupancy.
               retailRateobjectAn object containing the retail rate information, including total price.
guestInfoobjectAn object containing guest details.
createdAtstringThe creation date of the booking.
cancellationPoliciesobjectAn object containing cancellation policies information.
        cancelPolicyInfosObjectAn array of cancellation policy info objects containing information about cancellation time, amount, and type.
        hotelRemarksArrayAn array of hotel remarks.
        refundableTagstringThe tag indicating if the rate is refundable or non-refundable.
pricenumberThe price of the booking.
mspnumberThe MSP (Merchant Service Provider) price.
commissionnumberThe commission amount.
currencystringThe currency of the booking.

Booking management

Booking list


The API returns the list of booking Id's for a given guest Id.

  • Example :
    const guestId = "FrT56hfty";
    const result = await liteApi.getBookingListByGuestId(guestId)
  • Parameters :
NameTypeDescriptionNotes
guestIdstringThe Guest Id of the user[required]
  • Return type :

An array containing objects with the following properties:

NameTypeDescription
bookingIdstringThe booking ID.

Booking retrieve


The API returns the status and the details for the a specific booking Id.

  • Example :
    const bookingId = "uSQ6Zsc5R";
    const result = await liteApi.retrievedBooking(bookingId);
  • Parameters :
NameTypeDescriptionNotes
bookingIdstringThe Booking Id that needs to be retrieved[required]
  • Return type :

An object containing booking information and room details.

NameTypeDescription
bookingIdstringThe booking ID.
clientReferencestringThe client reference.
statusstringThe booking status.
hotelConfirmationCodestringThe hotel confirmation code.
checkinstringThe check-in date.
checkoutstringThe check-out date.
hotelobjectAn object containing hotel details.
bookedRoomsarrayAn array of booked room objects.
        roomTypeobjectAn object containing room type details.
        adultsnumberThe number of adults.
        childrennumberThe number of children.
        rateobjectAn object containing rate details.
               maxOccupancynumberThe maximum occupancy.
               boardTypestringThe board type.
               boardNamestringThe board name.
               retailRateobjectAn object containing the retail rate information, including total price.
guestInfoobjectAn object containing guest information.
createdAtstringThe creation date of the booking.
cancellationPoliciesobjectAn object containing cancellation policy details.
        cancelPolicyInfosObjectAn array of cancellation policy info objects containing information about cancellation time, amount, and type.
        hotelRemarksArrayAn array of hotel remarks.
        refundableTagstringThe tag indicating if the rate is refundable or non-refundable.
currencystringThe currency code.
pricenumberThe price of the booking.

Booking cancel


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.

  • Example :
const bookingId = "K8Hvb-85O";
const result = await liteApi.cancelBooking(bookingId);
  • Parameters :
NameTypeDescriptionNotes
bookingIdstringThe booking Id of the booking you would like to cancel.[required]
  • Return type :
NameTypeDescription
bookingIdstringThe booking ID.
statusstringThe booking status.
cancellation_feenumberThe cancellation fee.
refund_amountnumberThe refund amount.
currencystringThe currency of the booking.

Guest and loyalty

Guests

The guests API returns the unique guest IDs

  • Example :
    const result = await liteApi.getGuestsIds();

If you want to retrieve the guest IDs of a specific user based on their email, you can provide the email as an optional parameter:

    const email = "johndoe@nlite.ml"; //Optional
    const result = await liteApi.getGuestsIds(email);
  • Parameters :
NameTypeDescriptionNotes
emailstringthe guest Email[optional]
  • Return type :

An array containing objects with the following properties:

NameTypeDescription
guestIdstringThe guest ID.

Keywords

FAQs

Last updated on 12 Jul 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc