Last updated

Managing units

Use this endpoint to create units, add rooms, add bed configurations, set occupancy, among other tasks.

You can:

Before you start

Before implementing the Rooms API it is important to explore the relevant metadata and validation rules.

Discover relevant meta information

To create a unit, you must provide the unit type ID, unit name ID, and bed type ID. For example, you can create a unit of type Apartment (unit type ID 1) named Apartment with Sea View (unit name ID 44) with a Large bed (bed type ID 6) inside.

These IDs and their attributes constitute the Rooms API metadata, which can be retrieved using the Rooms API meta endpoint. See the meta endpoint's documentation and Open API specification.

Each unit type object has a set of important attributes:

  • is_active - defines if a unit type can be used to create or update units; inactive unit types are read-only;
  • allowed_property_categories - defines a set of property categories for which a given unit type can be created; and
  • is_multi_room - defines if a unit type is multi-room or mono-room.

Understand the difference between multi-room and mono-room units

There are two categories of units supported by the Rooms API: mono-room and multi-room. It is important to understand the difference, because each category has it own requirements to pass validations.

CategoryExample unit typesMultiple rooms supportedType of rooms supportedMultiple bed configurations supported
Multi-room unitApartment, Villa, SuiteyesBEDROOM_SUBROOM, LIVING_ROOM_SUBROOMno
Mono-room unitStudio, DoublenoGUEST_ROOMyes

Learn more about the create and update requests validations

The request body for POST and PATCH requests is validated against a set of rules. These include generic rules applicable to all units, as well as specific rules based on unit category (mono- or multi-room) and unit type.

Create a unit

POST
https://supply-xml.booking.com/rooms-api/properties/{propertyId}/units

Header parameter

The following table describes the elements you can add in the header:

HeaderDescriptionTypeRequired/
Optional
Notes
Content-Type: application/jsonSpecifies the expected content type.stringrequired
Accept-VersionSpecify the version number to get the API functionality specific to that version.stringoptionalCurrently supports the value: 1.0

Path parameters

The following table describes the elements you must specify in the path:

ElementDescriptionTypeRequired/
Optional
Notes
propertyIdSpecifies the unique ID of the property.integerrequiredMust be valid and assigned to your account

Request body parameters

The following table describes the elements you can add in the request body:

ElementDescriptionTypeRequired/
Optional
Default valueRoot parameter in HIN
unit_name_idSpecifies the unit name ID that is part of the unit typestringrequiredn/aDescription > Text
number_of_unitsSpecifies the total number of units available at the propertyintegeroptional1Room > Quantity
smoking_policySpecifies the smoking policy in the unitenumerated stringoptionalSMOKING_AND_NONSMOKINGRoom > NonSmoking
sizeContains the unit size detailsobjectoptionalnull
> valueSpecifies the unit size in the chosen unitintegerrequired1n/aRoom > SizeMeasurement
> unitSpecifies the unit of measurement to represent the unit sizeenumerated stringrequired1n/aRoom > SizeMeasurementUnit
partner_reference_nameSpecifies a custom unit name visible in the extranet and API responsestringoptionalnullNew field
room_located_on_floorsSpecifies the floor where the unit is locatedarray of integer(s)optionalnullNew field
configurationContains the unit configurationobjectrequiredn/a
> unit_type_idSpecifies the unit type IDenumerated stringrequiredn/aRoom > RoomType
> roomsContains the room details provided the unit type supports roomsarray of objectsrequiredn/a
>> typeSpecifies the room type supported by the unit typeenumerated stringrequiredn/aSubRoom > RoomType
>> bed_configurationsContains the details of the bed available in the roomobjectconditional2n/aSubRoom > Amenities
>>> bedsContains the bed type and the total number of bedsarray of objectsrequired1n/a
>>>> bed_type_idSpecifies the bed type ID supported by the unit typeenumerated integerrequired1n/aAmenityCode (or RoomAmenityCode)
>>>> bed_countSpecifies the total number of beds of the type specified aboveintegerrequired1n/aQuantity (or Value)
>>> is_default_configurationSpecifies whether the specified bed configuration is default for the unit/roombooleanrequired1n/aConfiguration
occupancyContains the occupancy details of the unitobjectoptionaln/a-
> max_guestsSpecifies the maximum guest occupancy for the unitintegeroptional1Occupancy > MaxOccupancy
> max_adultsSpecifies the maximum adult occupancy for the unitintegeroptional1Occupancy > MaxAdultOccupancy
> max_childrenSpecifies the maximum child occupancy for the unitintegeroptional0Occupancy > MaxChildOccupancy
max_children_that_pay_children_rateSpecifies the maximum number of children eligible for the child rateintegeroptionalmax_childrenTPA_Extensions > MaxChildPayableOccupancy
extra_beds_configurationContains the extra beds details for the unitobjectoptionaln/a
> extra_bedsSpecifies the total number of extra beds available on request per unit/roomintegeroptional0Quantities > MaxRollaways
> cribsSpecifies the total number of extra cribs available on request per unit/roomintegeroptional0Quantities > MaxCribs
> is_crib_and_extra_bed_allowedSpecifies whether guests can request both the extra bed and crib in the unit/roombooleanoptionalfalseNew field

