# Rooms API validation rules

The Rooms API create and update requests are subject to validation against a set of rules listed below.

## Generic validation rules

The following table lists the validation rules that apply to alls units created or updated using Rooms API.

| Validation rule | Related fields | Error description if violated |
|  --- | --- | --- |
| Unit type ID provided must exist in meta and be active | `configuration.unit_type_id` | Unit type is inactive or does not exist |
| Unit type must be allowed for a property | `configuration.unit_type_id` | Unit type not allowed for selected property type |
| Unit name ID provided must exist | `unit_name_id` | Unit name does not exist |
| Smoking policy is one of `SMOKING`, `NONSMOKING`, `SMOKING_AND_NONSMOKING` | `smoking_policy` |  |
| Number of units must be between `0` and `32000` | `number_of_units` | Number of units is invalid |
| Size value must be between `0` and `9999.99` | `size.value` | Size value must be between 0 and 9999.99 |
| Size unit must be of type `SQM` or `SQFT` | `size.unit` |  |
| At least one bed should be added to each bed configuration provided in the request | `configuration.rooms[*].bed_configurations` | At least 1 bed should be added to each bed configuration |
| Bed type IDs provided in the request must exist in meta and be active | `configuration.rooms[*].bed_configurations[*].beds[*].bed_type_id` | Bed type is inactive or does not exist |
| Bed types IDs should not be repeated within a single bed configuration | `configuration.rooms[*].bed_configurations[*].beds[*].bed_type_id` | Bed types should not be repeated within a single bed configuration |
| Exactly one default bed configuration is mandatory for each room provided | `configuration.rooms[*].bed_configurations[*].is_default_configuration` | Exactly 1 default bed configuration is mandatory |
| Number of beds must be between `1` and `255` | `configuration.rooms[*].bed_configurations[*].beds[*].bed_count` | Number of beds must be between 1 and 255 |
| Maximum number of extra beds provided must be between `0` and `100` | `extra_beds_configuration.extra_beds` |  |
| Maximum number of cribs provided must be between `0` and `100` | `extra_beds_configuration.cribs` |  |
| Maximum overall number of guests is between `1` and `50` | `occupancy_details.max_guests` |  |
| Maximum number of adults is between `1` and `50` | `occupancy_details.max_adults` |  |
| Maximum number of children is between `0` and `49` | `occupancy_details.max_children` |  |
| Maximum number of infants within overall number of guests  is between `0` and `49` | `occupancy_details.max_infants` |  |
| Maximum number of infants on top of overall number of guests is between `0` and `49` | `occupancy_details.max_infants_on_top` |  |
| Maximum number of guests cannot exceed the maximum number of adults and children combined | `occupancy_details.max_guests` `occupancy_details.max_adults` `occupancy_details.max_children` `occupancy_details.max_infants` | Maximum number of guests must be greater than or equal to number of adults and less than or equal to sum of adults, children and infants |
| Maximum number of adults cannot exceed the maximum number of guests | `occupancy_details.max_guests` `occupancy_details.max_adults` | Maximum number of guests must be greater than or equal to number of adults and less than or equal to sum of adults, children and infants |
| Maximum number of children must be less than maximum number of guests | `occupancy_details.max_guests` `occupancy_details.max_children` | Number of children must be less than maximum number of guests |
| Maximum number of infants must be less than maximum number of guests | `occupancy_details.max_guests` `occupancy_details.max_infants` | Number of infants must be less than maximum number of guests |
| One of the infant occupancy fields should be explicitly set to 0 | `occupancy_details.max_infants` `occupancy_details.max_infants_on_top` | Maximum number of infants must be set to 0 if infant occupancy on top of maximum number of guests is not 0 |
| Number of children eligible for the children rate must be less than or equal to maximum number of children | `max_children_that_pay_children_rate` `occupancy_details.max_children` | Number of children paying the child rate cannot exceed the number of children allowed in the unit. |


Please note, if you implemented Rooms API before 5 June 2025 and have not yet implemented `occupancy_details`, the following validation rules still applies to the `occupancy` object.

| Validation rule | Related fields | Error description if violated |
|  --- | --- | --- |
| Maximum overall number of guests is between `1` and `50` | `occupancy.max_guests` |  |
| Maximum number of adults is between `1` and `50` | `occupancy.max_adults` |  |
| Maximum number of children is between `0` and `49` | `occupancy.max_children` |  |
| Maximum number of adults cannot exceed the maximum number of guests | `occupancy.max_guests` `occupancy.max_adults` | Maximum number of guests must be greater than or equal to number of adults and less than or equal to sum of adults and children |
| Maximum number of children must be less than maximum number of guests | `occupancy.max_guests` `occupancy.max_children` | Number of children must be less than maximum number of guests |
| Maximum number of guests cannot exceed the maximum number of adults and children combined | `occupancy.max_guests` `occupancy.max_adults` `occupancy.max_children` | Maximum number of guests must be greater than or equal to number of adults and less than or equal to sum of adults and children |


