Last updated

Step 3 - Create Units

Use the Rooms API to create units, previously known as rooms. To know more about the terminology change, see Understanding Rooms API terminology.

Prerequisites

You must have a property ID by completing step 2 successfully.

Creating units

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

Creating a unit or room enables you to add facilities, pricing based on occupancy and availability later.

All parameters are required unless otherwise noted.

ParameterDescription
unit_name_idSpecifies the unit name ID that is part of the unit type.
number_of_unitsSpecifies the total number of units available at the property.
smoking_policy[Optional] Specifies the smoking policy in the unit.
size[Optional] Contains the unit size details.
> valueSpecifies the unit size in the chosen unit of measurement.
> unitSpecifies the unit of measurement to represent the unit size.
partner_reference_name[Optional] Specifies a custom unit name visible in the extranet and API response.
configurationContains the unit configuration.
> unit_type_idSpecifies the unit type ID.
> roomsContains the room details provided the unit type supports rooms.
>> typeSpecifies the room type supported by the unit type.
>> bed_configurations1Contains the details of the bed available in the room.
>>> bedsContains the bed type and the total number of beds.
>>>> bed_type_idSpecifies the bed type ID supported by the unit type.
>>>> bed_countSpecifies the total number of beds of the type specified above.
>>> is_default_configurationSpecifies whether the specified bed configuration is default for the unit/room.
occupancy_details2[Optional] Contains the occupancy details of the unit.
> max_guests[Optional] Specifies the maximum guest occupancy for the unit.
> max_adults[Optional] Specifies the maximum adult occupancy for the unit.
> max_children[Optional] Specifies the maximum occupancy of children (ages 3-17) per unit.
> max_infants[Optional] Specifies the maximum infants (0-2) occupancy for the unit that count toward max_guests.
> max_infants_on_top[Optional] Specifies the maximum infants (0-2) occupancy for the unit on top of max_guests.
max_children_that_pay_children_rate[Optional] Specifies the maximum number of children eligible for the children rate. Note that infants will always pay children rate if it is available, irrespective of the limit set here.
extra_beds_configuration[Optional] Contains the extra beds details for the unit.
> extra_beds[Optional] Specifies the total number of extra beds available on request per unit/room.
> cribs[Optional] Specifies the total number of extra cribs available on request per unit/room.
> is_crib_and_extra_bed_allowed[Optional] Specifies whether guests can request both the extra bed and crib in the unit/room.

1 - required for room types GUEST_ROOM and BEDROOM_SUBROOM. Optional for LIVING_ROOM_SUBROOM
2 - if the provider feature: rooms_api_old_occupancy_enabled is enabled, you see occupancy containing only max_guests, max_adults and max_children. See for [more details.][rooms-api-old-occupancy-consideration]

Sample request

{
    "configuration": {
        "unit_type_id": 29,
        "rooms": [
            {
                "type": "BEDROOM_SUBROOM",
                "bed_configurations": [
                    {
                        "beds": [
                            {
                                "bed_type_id": 1,
                                "bed_count": 1
                            }
                        ],
                        "is_default_configuration": true
                    }
                ]
            }
        ]
    },
    "unit_name_id": 153153,
    "number_of_units": 1,
    "smoking_policy": "SMOKING_AND_NONSMOKING",
    "size": {
        "value": 30.0,
        "unit": "SQM"
    },
    "partner_reference_name": "master bedroom",
    "occupancy_details": {
        "max_guests": 7,
        "max_adults": 7
    },
    "extra_beds_configuration": {
        "extra_beds": 1,
        "cribs": 0,
        "is_crib_and_extra_bed_allowed": false
    }
}

Sample response

A successful response looks as follows:

Note down the Unit ID (unit_id) from the response which we will use in step 12: Add roomrate.

{
    "data": {
        "unit_id": 1479536101,
        "configuration": {
            "unit_type_id": 29,
            "rooms": [
                {
                    "type": "BEDROOM_SUBROOM",
                    "bed_configurations": [
                        {
                            "beds": [
                                {
                                    "bed_type_id": 1,
                                    "bed_count": 1
                                }
                            ],
                            "is_default_configuration": true
                        }
                    ]
                }
            ]
        },
        "unit_name_id": 153153,
        "number_of_units": 1,
        "smoking_policy": "SMOKING_AND_NONSMOKING",
        "size": {
            "value": 30.0,
            "unit": "SQM"
        },
        "partner_reference_name": "master bedroom",
        "floor_numbers_located_on": null,
        "occupancy_details": {
            "max_guests": 7,
            "max_adults": 7,
            "max_children": 0,
            "max_infants": 0,
            "max_infants_on_top": 0
        },
        "extra_beds_configuration": {
            "extra_beds": 1,
            "cribs": 0,
            "is_crib_and_extra_bed_allowed": false
        },
        "max_children_that_pay_children_rate": 0
    },
    "warnings": [],
    "errors": [],
    "meta": {
        "ruid": "XXXXXXXX-XXXX-XXXXXXXXX-XXXXXXXXXXX"
    }
}