1 - required only if a parent field is provided
2 - required for room types GUEST_ROOM and BEDROOM_SUBROOM, optional for LIVING_ROOM_SUBROOM

Request body example

For example, the following request creates a multi-room unit with two bedrooms and one living room:

{
  "configuration": {
    "unit_type_id": 1,
    "rooms": [
      {
        "type": "BEDROOM_SUBROOM",
        "bed_configurations": [
          {
            "beds": [
              {
                "bed_type_id": 6,
                "bed_count": 1
              }
            ],
            "is_default_configuration": true
          }
        ]
      },
      {
        "type": "BEDROOM_SUBROOM",
        "bed_configurations": [
          {
            "beds": [
              {
                "bed_type_id": 4,
                "bed_count": 1
              }
            ],
            "is_default_configuration": true
          }
        ]
      },
      {
        "type": "LIVING_ROOM_SUBROOM",
        "bed_configurations": [
          {
            "beds": [
              {
                "bed_type_id": 7,
                "bed_count": 1
              }
            ],
            "is_default_configuration": true
          }
        ]
      }
    ]
  },
  "unit_name_id": 138547,
  "number_of_units": 5,
  "smoking_policy": "SMOKING_AND_NONSMOKING",
  "size": {
    "value": 155.0,
    "unit": "SQM"
  },
  "partner_reference_name": "Park facing Apartment",
  "floor_numbers_located_on": [
    2
  ],
  "occupancy": {
    "max_guests": 5,
    "max_adults": 5,
    "max_children": 4
  },
  "max_children_that_pay_children_rate": 2,
  "extra_beds_configuration": {
    "extra_beds": 1,
    "cribs": 0,
    "is_crib_and_extra_bed_allowed": false
  }
}

For more request examples for various use cases, see the examples in the API Explorer section in the Open API specification.

Response body example

The following is a response snippet:

{
  "data": {
    "unit_id": 813518812,
    "configuration": {
      "unit_type_id": 1,
      "rooms": [
        {
          "type": "BEDROOM_SUBROOM",
          "bed_configurations": [
            {
              "beds": [
                {
                  "bed_type_id": 6,
                  "bed_count": 1
                }
              ],
              "is_default_configuration": true
            }
          ]
        },
        {
          "type": "BEDROOM_SUBROOM",
          "bed_configurations": [
            {
              "beds": [
                {
                  "bed_type_id": 4,
                  "bed_count": 1
                }
              ],
              "is_default_configuration": true
            }
          ]
        },
        {
          "type": "LIVING_ROOM_SUBROOM",
          "bed_configurations": [
            {
              "beds": [
                {
                  "bed_type_id": 7,
                  "bed_count": 1
                }
              ],
              "is_default_configuration": true
            }
          ]
        }
      ]
    },
    "unit_name_id": 138547,
    "number_of_units": 5,
    "smoking_policy": "SMOKING_AND_NONSMOKING",
    "size": {
      "value": 155.0,
      "unit": "SQM"
    },
    "partner_reference_name": "Park facing Apartment",
    "floor_numbers_located_on": [
      2
    ],
    "occupancy": {
      "max_guests": 5,
      "max_adults": 5,
      "max_children": 4
    },
    "max_children_that_pay_children_rate": 2,
    "extra_beds_configuration": {
      "extra_beds": 1,
      "cribs": 0,
      "is_crib_and_extra_bed_allowed": false
    }
  },
  "warnings": [],
  "errors": [],
  "meta": {
    "ruid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
  }
}

