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
}'