Documentation

Overview

With APItude it's simple to book! In order to make a booking, you will need to first search for a list of hotels (Availability Request). Then pick one "rateKey" from the results and then book it (Booking Request). That's it!
Some of our Ratekeys have a "RECHECK" tag, for those ones you will need to make an intermediary operation called CheckRate Request which re-evaluates the pricing and availability of this rate. Look at the example below in order to understand the full APItude booking process.

complete_process_confirm_booking
Searching for a hotel rate

Here is an example of how to request availability for a hotel (3424 and 168 are hotel codes of Hotelbeds - for the purposes of this example, we assume that have already used Content API to map the hotelbeds codes against your system) for 2 adults and 1 child, for the check-in date of 15th June 2020 and for 1 night.

{
    "stay": {
        "checkIn": "2021-06-15",
        "checkOut": "2021-06-16"
    },
    "occupancies": [
        {
            "rooms": 1,
            "adults": 2,
            "children": 0
        }
    ],
    "hotels": {
        "hotel": [
            3424,
            168
        ]
    }
}

You may view more details on how to form an Availability request (including more examples) inside our API Reference documentation.

Parsing the results

An Availability Request will return you all the available rates (i.e. "RateKeys") for the hotels you searched for those dates.

{
    "auditData": {
     ...
    },
    "hotels": {
        "hotels": [
            {
                "code": 3424,
                "name": "As Americas",
                "exclusiveDeal": 2,
                "categoryCode": "4EST",
                "categoryName": "4 STARS",
                "destinationCode": "CEN",
                "destinationName": "Centre Portugal",
                "zoneCode": 60,
                "zoneName": "Aveiro",
                "latitude": "40.6444523509645",
                "longitude": "-8.64594072098043",
                "rooms": [
                    {
                        "code": "DBL.ST",
                        "name": "DOUBLE STANDARD",
                        "rates": [
                            {
                                "rateKey": "20210615|20210616|W|59|3424|DBL.ST|ID_B2B_26|BB||1~2~0||N@05~~2608a~-321744190~N~~~C7AA6D2F0EC744F159074087674900AAUS0000002000000000721b76",
                                "rateClass": "NOR",
                                "rateType": "RECHECK",
                                "net": "118.27",
                                "allotment": 5,
                                "paymentType": "AT_WEB",
                                "packaging": false,
                                "boardCode": "BB",
                                "boardName": "BED AND BREAKFAST",
                                "cancellationPolicies": [
                                    {
                                        "amount": "118.27",
                                        "from": "2020-06-11T23:59:00+01:00"
                                    }
                                ],
                                "taxes": {
                                    "taxes": [
                                        {
                                            "included": true,
                                            "amount": "6.69",
                                            "currency": "USD",
                                            "type": "TAXESANDFEES"
                                        }
                                    ],
                                    "allIncluded": true
                                },
                                "rooms": 1,
                                "adults": 2,
                                "children": 0
                            },
                            {
                                "rateKey": "20210615|20210616|W|59|3424|DBL.ST|CGW-BAR-BB|BB||1~2~0||N@05~~20096~527249463~S~~~CD14122538964FC159229325413900AAUK0000002000100010622781",
                                "rateClass": "NOR",
                                "rateType": "BOOKABLE",
                                "net": "129.39",
                                "sellingRate": "150.00",
                                "hotelMandatory": true,
                                "allotment": 5,
                                "paymentType": "AT_WEB",
                                "packaging": false,
                                "boardCode": "BB",
                                "boardName": "BED AND BREAKFAST",
                                "cancellationPolicies": [
                                    {
                                        "amount": "129.39",
                                        "from": "2021-06-11T23:59:00+01:00"
                                    }
                                ],
                                "rooms": 1,
                                "adults": 2,
                                "children": 0
                            }
                        ]
                    },

                ],
                "minRate": "130.13",
                "maxRate": "214.38",
                "currency": "USD"
            }
        ],
        "checkIn": "2020-06-15",
        "total": 1,
        "checkOut": "2020-06-16"
    }
}