## Validation rules specific to multi-room units

A multi-room unit is any unit which type has `is_multi_room = false` flag in meta.

The following table lists the validation rules that apply to multi-room units only.

| Validation rule | Related fields | Error description if violated |
|  --- | --- | --- |
| Room types provided must be of types `BEDROOM_SUBROOM` or `LIVING_ROOM_SUBROOM` | `configuration.rooms[*].type` | Room type is not allowed for selected (multi-room) unit type |
| At least one room with a bed must be provided | `configuration.rooms` | At least 1 room of type BEDROOM_SUBROOM or LIVING_ROOM_SUBROOM with a bed is mandatory for selected (multi-room) unit type |
| If provided, number of bedrooms must be between `1` and `50` | `configuration.rooms` | Number of BEDROOM_SUBROOM rooms must be between 1 and 50 |
| If provided, number of living rooms must be between `1` and `25` | `configuration.rooms` | Number of LIVING_ROOM_SUBROOM rooms must be between 1 and 25 |
| Valid number of bed confgiurations is provided: exactly one for `BEDROOM_SUBROOM`, not more than one for `LIVING_ROOM_SUBROOM` | `configuration.rooms[*].bed_configurations` | Room type BEDROOM_SUBROOM must have exactly 1 bed configuration; room type LIVING_ROOM_SUBROOM can not have more than 1 bed configuration |


## Validation rules specific to single-room units

A single-room unit is any unit with `is_multi_room = false` flag in meta.

Validation rules in the table below apply to single-room units only.

| Validation rule | Related fields | Error description if violated |
|  --- | --- | --- |
| Room type provided must be of type `GUEST_ROOM` | `configuration.rooms[*].type` | Room type is not allowed for selected (mono-room) unit type |
| Exactly one room of type `GUEST_ROOM` must be provided | `configuration.rooms` | Selected (mono-room) room unit type must have exactly 1 room of type GUEST_ROOM |
| At least one bed configuration is provided | `configuration.rooms[*].bed_configurations` | Room type GUEST_ROOM must have at least 1 bed configuration |


## Rules and validations specific to certain unit types

Validation rules in the table below apply only to specific unit types such as `Single`, `Dormitory Room` and `Bed in Dormitory`.

| Validation rule | Related fields | Error description if violated |
|  --- | --- | --- |
| For unit type `10` (`Single`) maximum number of adults must be exactly `1` | `configuration.unit_type_id`  `occupancy.max_adult_occupancy` | Maximum number of adults must be exactly 1 for selected unit type |
| For unit type ID `25` (`Dormitory Room`) maximum number of adults must be `2` or more | `configuration.unit_type_id` `occupancy.max_adult_occupancy` | Maximum number of adults must be 2 or more for selected unit type |
| For unit type ID `25` (`Dormitory Room`) at least two beds must be added to each bed configuration | `configuration.rooms[*].bed_configurations[*].beds` | At least 2 beds must be added to each bed configuration for selected unit type |
| For unit type ID `26` (`Bed in Dormitory`) exactly one bed configuration must be provided | `configuration.rooms[*].bed_configurations` | Exactly 1 bed configuration must be provided for selected unit type |
| For unit type ID `26` (`Bed in Dormitory`) exactly one bed must be added to bed configuration | `configuration.rooms[*].bed_configurations[*].beds` | Exactly 1 bed must be added to bed configuration for selected unit type |


## Non-blocking rules and validations

Validation rules in the table below apply to any unit created or updated using Rooms API, however the violation is automatically adjusted in our system. Instead of

| Validation rule | Related fields | Warning description if violated |
|  --- | --- | --- |
| Child policy must be enabled on a property level before allowing children in the unit | `occupancy.max_children` | Child policy was enabled for a property after passing children occupancy |
| Unit name ID must be present in meta | `unit_name_id` | Unit name is not present in meta. Using custom room names is not recommended. |


Children policies are removed when `max_children` values for all units are set to 0
If the `occupancy.max_children` value is set to `0` for all units, then the `allow_children` property setting is set to `false` and all children policy rules are deleted, including the `price` details. See [Property settings](/connectivity/docs/content-api-modules/property-details-api/implementing-property-api-settings#childrenpolicies) for more information.