Response body elements

The following table describes the response elements:

ElementDescriptionTypeNotes
dataContains details of the unit created.object-
> unit_idSpecifies the unit ID.string-
> configurationContains the unit configuration.object-
>> unit_type_idSpecifies the unit type ID.enumerated string-
>> roomsContains the room details provided the unit type supports rooms (also known as subrooms).array of objects-
>>> typeSpecifies the room type supported by the unit type.enumerated string-
>>> bed_configurationsContains the details of the bed available in the room.object-
>>>> bedsContains the bed type and the total number of beds.array of objects-
>>>>> bed_type_idSpecifies the bed type ID that is supported by the unit type.enumerated integer-
>>>>> bed_countSpecifies the total number of beds available in the unit/room.integer-
>>>> is_default_configurationSpecifies whether the specified bed configuration is default for the unit/room.boolean-
> unit_name_idSpecifies the unit name ID that is part of the unit type.string-
> number_of_unitsSpecifies the total number of rooms available at the property for the specified room type.integer-
> smoking_policySpecifies the smoking policy in the room.enumerated string-
>> sizeContains the unit size details.object-
>>> valueSpecifies the unit size in the chosen unit.integer-
>>> unitSpecifies the unit of measurement to represent the unit size.enumerated string-
> partner_reference_nameSpecifies a custom unit name that is visible in the extranet and in the API response.string-
> floor_numbers_located_onSpecifies the floor where the unit is located.array of integer(s)-
> occupancyContains the occupancy details of the unit.object-
>> max_guestsSpecifies the maximum guest occupancy for the unit.integer-
>> max_adultsSpecifies the maximum adult occupancy for the unit.integer-
>> max_childrenSpecifies the maximum child occupancy for the unit.integer-
max_children_that_pay_children_rateSpecifies the maximum number of children eligible for the child rate.integer-
> extra_beds_configurationContains the extra beds details for the unit.object-
>> extra_bedsSpecifies the total number of extra beds available on request per room/unit.integer-
>> cribsSpecifies the total number of extra cribs available on request per room/unit.integer-
>> is_crib_and_extra_bed_allowedSpecifies whether guests have the option of requesting both the extra bet and crib in the room/unit.boolean-
warningsContains any warnings in the request.object-
errorsContains any errors in the request.object-
metaContains metadata information about the response.object-
> ruidSpecifies the unique request ID.stringYou can share this ID with Booking.com customer support when you run into an issue. This can help in understanding what went wrong.

Updating a unit

PATCH
https://supply-xml.booking.com/rooms-api/properties/{propertyId}/units/{unitID}

To update an existing unit, copy the relevant portion of the response from the GET property unit details endpoint and use it as the request body. As an update action, the API overlays the existing unit details with the configuration in the request body. Make sure to send the root-level field and their nested fields.

Note that updating a unit doesn't affect existing reservations.

Header parameter

The following table describes the elements you can add in the header:

HeaderDescriptionTypeRequired/
Optional
Notes
Content-Type: application/jsonSpecifies the expected content type.stringrequired
Accept-VersionSpecify the version number to get the API functionality specific to that version.stringoptionalCurrently supports the value: 1.0

