getAvailabilityAndRestrictions

getAvailabilityAndRestrictions

Update the availability and restrictions for one room type in a single hotel per one request message. You can update multiple rate plans and calendar date ranges within one message.

Endpoint:

POST https://supplyota.agoda.com/b2b/ota/v1/gentings/merchant/getAvailabilityAndRestrictions

How to Set Restrictions

The restriction details are identified in the restrictionStatus object within each calendar entry.

Open/Closed Restriction Setting

Restriction TypeHow it will be sent
Room is open for sale (available for booking)"restrictionStatus": { "status": "Open" }
Room is closed for sale (not available for booking)"restrictionStatus": { "status": "Closed" }

Note: When status is "Closed", the room is marked as a stop sell (closed for sale), even if there are still available rooms. The bookingLimit value is preserved in the system but the room will not be available for booking.


Request

Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
Authorizationrefer to this documentYes

Body Structure

NoLevel 1Level 2Level 3Level 4Data TypeMandatoryDescriptionExample
1requestIDStringYUnique ID generated by the booking channel and returned in the response. Used to track each request.c3a0e458155e11eebe560242ac120002
2timeStampStringYRequest time in ISO 8601 format: YYYY-MM-DDTHH:MM:SS.000Z2023-06-28T10:50:42.179Z
3hotelCodeStringYUnique code assigned to each hotel8-FWHC
4ratePlanCodeArrayYArray of rate plan entries (1 to n)
5codeStringYRate plan codeFOTAC
6invTypeCodeStringYRoom type codeTRP
7calendarArrayYArray of calendar date entries (1 to n)
8startStringYAvailability start date. Format: YYYY-MM-DD2023-06-28
9endStringYAvailability end date. Format: YYYY-MM-DD2023-06-30
10bookingLimitIntegerYTotal rooms available for this room type. Must be >= 0.50
11restrictionStatusObjectYRestriction status object (1:1)
12statusStringYRoom status. Possible values: Open (available for booking), Closed (not available for booking). Case-sensitive.Open

Request Examples

Example 1: Open Status (Room available for booking)

{
  "requestID": "c3a0e458155e11eebe560242ac120002",
  "timeStamp": "2023-03-01T07:17:42.179Z",
  "hotelCode": "PMS001",
  "ratePlanCode": [
    {
      "code": "FOTAC",
      "invTypeCode": "TRP",
      "calendar": [
        {
          "start": "2023-07-01",
          "end": "2023-07-10",
          "bookingLimit": 50,
          "restrictionStatus": {
            "status": "Open"
          }
        }
      ]
    }
  ]
}

Example 2: Closed Status (Room not available for booking / Stop Sell)

{
  "requestID": "c3a0e458155e11eebe560242ac120002",
  "timeStamp": "2023-03-01T07:17:42.179Z",
  "hotelCode": "PMS001",
  "ratePlanCode": [
    {
      "code": "FOTAC",
      "invTypeCode": "TRP",
      "calendar": [
        {
          "start": "2023-07-01",
          "end": "2023-07-10",
          "bookingLimit": 0,
          "restrictionStatus": {
            "status": "Closed"
          }
        }
      ]
    }
  ]
}

Example 3: Multiple Rate Plans and Calendar Entries

{
  "requestID": "c3a0e458155e11eebe560242ac120002",
  "timeStamp": "2023-03-01T07:17:42.179Z",
  "hotelCode": "PMS001",
  "ratePlanCode": [
    {
      "code": "FOTAC",
      "invTypeCode": "TRP",
      "calendar": [
        {
          "start": "2023-07-01",
          "end": "2023-07-05",
          "bookingLimit": 10,
          "restrictionStatus": {
            "status": "Open"
          }
        },
        {
          "start": "2023-07-06",
          "end": "2023-07-10",
          "bookingLimit": 0,
          "restrictionStatus": {
            "status": "Closed"
          }
        }
      ]
    },
    {
      "code": "FOTAC",
      "invTypeCode": "DBL",
      "calendar": [
        {
          "start": "2023-07-01",
          "end": "2023-07-10",
          "bookingLimit": 20,
          "restrictionStatus": {
            "status": "Open"
          }
        }
      ]
    }
  ]
}

Response

Success Response (200 OK)

NoFieldData TypeDescriptionExample
1requestIDStringEchoed from the requestc3a0e458155e11eebe560242ac120002
2hotelCodeStringEchoed from the requestPMS001
3timeStampStringEchoed from the request, in ISO 8601 format2023-06-28T10:50:42.179Z
{
  "requestID": "c3a0e458155e11eebe560242ac120002",
  "hotelCode": "PMS001",
  "timeStamp": "2023-06-28T10:50:42.179Z"
}

Error Responses

All error responses return a JSON object with a message field.

Validation Error (400):

{
  "message": "Validation failed: bookingLimit: must be >= 0"
}

Missing Required Field (400):

{
  "message": "Validation failed: hotelCode: Missing required field"
}

Invalid Date Format (400):

{
  "message": "Validation failed: start: must be in YYYY-MM-DD format"
}

Invalid Restriction Status (400):

{
  "message": "Validation failed: status: must be Open or Closed"
}

See Overview - Common Error Responses for authentication, hotel not found, and server error responses.


Validation Rules

FieldRule
requestIDMandatory, cannot be empty
timeStampMandatory, must be in ISO 8601 format (e.g., 2023-06-28T10:50:42.179Z)
hotelCodeMandatory, cannot be empty
ratePlanCodeMandatory, must contain at least one entry
ratePlanCode[].codeMandatory, cannot be empty
ratePlanCode[].invTypeCodeMandatory, cannot be empty
ratePlanCode[].calendarMandatory, must contain at least one entry
calendar[].startMandatory, must be in YYYY-MM-DD format
calendar[].endMandatory, must be in YYYY-MM-DD format, must be >= start date
calendar[].bookingLimitMandatory, must be >= 0
calendar[].restrictionStatusMandatory
restrictionStatus.statusMandatory, must be "Open" or "Closed" (case-sensitive)