In this case, the API returned availability for 2 available rates from the 1 of the 2 hotels that we searched for (3424, hotel "As Americas"). We will try to book the first rate with rateKey 20210615|20210616|W|59|3424|DBL.ST|ID_B2B_26|BB||1~2~0||N@05~~2608a~-321744190~N~~~C7AA6D2F0EC744F159074087674900AAUS0000002000000000721b76. The rateKey is the unique identifier for any rate returned and it has 2 possible rateTypes associated with it, RECHECK or BOOKABLE. If the type is RECHECK you will need to perform an extra operation called CheckRate that will return to you the updated information of that specific rate and then book it, but if the type is BOOKABLE you can immediately book it (no need for CheckRate, the rate information is already updated).

As this specific ratekey is of type RECHECK we will perform a CheckRate operation:

curl --location --request POST 'https://api.test.hotelbeds.com/hotel-api/1.0/checkrates' \
--header 'Api-key: yourApiKeyGoesHere' \
--header 'X-Signature: yourCalculatedXSignatureGoesHere' \
--header 'Accept: application/json' \
--header 'Accept-Encoding: gzip' \
--header 'Content-Type: application/json' \
--data-raw '{
    "rooms": [
        {
            "rateKey": "20210615|20210616|W|59|3424|DBL.ST|ID_B2B_26|BB||1~2~0||N@05~~2608a~-321744190~N~~~C7AA6D2F0EC744F159074087674900AAUS0000002000000000721b76"
        }
    ]
}'

Parsing the results, your will notice that your rateKey's rateType in the results is now type BOOKABLE! Which means you can go book it! So launch your booking operation

curl --location --request POST 'https://api.test.hotelbeds.com/hotel-api/1.0/bookings' \
--header 'Api-key: xxxxxxx' \
--header 'X-Signature: yyyyyyyy' \
--header 'Accept: application/json' \
--header 'Accept-Encoding: gzip' \
--header 'Content-Type: application/json' \
--data-raw '{
	"holder": {
		"name": "Booking",
		"surname": "Test"
	},
	"rooms": [{
		"rateKey": "20210615|20210616|W|59|3424|DBL.ST|ID_B2B_26|BB||1~2~0||N@05~~2608a~-321744190~N~~~C7AA6D2F0EC744F159074087674900AAUS0000002000000000721b76",
		"paxes": [{
			"roomId": 1,
			"type": "AD",
			"name": "First Adult Name",
			"surname": "Surname"
		},
		{
			"roomId": 1,
			"type": "AD",
			"name": "Second Adult Name",
			"surname": "Surname"
		}]
	}],
	"clientReference": "IntegrationAgency",
	"remark": "Booking remarks are to be written here.",
	"tolerance" : 2.00
}'
Ratecomments and checkrate usage

When receiving an availabilityRS, you'll find some rates contain a tag named "rateCommentsId". This is important information given on the AvailabilityRS about the rate.

You can retrieve the ratecommentid description using ratecommentdetails operation from content-api. More information here


Below you'll find an example:

<rate
        rateKey = "20201205|20201207|W|256|217516|DBL.DX|GC-ALL|RO||1~2~1|6|N@05~~20c65~107727977~N~~~C8707DE2DC8C4F4159912750444500AAUK0200059001000021020c65"
        rateClass = "NOR"
        rateType = "BOOKABLE"
        net = "101.12"
        allotment = "37"
        rateCommentsId = "256|24524|3"
        paymentType = "AT_WEB"
        packaging = "false"
        boardCode = "RO"
        boardName = "ROOM ONLY"
        rooms = "1"
        adults = "2"
        children = "1"
        childrenAges = "6">
        <cancellationPolicies>
                <cancellationPolicy amount = "75.54" from = "2020-12-02T23:59:00-08:00"/>
        </cancellationPolicies>
</rate>
<rateComments>
        <rateComment dateEnd = "2023-12-31" dateStart = "2015-12-15">
                <description>
                        ***POOL CLOSURE UNTIL FURTHER NOTICE***
                        A valid government issued ID and credit card  deposit is required to check-in and secure any incidental charges.Parking is available at an additional fee, payable locally.
                </description>
        </rateComment>
</rateComments>

However, when retrieving CheckrateRS you'll get a tag "rateComments" that contains more information than the one contained on the content-api.