Path parameters

The following table describes the elements you must specify in the path:

ElementDescriptionTypeRequired/
Optional
Notes
propertyIdSpecifies the unique ID of the property.integerrequiredMust be valid and connected to your account
unitIDSpecifies the unique ID of the unit to update.integerrequiredMust belong to the property

Request body parameters

The following table describes the elements you can add in the request body. Note that every root level field is optional, but if it has subfields you must provide all the subfields in full.

ElementDescriptionTypeRequired/
Optional
Root parameter in HIN
unit_name_idSpecifies the unit name ID that is part of the unit typestringoptionalDescription > Text
number_of_unitsSpecifies the total number of units available at the propertyintegeroptionalRoom > Quantity
smoking_policySpecifies the smoking policy in the unitenumerated stringoptionalRoom > NonSmoking
sizeContains the unit size detailsobjectoptional
> valueSpecifies the unit size in the chosen unitintegerrequired1Room > SizeMeasurement
> unitSpecifies the unit of measurement to represent the unit sizeenumerated stringrequired1Room > SizeMeasurementUnit
partner_reference_nameSpecifies a custom unit name visible in the extranet and API responsestringoptionalNew field
room_located_on_floorsSpecifies the floor where the unit is locatedarray of integer(s)optionalNew field
configurationContains the unit configurationobjectoptional
> unit_type_idSpecifies the unit type IDenumerated stringrequired1Room > RoomType
> roomsContains the room details provided the unit type supports roomsarray of objectsrequired1
>> typeSpecifies the room type supported by the unit typeenumerated stringrequired1SubRoom > RoomType
>> bed_configurationsContains the details of the bed available in the roomobjectconditional2SubRoom > Amenities
>>> bedsContains the bed type and the total number of bedsarray of objectsrequired1
>>>> bed_type_idSpecifies the bed type ID supported by the unit typeenumerated integerrequired1AmenityCode (or RoomAmenityCode)
>>>> bed_countSpecifies the total number of beds of the type specified aboveintegerrequired1Quantity (or Value)
>>> is_default_configurationSpecifies whether the specified bed configuration is default for the unit/roombooleanrequired1Configuration
occupancyContains the occupancy details of the unitobjectoptional-
> max_guestsSpecifies the maximum guest occupancy for the unitintegerrequired1Occupancy > MaxOccupancy
> max_adultsSpecifies the maximum adult occupancy for the unitintegerrequired1Occupancy > MaxAdultOccupancy
> max_childrenSpecifies the maximum child occupancy for the unitintegerrequired1Occupancy > MaxChildOccupancy
max_children_that_pay_children_rateSpecifies the maximum number of children eligible for the child rateintegeroptionalTPA_Extensions > MaxChildPayableOccupancy
extra_beds_configurationContains the extra beds details for the unitobjectoptional
> extra_bedsSpecifies the total number of extra beds available on request per unit/roomintegerrequired1Quantities > MaxRollaways
> cribsSpecifies the total number of extra cribs available on request per unit/roomintegerrequired1Quantities > MaxCribs
> is_crib_and_extra_bed_allowedSpecifies whether guests can request both the extra bed and crib in the unit/roombooleanrequired1New field

1 - required only if a parent field is provided
2 - required for room types GUEST_ROOM and BEDROOM_SUBROOM, optional for LIVING_ROOM_SUBROOM

Request body example

For example, the following request sets new smoking policy, size and occupancy for an existing unit:

{
  "smoking_policy": "SMOKING",
  "size": {
      "value": 45.0,
      "unit": "SQM"
  },
  "occupancy": {
      "max_guests": 4,
      "max_adults": 4,
      "max_children": 3
  }
}

For more request examples for various use cases, see the examples in the API Explorer section in the Open API specification.

Response body example

The following is a response snippet:

{
  "warnings": [],
  "errors": [],
  "meta": {
    "ruid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
  }
}

Response body elements

The following table describes the response elements:

