# Availability blocks

## Process availability block

\[`async`] This operation is used by Mews to push availability blocks to the Channel Manager. It is also used to push availability block modifications and cancellations.

### Request

`[ChannelManagerApiAddress]/processAvailabilityBlock`

```json
{
    "connectionToken": "[Token of a concrete connection]",
    "messageId": "66511e1d-2405-4e49-914b-b0c800d802c9",
    "responseUrl": "https://api.mews-demo.com/api/channelManager/v1/processAvailabilityBlockConfirmation",
    "availabilityBlock": {
        "code": null,
        "confirmationNumber": "2",
        "status": "Create",
        "name": "SampleBlock",
        "dates": {
            "start": "2023-12-05",
            "end": "2023-12-11",
            "releasedDate": "2023-12-04"
        },
        "spaceCategories": [
            {
                "start": "2023-12-05",
                "end": "2023-12-11",
                "spaceTypeCode": "D",
                "allocatedSpaces": [
                    {
                        "start": "2023-12-05",
                        "end": "2023-12-07",
                        "count": 2
                    },
                    {
                        "start": "2023-12-07",
                        "end": "2023-12-11",
                        "count": 5
                    }
                ],
                "occupiedSpaces": [
                    {
                        "start": "2023-12-05",
                        "end": "2023-12-09",
                        "count": 1
                    },
                    {
                        "start": "2023-12-09",
                        "end": "2023-12-11",
                        "count": 0
                    }
                ],
                "rates": [
                    {
                        "start": "2023-12-05",
                        "end": "2023-12-11",
                        "currencyCode": "EUR",
                        "prices": [
                            {
                                "grossAmount": 100.00,
                                "netAmount": 93.46,
                                "currencyCode": "EUR",
                                "guestCount": 1
                            },
                            {
                                "grossAmount": 100.00,
                                "netAmount": 93.46,
                                "currencyCode": "EUR",
                                "guestCount": 2
                            },
                            {
                                "grossAmount": 100.00,
                                "netAmount": 93.46,
                                "currencyCode": "EUR",
                                "guestCount": 3
                            },
                            {
                                "grossAmount": 100.00,
                                "netAmount": 93.46,
                                "currencyCode": "EUR",
                                "guestCount": 4
                            }
                        ]
                    }
                ]
            }
        ],
        "booker": {
            "email": "angelina.jolie@10001-438-sample-portfolio-hotel-10001.com",
            "firstName": "Angelina",
            "lastName": "Jolie",
            "title": null,
            "telephone": null,
            "nationalityCode": null,
            "languageCode": null,
            "loyaltyCode": null,
            "address": null
        },
        "company": null,
        "notes": "This is the block for Mews conference.",
        "pickupType": "AllInOneGroup"
    }  
}
```