This behaviour is due to the rateComments delivered on CheckrateRS are build by concatenating different strings. The main ones and how to recover them are:

  • Issues
    • Those can be retrieved from content-api using hotels or hoteldetails operations under <issues> tag. More info here
  • Some facilities
    • Those can be retrieved from content-api using hotels or hoteldetails operations under <facilities> tag and are identified using the value true on "voucher" tag. More info here
  • Contract comments (those are the rateComments that you can see in the availability step)
    • Those can retrieve the ratecommentid description using ratecommentdetails operation from content-api. More information here

Disclaimer: There's a few more items that might be on the ratecomment description on Checkrate depending on the hotel/contract set-up.

Below you'll find examples:

<rate
        rateKey = "20201205|20201207|W|256|217516|DBL.DX|GC-ALL|RO||1~2~1|6|N@05~~20c65~107727977~N~~~C8707DE2DC8C4F4159912750444500AAUK0200059001000021020c65"
        rateClass = "NOR"
        rateType = "BOOKABLE"
        net = "101.12"
        rateComments = "***POOL CLOSURE UNTIL FURTHER NOTICE***A valid government issued ID and credit card  deposit is required to check-in and secure any incidental charges.Parking is available at an additional fee, payable locally.  Estimated total amount of taxes &amp; fees for this booking:64.06 US Dollar payable on arrival.  Check-in hour 15:00-00:00.Car park NO.Identification card at arrival.Deposit on arrival.Minimum check-in age 21.As a result of local government measures and guidelines put in place by services providers – including hotels and ancillaries – guests may find that some facilities or services are not available.Please visit https://static-sources.s3-eu-west-1.amazonaws.com/policy/index.html for further information. (15/05/2020-31/12/2020) The outdoor pool is closed. (08/07/2020-30/12/2020) "
        paymentType = "AT_WEB"
        packaging = "false"
        boardCode = "RO"
        boardName = "ROOM ONLY"
        rooms = "1"
        adults = "2"
        children = "1"
        childrenAges = "6">
        <cancellationPolicies>
                <cancellationPolicy amount = "75.54" from = "2020-12-02T23:59:00-08:00"/>
        </cancellationPolicies>
</rate>
<issues>
        <issue
                issueCode = "COVID"
                issueType = "COVID"
                dateFrom = "2020-05-15"
                dateTo = "2020-12-31"
                order = "2"
                alternative = "false">
                <description>As a result of local government measures and guidelines put in place by services providers – including hotels and ancillaries – guests may find that some facilities or services are not available.Please visit https://static-sources.s3-eu-west-1.amazonaws.com/policy/index.html for further information.</description>
        </issue>
        <issue
                issueCode = "OUTDOORPOOL"
                issueType = "CLOSED"
                dateFrom = "2020-07-08"
                dateTo = "2020-12-30"
                order = "4"
                alternative = "false">
                <description>The outdoor pool is closed.</description>
        </issue>
</issues>
<facility
        facilityCode = "320"
        facilityGroupCode = "70"
        order = "1"
        indFee = "false"
        indYesOrNo = "false"
        voucher = "true">
        <description>Car park</description>
</facility>
<facility
        facilityCode = "260"
        facilityGroupCode = "70"
        order = "1"
        timeFrom = "15:00:00"
        timeTo = "00:00:00"
        voucher = "true">
        <description>Check-in hour</description>
</facility>
<facility
        facilityCode = "561"
        facilityGroupCode = "85"
        order = "1"
        indLogic = "true"
        voucher = "true">
        <description>Deposit on arrival</description>
</facility>
<facility
        facilityCode = "557"
        facilityGroupCode = "85"
        order = "1"
        indLogic = "true"
        indFee = "false"
        voucher = "true">
        <description>Identification card at arrival</description>
</facility>
<facility
        facilityCode = "564"
        facilityGroupCode = "85"
        order = "1"
        number = "21"
        voucher = "true">
        <description>Minimum check-in age</description>
</facility>
<rateComments>
        <rateComment dateEnd = "2023-12-31" dateStart = "2015-12-15">
                <description>
                        ***POOL CLOSURE UNTIL FURTHER NOTICE***
                        A valid government issued ID and credit card  deposit is required to check-in and secure any incidental charges.Parking is available at an additional fee, payable locally.
                </description>
        </rateComment>
</rateComments>

It is not possible to get the full ratecomment description in AvailabilityRS as you would get it from CheckrateRS.

However, you can show the more important pieces by reading the issues, facilities and ratecommentsid