ElementDescriptionTypeNotes
warningsContains any warnings in the request.object-
errorsContains any errors in the request.object-
metaContains metadata information about the response.object-
> ruidSpecifies the unique request ID.stringYou can share this ID with Booking.com customer support when you run into an issue. This can help in understanding what went wrong.

Deleting a unit

DELETE
https://supply-xml.booking.com/rooms-api/properties/{propertyId}/units/{unitID}

Note that you can delete a unit only if there are no active or future reservations for that unit. Deleting a unit is irreversible.

Header parameter

The following table describes the elements you can add in the header:

HeaderDescriptionTypeRequired/
Optional
Notes
Accept-VersionSpecify the version number to get the API functionality specific to that version.stringoptionalCurrently supports the value: 1.0

Path parameters

The following table describes the elements you must specify in the path:

ElementDescriptionTypeRequired/
Optional
Notes
propertyIdSpecifies the unique ID of the propertyintegerrequiredMust be valid and connected to your account
unitIDSpecifies the unique ID of the unit to deactivateintegerrequiredMust belong to the property

Response body example

The following is a response snippet:

{
  "warnings": [],
  "errors": [],
  "meta": {
    "ruid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
  }
}

Response body elements

The following table describes the response elements:

ElementDescriptionTypeNotes
warningsContains any warnings in the request.object-
errorsContains any errors in the request.object-
metaContains metadata information about the response.object-
> ruidSpecifies the unique request ID.stringYou can share this ID with Booking.com customer support when you run into an issue. This can help in understanding what went wrong.

Retrieving unit details

GET
https://supply-xml.booking.com/rooms-api/properties/{propertyId}/units?debug_info=false

Retrieve all units available in the specified property. When updating a unit, you can also copy the relevant portion of the response from this endpoint and use it as the request body.

Header parameter

The following table describes the elements you can add in the header:

HeaderDescriptionTypeRequired/
Optional
Notes
Accept-VersionSpecify the version number to get the API functionality specific to that version.stringoptionalCurrently supports the value: 1.0

Path parameters

The following table describes the elements you must specify in the path:

ElementDescriptionTypeRequired/
Optional
Notes
propertyIdSpecifies the unique ID of the propertyintegerrequiredMust be valid and connected to your account
debug_infoSpecifies whether to return unit_name_fallback in responsebooleanoptionalfalse

Response body example

The following is a response body snippet:

{
  "data": [
    {
      "unit_id": 1178287071,
      "configuration": {
        "unit_type_id": 9,
        "rooms": [
          {
            "type": "GUEST_ROOM",
            "bed_configurations": [
              {
                "beds": [
                  {
                    "bed_type_id": 3,
                    "bed_count": 1
                  }
                ],
                "is_default_configuration": true
              },
              {
                "beds": [
                  {
                    "bed_type_id": 1,
                    "bed_count": 2
                  }
                ],
                "is_default_configuration": false
              }
            ]
          }
        ]
      },
      "unit_name_id": 255,
      "number_of_units": 20,
      "smoking_policy": "NONSMOKING",
      "size": {
        "value": 24.0,
        "unit": "SQM"
      },
      "partner_reference_name": "Test double with multiple bed configurations",
      "floor_numbers_located_on": [
        1,
        2,
        3,
        4,
        5
      ],
      "occupancy": {
        "max_guests": 2,
        "max_adults": 2,
        "max_children": 1
      },
      "max_children_that_pay_children_rate": 1,
      "extra_beds_configuration": {
        "extra_beds": 0,
        "cribs": 1,
        "is_crib_and_extra_bed_allowed": false
      }
    },
    {
      "unit_id": 1178287072,
      "configuration": {
        "unit_type_id": 1,
        "rooms": [
          {
            "type": "BEDROOM_SUBROOM",
            "bed_configurations": [
              {
                "beds": [
                  {
                    "bed_type_id": 1,
                    "bed_count": 1
                  },
                  {
                    "bed_type_id": 6,
                    "bed_count": 1
                  }
                ],
                "is_default_configuration": true
              }
            ]
          },
          {
            "type": "BEDROOM_SUBROOM",
            "bed_configurations": [
              {
                "beds": [
                  {
                    "bed_type_id": 1,
                    "bed_count": 3
                  }
                ],
                "is_default_configuration": true
              }
            ]
          },
          {
            "type": "LIVING_ROOM_SUBROOM",
            "bed_configurations": [
              {
                "beds": [
                  {
                    "bed_type_id": 5,
                    "bed_count": 1
                  }
                ],
                "is_default_configuration": true
              }
            ]
          }
        ]
      },
      "unit_name_id": 1463,
      "number_of_units": 5,
      "smoking_policy": "SMOKING_AND_NONSMOKING",
      "size": {
        "value": 155.0,
        "unit": "SQM"
      },
      "partner_reference_name": "Test two-bedroom apartment",
      "floor_numbers_located_on": [
        2
      ],
      "occupancy": {
        "max_guests": 5,
        "max_adults": 5,
        "max_children": 4
      },
      "max_children_that_pay_children_rate": 2,
      "extra_beds_configuration": {
        "extra_beds": 1,
        "cribs": 0,
        "is_crib_and_extra_bed_allowed": false
      }
    }
  ],
  "warnings": [],
  "errors": [],
  "meta": {
    "ruid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
  }
}