| Property            | Type                                               | Contract          | Description                                                                        |
| ------------------- | -------------------------------------------------- | ----------------- | ---------------------------------------------------------------------------------- |
| `connectionToken`   | `string`                                           | required          | Token of a concrete connection.                                                    |
| `messageId`         | `string`                                           | required          | Unique identification of the message. This is used for asynchronous confirmations. |
| `responseUrl`       | `string`                                           | required (always) | URL which should be used for asynchronous confirmation.                            |
| `availabilityBlock` | [`Availability block`](#availability-block) object | required          | Availablity block data.                                                            |

#### Availability block

| Property             | Type                                                                                                    | Contract | Description                                                                                                         |
| -------------------- | ------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------- |
| `code`               | `string`                                                                                                | optional | Unique reference code from external system for the block. Will be returned after confirmation containing this code. |
| `confirmationNumber` | `string`                                                                                                | required | Mews confirmation number for the block.                                                                             |
| `status`             | [`Status`](#status) object                                                                              | required | State of the block.                                                                                                 |
| `name`               | `string`                                                                                                | required | Name of the block.                                                                                                  |
| `dates`              | [`Dates`](#dates) object                                                                                | required | Dates of the block.                                                                                                 |
| `spaceCategories`    | [`Space category allocation`](#space-category-allocation) collection                                    | required | Allocated categories of the block.                                                                                  |
| `booker`             | [`Customer`](/channel-manager-api/mews-operations/reservations.md#customer) object                      | required | The main booker. This does not mean that the person has arrived at the property.                                    |
| `company`            | [`Company`](/channel-manager-api/channel-manager-operations/reservations.md#company) object             | optional | The company associated with the block.                                                                              |
| `notes`              | `string`                                                                                                | optional | Notes for the block.                                                                                                |
| `pickupType`         | [`PickupType`](#pickupType) object                                                                      | required | PickupType of the block.                                                                                            |
| `releaseStrategy`    | [`Release strategy`](/channel-manager-api/mews-operations/availabilityblock.md#release-strategy) object | required | Release strategy of the availability block.                                                                         |

#### Dates

| Property           | Type         | Contract     | Description                                                                                                                                                                                      |
| ------------------ | ------------ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `start`            | `string`     | required     | Inclusive start date of the block, in format `yyyy-mm-dd`, e.g. `2021-12-24`; this is the first day of the block and so can be booked for stay.                                                  |
| `end`              | `string`     | required     | Exclusive end date of the block, in format `yyyy-mm-dd`, e.g. `2021-12-31`; this day is *not* included in the block and so cannot be booked for stay (it is analogous to reservation departure). |
| ~~`releasedDate`~~ | ~~`string`~~ | ~~required~~ | ~~End date in format `"yyyy-MM-dd"` (e.g., `"2021-12-24"`).~~ **Deprecated!**                                                                                                                    |

> **Dates**: Interval for e.g. 1 night for 2021-12-24/25 is represented as `"start": "2021-12-24", "end": "2021-12-24"`.

#### Space category allocation

| Property          | Type                                     | Contract | Description                                                          |
| ----------------- | ---------------------------------------- | -------- | -------------------------------------------------------------------- |
| `start`           | `string`                                 | required | Start date in format `"yyyy-MM-dd"` (e.g. `"2021-12-24"`).           |
| `end`             | `string`                                 | required | End date (excluded) in format `"yyyy-MM-dd"` (e.g., `"2021-12-31"`). |
| `spaceTypeCode`   | `string`                                 | required | Space type code of the reservation.                                  |
| `allocatedSpaces` | [`Space count`](#space-count) collection | required | The number of spaces **allocated** in the time interval.             |
| `occupiedSpaces`  | [`Space count`](#space-count) collection | required | The number of **occupied** spaces in the time interval.              |
| `rates`           | [`Rates`](#rate) collection              | required | Prices for the current space category.                               |

> **Dates**: Interval for e.g. 1 night for 2021-12-24/25 is represented as `"start": "2021-12-24", "end": "2021-12-24"`.

### Space count

| Property | Type     | Contract | Description                                                          |
| -------- | -------- | -------- | -------------------------------------------------------------------- |
| `start`  | `string` | required | Start date in format `"yyyy-MM-dd"` (e.g. `"2021-12-24"`).           |
| `end`    | `string` | required | End date (excluded) in format `"yyyy-MM-dd"` (e.g., `"2021-12-31"`). |
| `count`  | `int`    | required | Number of spaces (base of usage either occupied or allocated.)       |

> **Dates**: Interval for e.g. 1 night for 2021-12-24/25 is represented as `"start": "2021-12-24", "end": "2021-12-24"`.

### Rate

| Property       | Type                                                                                     | Contract | Description                                                                                              |
| -------------- | ---------------------------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------- |
| `start`        | `string`                                                                                 | required | Start date in format `"yyyy-MM-dd"` (e.g. `"2021-12-24"`).                                               |
| `end`          | `string`                                                                                 | required | End date (excluded) in format `"yyyy-MM-dd"` (e.g., `"2021-12-31"`).                                     |
| `currencyCode` | `string`                                                                                 | required | [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217) three-letter currency code of the rate prices.        |
| `prices`       | [`Price`](/channel-manager-api/channel-manager-operations/inventory.md#price) collection | required | Collection of prices for each person count, for the specified rate plan - space type - date combination. |

> **Dates**: Interval for 1 night (e.g. is represented 2021-12-24/25 is represented as `"start": "2021-12-24", "end": "2021-12-24"`).

#### Status

* `Create`
* `Update`
* `Cancel`

#### PickupType

* `AllInOneGroup`
* `IndividualGroups`

### Response

[Synchronous simple response](/channel-manager-api/guidelines/responses.md#synchronous-simple-response) is expected to determine whether the update was accepted or not.

[Async availability block confirmation](/channel-manager-api/mews-operations/availabilityblock.md#confirm-availability-block-confirmation) is expected to determine whether the update was processed afterwards or not.


---

# 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/channel-manager-api/channel-manager-operations/availabilityblock.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.
