# Availability Message

## Overview

The Availability message (`OTA_HotelAvailNotifRQ`) defines whether a product
(room type combined with rate plan) for a given itinerary can be sold for the
applicable dates. When you send an Availability message, you indicate whether
the availability or restrictions for a product has changed.

> [!IMPORTANT]
> **Key Point:** Inventory can also be updated using the Availability message type, but the Inventory message type (`OTA_HotelInvCountNotifRQ`) is the preferred method.

The following sections cover general guidelines, a basic example, and how-to
scenarios to get you started with adding and updating availability using the
Availability message.

## Nightly availability restriction

The Availability message lets you define restrictions which control the overall
availability of a booking. One notable type of restriction is
"nightly availability": whether the product can be sold on a particular date.
For a stay (from check-in to check-out) to be bookable, there must be nightly
availability on all dates, and all other booking and stay restrictions must be
met.

> [!NOTE]
> **Note:** For more information on the concept of Availability and the differences between Inventory and Availability, see [Inventory versus
> availability](https://developers.google.com/hotels/hotel-prices/dev-guide/ari-inventory-message#inventory_versus_availability).

## Restriction settings

By default, `RestrictionStatus` for `Restriction="Master"` is closed. In other
words, by default, there is a "stop sell" on every night.

To be sellable, a product must have `<RestrictionStatus Restriction="Master"
Status="Open">` for all combinations of products on all nights of a stay. You
must either send Google an explicit `Open` for each product or change the
default in the Hotel Center. This can be accomplished by navigating to the
**Pricing \> Settings** page in Hotel Center and editing the "default
availability" field.

## Other restrictions

Arrival/Departure
:   Prevents sale of an itinerary arriving or departing on the specified date.
    It is `Open` by default.

Minimum and maximum booking offset
:   Requires that the itinerary be purchased at least or at most a certain number
    of days before arrival.

Minimum and maximum length of stay
:   Restricts length of stay for itineraries which have this arrival date.

Minimum and maximum forward stay (or "stay-through")
:   Restricts length of stay for itineraries which contain this stay date.

Length of stay pattern
:   Gives exact control of what lengths of stay are allowed for this arrival date.

## General guidelines

- Availability restrictions are keyed by hotel, date, room type, and rate plan.

- A product is only bookable if there are no imposed restrictions which apply
  on the stay (from check-in to check-out) or when the user can book the stay.

- Send Google an Availability message update whenever there is a change in
  availability restrictions for the product on specific dates.

## Example

This section provides a basic example of an Availability message using required
and optional elements. Once you prepare your file, you will need to send it to
Google via a POST message to this endpoint:

    https://www.google.com/travel/hotels/uploads/ota/hotel_avail_notif

To learn more about how to push/POST the message, see [Pushing
messages](https://developers.google.com/hotels/hotel-prices/dev-guide/ari-overview#pushing-messages).

> [!IMPORTANT]
> **Key Point:** Send Google an updated message whenever availability changes.

For `HotelCode`, use the unique Hotel ID you used within your system for
identifying the property. This value must match the Hotel ID specified using
`<id>` in the [`<listing>`](https://developers.google.com/hotels/hotel-prices/xml-reference/hotel-list-feed#listing) element in the
Hotel List feed. Consistency with your system is critical for ensuring that
Google is correctly displaying your data.

This example shows how to set availability restrictions:

    <?xml version="1.0" encoding="UTF-8"?>
    <OTA_HotelAvailNotifRQ xmlns="http://www.opentravel.org/OTA/2003/05"
                           EchoToken="12345678"
                           TimeStamp="2022-03-20T20:50:37-05:00"
                           Version="3.0">
      <POS><Source><RequestorID ID="partner_key" /></Source></POS>
      <AvailStatusMessages HotelCode="HOTELID">
        </AvailStatusMessage>
        <AvailStatusMessage>
          <StatusApplicationControl Start="202X-03-20"
                                    End="202X-03-25"
                                    InvTypeCode="RoomID_1"
                                    RatePlanCode="PackageID_1"/>
          <LengthsOfStay>
            <LengthOfStay MinMaxMessageType="SetMinLOS" Time="2" TimeUnit="Day" />
          </LengthsOfStay>
          <RestrictionStatus Restriction="Master" Status="Open" />
        </AvailStatusMessage>
    </OTA_HotelAvailNotifRQ>

For more examples, see [Availability
examples](https://developers.google.com/hotels/hotel-prices/xml-reference/ari-avail#avail-examples).

## How-tos

This section provides solutions to scenarios you might encounter while sending
Availability messages, specifically details on the nightly availability
restriction (also known as "stop sell").

### Scenario 1: How to sell products on specific dates

#### Description

You want to make room type and rate plan combination (product) available on
specific dates.

> [!NOTE]
> **Note:** By default, Google treats products as having "stop sell" enabled (nightly availability is closed), but you can configure whether the nightly availability restriction is open or closed by default. You must either send Google an explicit `Open` for each product or change the default in the Hotel Center.

#### Solution

Set the `Master` restriction to `Open` and specify the dates.

#### Sample

This sample shows how to open nightly availability for a product for a few
weeks in March.

    <?xml version="1.0" encoding="UTF-8"?>
    <OTA_HotelAvailNotifRQ xmlns="http://www.opentravel.org/OTA/2003/05"
                           EchoToken="12345678"
                           TimeStamp="2022-03-20T20:50:37-05:00"
                           Version="3.0">
      <AvailStatusMessages HotelCode="Property_1">
        <AvailStatusMessage>
          <StatusApplicationControl Start="2022-03-20"
                                    End="2022-03-30"
                                    InvTypeCode="RoomID_1"
                                    RatePlanCode="PackageID_1"/>
          <RestrictionStatus Status="Open" Restriction="Master"/>
        </AvailStatusMessage>
      </AvailStatusMessages>
    </OTA_HotelAvailNotifRQ>

> [!NOTE]
> **Note:** The nightly availability restriction must be `Open` (and inventory must be an integer greater than `0` for the room) in order to show the price for a product.

For more information on how to set pricing, see [Troubleshooting missing or
incomplete pricing](https://support.google.com/hotelprices/answer/11190438).

### Scenario 2: How to stop selling products on specific dates

#### Description

You explicitly want to stop the sale of a product (rather than being out of
inventory) on specific dates.

> [!NOTE]
> **Note:** If the product is completely deactivated, because the room type, rate plan, or their combination is disabled, then it's preferred to use the [Transaction (Property Data)
> message](https://developers.google.com/hotels/hotel-prices/dev-guide/ari-transaction-message#overview) to unmap the product since it is not date dependent.

#### Solution

Set the `Master` restriction to `Close` and specify the dates.

#### Sample

This sample shows how to "stop sell" or close nightly availability for a
product on specified dates.

    <?xml version="1.0" encoding="UTF-8"?>
    <OTA_HotelAvailNotifRQ xmlns="http://www.opentravel.org/OTA/2003/05"
                           EchoToken="12345678"
                           TimeStamp="2022-03-20T20:50:37-05:00"
                           Version="3.0">
      <AvailStatusMessages HotelCode="Property_1">
        <AvailStatusMessage>
          <StatusApplicationControl Start="2022-04-20"
                                    End="2022-04-30"
                                    InvTypeCode="RoomID_1"
                                    RatePlanCode="PackageID_1"/>
          <RestrictionStatus Status="Close" Restriction="Master"/>
        </AvailStatusMessage>
      </AvailStatusMessages>
    </OTA_HotelAvailNotifRQ>