Response body elements

The following table describes the response elements:

ElementDescriptionTypeNotes
dataContains details of the unit created.object-
> unit_idSpecifies the unit ID.string-
> configurationContains the unit configuration.object-
>> unit_type_idSpecifies the unit type ID.enumerated string-
>> roomsContains the room details provided the unit type supports rooms (also known as subrooms).array of objects-
>>> typeSpecifies the room type supported by the unit type.enumerated string-
>>> bed_configurationsContains the details of the bed available in the room.object-
>>>> bedsContains the bed type and the total number of beds.array of objects-
>>>>> bed_type_idSpecifies the bed type ID that is supported by the unit type.enumerated integer-
>>>>> bed_countSpecifies the total number of beds available in the unit/room.integer-
>>>> is_default_configurationSpecifies whether the specified bed configuration is default for the unit/room.boolean-
> unit_name_idSpecifies the unit name ID that is part of the unit type.string-
> number_of_unitsSpecifies the total number of rooms available at the property for the specified room type.integer-
> smoking_policySpecifies the smoking policy in the room.enumerated string-
>> sizeContains the unit size details.object-
>>> valueSpecifies the unit size in the chosen unit.integer-
>>> unitSpecifies the unit of measurement to represent the unit size.enumerated string-
> partner_reference_nameSpecifies a custom unit name that is visible in the extranet and in the API response.string-
> floor_numbers_located_onSpecifies the floor where the unit is located.array of integer(s)-
> occupancyContains the occupancy details of the unit.object-
>> max_guestsSpecifies the maximum guest occupancy for the unit.integer-
>> max_adultsSpecifies the maximum adult occupancy for the unit.integer-
>> max_childrenSpecifies the maximum child occupancy for the unit.integer-
max_children_that_pay_children_rateSpecifies the maximum number of children eligible for the child rate.integer-
> extra_beds_configurationContains the extra beds details for the unit.object-
>> extra_bedsSpecifies the total number of extra beds available on request per room/unit.integer-
>> cribsSpecifies the total number of extra cribs available on request per room/unit.integer-
>> is_crib_and_extra_bed_allowedSpecifies whether guests have the option of requesting both the extra bet and crib in the room/unit.boolean-
> unit_name_fallbackContains a unit name; it can be used to read custom unit names not present in metastringCustom unit names cannot be used in create and update requests
warningsContains any warnings in the request.object-
errorsContains any errors in the request.object-
metaContains metadata information about the response.object-
> ruidSpecifies the unique request ID.stringYou can share this ID with Booking.com customer support when you run into an issue. This can help in understanding what went wrong.