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 Type | How 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
statusis"Closed", the room is marked as a stop sell (closed for sale), even if there are still available rooms. ThebookingLimitvalue is preserved in the system but the room will not be available for booking.
Request
Headers
| Header | Value | Required |
|---|---|---|
| Content-Type | application/json | Yes |
| Authorization | refer to this document | Yes |
Body Structure
| No | Level 1 | Level 2 | Level 3 | Level 4 | Data Type | Mandatory | Description | Example |
|---|---|---|---|---|---|---|---|---|
| 1 | requestID | String | Y | Unique ID generated by the booking channel and returned in the response. Used to track each request. | c3a0e458155e11eebe560242ac120002 | |||
| 2 | timeStamp | String | Y | Request time in ISO 8601 format: YYYY-MM-DDTHH:MM:SS.000Z | 2023-06-28T10:50:42.179Z | |||
| 3 | hotelCode | String | Y | Unique code assigned to each hotel | 8-FWHC | |||
| 4 | ratePlanCode | Array | Y | Array of rate plan entries (1 to n) | ||||
| 5 | code | String | Y | Rate plan code | FOTAC | |||
| 6 | invTypeCode | String | Y | Room type code | TRP | |||
| 7 | calendar | Array | Y | Array of calendar date entries (1 to n) | ||||
| 8 | start | String | Y | Availability start date. Format: YYYY-MM-DD | 2023-06-28 | |||
| 9 | end | String | Y | Availability end date. Format: YYYY-MM-DD | 2023-06-30 | |||
| 10 | bookingLimit | Integer | Y | Total rooms available for this room type. Must be >= 0. | 50 | |||
| 11 | restrictionStatus | Object | Y | Restriction status object (1:1) | ||||
| 12 | status | String | Y | Room 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)
| No | Field | Data Type | Description | Example |
|---|---|---|---|---|
| 1 | requestID | String | Echoed from the request | c3a0e458155e11eebe560242ac120002 |
| 2 | hotelCode | String | Echoed from the request | PMS001 |
| 3 | timeStamp | String | Echoed from the request, in ISO 8601 format | 2023-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
| Field | Rule |
|---|---|
| requestID | Mandatory, cannot be empty |
| timeStamp | Mandatory, must be in ISO 8601 format (e.g., 2023-06-28T10:50:42.179Z) |
| hotelCode | Mandatory, cannot be empty |
| ratePlanCode | Mandatory, must contain at least one entry |
| ratePlanCode[].code | Mandatory, cannot be empty |
| ratePlanCode[].invTypeCode | Mandatory, cannot be empty |
| ratePlanCode[].calendar | Mandatory, must contain at least one entry |
| calendar[].start | Mandatory, must be in YYYY-MM-DD format |
| calendar[].end | Mandatory, must be in YYYY-MM-DD format, must be >= start date |
| calendar[].bookingLimit | Mandatory, must be >= 0 |
| calendar[].restrictionStatus | Mandatory |
| restrictionStatus.status | Mandatory, must be "Open" or "Closed" (case-sensitive) |
