# Housekeeping

A Housekeeping integration pulls live information about the physical state of rooms and other space resources, allows the housekeeping staff to update the state from the Housekeeping system and pushes this data back into Mews.

## Initial configuration

The integration must first retrieve all the resources the property has configured in Mews using [Get all resources](/connector-api/operations/resources.md#get-all-resources). The response contains all relevant information needed to map the physical configuration of the property in the external system.

| 'How to' use case                       | API Operations                                                                |
| --------------------------------------- | ----------------------------------------------------------------------------- |
| How to get the list of rooms and spaces | [Get all resources](/connector-api/operations/resources.md#get-all-resources) |

> **Terminology:** For an explanation of terms like `room`, `space` and `resource`, see the [Mews Glossary for Open API users](/getting-started/glossary.md).

## Managing resources

To ensure all of the information is synchronized between the two systems, a Housekeeping integration can monitor changes to the state of a resource. Rather than polling the API for state changes, you can subscribe to notification events using [Webhooks](/connector-api/events.md) or [WebSockets](/connector-api/events/websockets.md). Both methods support changes to resources. Don't know which one to use? See [Ways to communicate](https://github.com/MewsSystems/open-api-docs/blob/main/connector-api/guidelines/communicate.md).

| 'How to' use case                           | API Operations                                                                                                                                                   |
| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| How to listen for changes to reservations   | [General Webhooks](/connector-api/events/wh-general.md) (`ServiceOrderUpdated` event) or [WebSockets](/connector-api/events/websockets.md) (`Reservation` event) |
| How to get reservation and customer details | [Get all reservations](/connector-api/operations/reservations.md#get-all-reservations-ver-2023-06-06)                                                            |

Once a staff member has cleaned or inspected a room, the state can be updated in Mews using [Update resources](/connector-api/operations/resources.md#update-resources), specifying the new state of the resource.

| 'How to' use case                     | API Operations                                                              |
| ------------------------------------- | --------------------------------------------------------------------------- |
| How to update the state of a resource | [Update resources](/connector-api/operations/resources.md#update-resources) |

Resource blocks are blocks of rooms or resources set to 'out of order' or 'internal use'. Information about resource blocks can be requested using [Get all resource blocks](/connector-api/operations/resourceblocks.md#get-all-resource-blocks). Housekeeping integrations can also manage blocks through [Add resource block](/connector-api/operations/resourceblocks.md#add-resource-block) and [Delete resource blocks](/connector-api/operations/resourceblocks.md#delete-resource-blocks).

| 'How to' use case                            | API Operations                                                                                 |
| -------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| How to get information about resource blocks | [Get all resource blocks](/connector-api/operations/resourceblocks.md#get-all-resource-blocks) |
| How to add a resource block                  | [Add resource block](/connector-api/operations/resourceblocks.md#add-resource-block)           |
| How to delete resource blocks                | [Delete resource blocks](/connector-api/operations/resourceblocks.md#delete-resource-blocks)   |

## Staff tasks

If you need to create a task directly in Mews, this can be done using [Add task](/connector-api/operations/tasks.md#add-task). If a task should be assigned to a specific department, the unique identifiers required for this action can be retrieved using [Get all departments](/connector-api/operations/departments.md#get-all-departments). A list of existing tasks can be retrieved from Mews using [Get all tasks](/connector-api/operations/tasks.md#get-all-tasks).

| 'How to' use case                        | API Operations                                                                      |
| ---------------------------------------- | ----------------------------------------------------------------------------------- |
| How to add a staff task                  | [Add task](/connector-api/operations/tasks.md#add-task)                             |
| How to get information about departments | [Get all departments](/connector-api/operations/departments.md#get-all-departments) |
| How to get the list of staff tasks       | [Get all tasks](/connector-api/operations/tasks.md#get-all-tasks)                   |

## Dirty status

Mews allows properties to configure when a space will be marked as `Dirty`, upon check-in or check-out, in their Stay service settings. They can also configure a specific housekeeping time interval after which, if a space is vacant, it will automatically change state to `Dirty`. For example, if the field is set to two days, the space will automatically become `Dirty` after two days. Each unit represents a period of 24 hours, with automatic changes occurring between 04:00 and 05:00. The maximum amount of time for this time interval is 7 days, after which the state will automatically change to `Dirty` to adhere to regulations preventing Legionella.

## Testing your integration

Please ensure you follow our general [Usage guidelines](/connector-api/guidelines.md) for testing integrations. In addition to this, using the [demo environment](/connector-api/guidelines/environments.md) credentials, you can run the [Space Status Report](https://help.mews.com/s/article/space-status-report?language=en_US) (housekeeping report) to cross-check if the integration is working correctly.

## Additional help for working with the demo environment

> **Help Guides**:
>
> * [Out-of-service and out-of-order](https://help.mews.com/s/article/what-are-house-use-out-of-service-and-out-of-order-features?language=en_US)
> * [How to set up a stay service](https://help.mews.com/s/article/set-up-a-bookable-service?language=en_US)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mews.com/connector-api/use-cases/housekeeping.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
