Rate Plans Collection

API methods to work with Rate Plans

Rate Plan is entity to represent how to sell your Room Types. This entity contain information about Base Price and restrictions.

Rate Plans List

Retrieve list of Rate Plans associated with user Properties.

Request
Success Response
Error Response

Request:

GET https://staging.channex.io/api/v1/rate_plans

Success Response Example

Status Code: 200 OK

{
"data": [
{
"type": "rate_plan",
"id": "bab451e7-9ab1-4cc4-aa16-107bf7bbabb2",
"attributes": {
"id": "bab451e7-9ab1-4cc4-aa16-107bf7bbabb2",
"title": "Best Available Rate",
"sell_mode": "per_room",
"rate_mode": "manual",
"currency": "GBP",
"children_fee": "0.00",
"infant_fee": "0.00",
"options": [
{
"rate": "200.00",
"occupancy": 3,
"is_primary": true,
"derived_option": null
}
],
"closed_to_arrival": [false, false, false, false, false, false, false],
"closed_to_departure": [false, false, false, false, false, false, false],
"stop_sell": [false, false, false, false, false, false, false],
"min_stay_arrival": [1, 1, 1, 1, 1, 1, 1],
"max_stay": [0, 0, 0, 0, 0, 0, 0],
"availability_offset": 0,
"max_sell": null,
"max_availability": null,
"inherit_rate": false,
"inherit_closed_to_arrival": false,
"inherit_closed_to_departure": false,
"inherit_stop_sell": false,
"inherit_min_stay_arrival": false,
"inherit_max_stay": false,
"inherit_availability_offset": false,
"inherit_max_sell": false,
"inherit_max_availability": false,
"auto_rate_settings": null
},
"relationships": {
"room_type": {
"data": {
"type": "room_type",
"id": "994d1375-dbbd-4072-8724-b2ab32ce781b"
}
},
"property": {
"data": {
"type": "property",
"id": "716305c4-561a-4561-a187-7f5b8aeb5920"
}
}
}
}
]
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
"errors": {
"code": "unauthorized",
"title": "Unauthorized"
}
}

Returns

Success Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a list of Rate Plan objects in the answer. Unauthorised Error Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.

Get Rate Plan by ID

Retrieve specific Rate Plan by ID.

Request
Success Response
Error Response

Request:

GET https://staging.channex.io/api/v1/rate_plans/:id

Success Response Example

Status Code: 200 OK

{
"data": {
"type": "rate_plan",
"id": "bab451e7-9ab1-4cc4-aa16-107bf7bbabb2",
"attributes": {
"id": "bab451e7-9ab1-4cc4-aa16-107bf7bbabb2",
"title": "Best Available Rate",
"sell_mode": "per_room",
"rate_mode": "manual",
"currency": "GBP",
"children_fee": "0.00",
"infant_fee": "0.00",
"options": [
{
"rate": "200.00",
"occupancy": 3,
"is_primary": true,
"derived_option": null
}
],
"closed_to_arrival": [false, false, false, false, false, false, false],
"closed_to_departure": [false, false, false, false, false, false, false],
"stop_sell": [false, false, false, false, false, false, false],
"min_stay_arrival": [1, 1, 1, 1, 1, 1, 1],
"max_stay": [0, 0, 0, 0, 0, 0, 0],
"availability_offset": 0,
"max_sell": null,
"max_availability": null,
"inherit_rate": false,
"inherit_closed_to_arrival": false,
"inherit_closed_to_departure": false,
"inherit_stop_sell": false,
"inherit_min_stay_arrival": false,
"inherit_max_stay": false,
"inherit_availability_offset": false,
"inherit_max_sell": false,
"inherit_max_availability": false,
"auto_rate_settings": null
},
"relationships": {
"room_type": {
"data": {
"type": "room_type",
"id": "994d1375-dbbd-4072-8724-b2ab32ce781b"
}
},
"property": {
"data": {
"type": "property",
"id": "716305c4-561a-4561-a187-7f5b8aeb5920"
}
}
}
}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
"errors": {
"code": "unauthorized",
"title": "Unauthorized"
}
}

Not Found Error

Status Code: 404 Not Found

{
"errors": {
"code": "not_found",
"title": "Resouce Not Found"
}
}

Returns

Success Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a Rate Plan object in the answer. Unauthorised Error Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.

Not Found Error Method can return a Not Found Error result with 404 Not Found HTTP Code if Rate Plan with provided ID is not present at system.

Create Rate Plan

Create new Rate Plan.

Request
Success Response
Error Response

Request:

POST https://staging.channex.io/api/v1/rate_plans

Query body (JSON):

{
"rate_plan": {
"title": "Best Available Rate",
"property_id": "716305c4-561a-4561-a187-7f5b8aeb5920",
"room_type_id": "994d1375-dbbd-4072-8724-b2ab32ce781b",
"parent_rate_plan_id": null,
"children_fee": "0.00",
"infant_fee": "0.00",
"options": [
{
"occupancy": 3,
"is_primary": true,
"rate": "200.00"
}
],
"currency": "GBP",
"sell_mode": "per_room",
"rate_mode": "manual",
"closed_to_arrival": [false, false, false, false, false, false, false],
"closed_to_departure": [false, false, false, false, false, false, false],
"stop_sell": [false, false, false, false, false, false, false],
"min_stay_arrival": [1, 1, 1, 1, 1, 1, 1],
"max_stay": [0, 0, 0, 0, 0, 0, 0],
"max_sell": null,
"max_availability": null,
"availability_offset": null,
"inherit_rate": false,
"inherit_closed_to_arrival": false,
"inherit_closed_to_departure": false,
"inherit_stop_sell": false,
"inherit_min_stay_arrival": false,
"inherit_max_stay": false,
"inherit_max_sell": false,
"inherit_max_availability": false,
"inherit_availability_offset": false,
"auto_rate_settings": null
}
}

Success Response Example

Status Code: 201 Created

{
"data": {
"type": "rate_plan",
"id": "bab451e7-9ab1-4cc4-aa16-107bf7bbabb2",
"attributes": {
"id": "bab451e7-9ab1-4cc4-aa16-107bf7bbabb2",
"title": "Best Available Rate",
"sell_mode": "per_room",
"rate_mode": "manual",
"currency": "GBP",
"children_fee": "0.00",
"infant_fee": "0.00",
"options": [
{
"rate": "200.00",
"occupancy": 3,
"is_primary": true,
"derived_option": null
}
],
"closed_to_arrival": [false, false, false, false, false, false, false],
"closed_to_departure": [false, false, false, false, false, false, false],
"stop_sell": [false, false, false, false, false, false, false],
"min_stay_arrival": [1, 1, 1, 1, 1, 1, 1],
"max_stay": [0, 0, 0, 0, 0, 0, 0],
"availability_offset": 0,
"max_sell": null,
"max_availability": null,
"inherit_rate": false,
"inherit_closed_to_arrival": false,
"inherit_closed_to_departure": false,
"inherit_stop_sell": false,
"inherit_min_stay_arrival": false,
"inherit_max_stay": false,
"inherit_availability_offset": false,
"inherit_max_sell": false,
"inherit_max_availability": false,
"auto_rate_settings": null
},
"relationships": {
"room_type": {
"data": {
"type": "room_type",
"id": "994d1375-dbbd-4072-8724-b2ab32ce781b"
}
},
"property": {
"data": {
"type": "property",
"id": "716305c4-561a-4561-a187-7f5b8aeb5920"
}
}
}
}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
"errors": {
"code": "unauthorized",
"title": "Unauthorized"
}
}

Validation Error Response

Status Code: 422 Unprocessable Entity

{
"errors": {
"code": "validation_error",
"title": "Validation Error",
"details": {
"title": [
"can't be blank"
]
}
}
}

Fields

title [required]

Any non-empty string with maximum length of 255 symbols. Should be unique per Property. Note: The Rate Plan will be represented in the system under that title.

property_id [required]

String with valid UUID of Property object what you would like to associate with created Rate Plan.

room_type_id [required]

String with valid UUID of Room Type object what you would like to associate with created Rate Plan.

parent_rate_plan_id [required]

String with valid UUID of Rate Plan object what you would like to associate as parent with created Rate Plan.

options [required]

Array of Occupancy Option objects.

currency [optional]

3 symbols long string with Currency Alphabetic code based at ISO 4217. Note: Field is optional, by default system set Currency from associated Property. Property can have Rate Plans with different Currencies.

sell_mode [optional]

String, allow only two values: per_room or per_person. Field is optional, be default system set per_room value. Note: Sell mode for Rate Plan. Per Room Rate Plan mean price is equal to any count of allowed guests. Price for 1 Guest will be same with price for 2 Guests. Per Person Rate Plan used to create Rate Plans where price is calculated based at Guests count.

rate_mode [optional]

String, allow only next values: manual, derived, auto, cascade. Field is optional, be default system set manual value. Note: Rate Mode field represent how to calculate rate for current Rate Plan. At Channex.io we have 4 possible ways to do that: Manual - price is specified at options.rate field. Derived - price derived from parent_rate_plan for primary occupancy option. Cascade - price derived from parent_rate_plan for each occupancy option. Auto - price calculated automatically based at price for primary occupancy option and auto_rate_settings. Read more about Rate Modes and Derived options at our Rate Plan Section.

closed_to_arrival [optional]

7 items long Array with boolean values. Represent Closed To Arrival restriction where each value at array affected to specific weekday.

closed_to_departure [optional]

7 items long Array with boolean values. Represent Closed To Departure restriction where each value at array affected to specific weekday.

stop_sell [optional]

7 items long Array with boolean values. Represent Stop Sell restriction where each value at array affected to specific weekday.

min_stay_arrival [optional]

7 items long Array with positive integer values. Represent Min Stay Arrival restriction where each value at array affected to specific weekday.

max_stay [optional]

7 items long Array with non-negative integer values. Represent Max Stay restriction where each value at array affected to specific weekday.

max_sell [optional]

Non-negative integer value. Represent maximum count of allowed sales for current Rate Plan.

max_availability [optional]

Non-negative integer value. Represent what maximum availability value will be send to OTA or open to sell. Can be used to limit count of rooms provided to sell at specific OTA.

availability_offset [optional]

Non-negative integer value. Represent offset for Rate Plan availability from Room Type availability. Can be used to limit count of sales for specific Rate Plan.

auto_rate_settings [optional]

Object with Auto Rate Settings structure. Field is optional generally, but required if rate_mode equal to auto. This object contain information how to increase or decrease rate options from primary occupancy option.

inherit_rate [optional]

Boolean value. Field is optional. By default equal to false if parent_rate_plan_id is empty, true if parent_rate_plan_id is present. Allow Rate Plan derive rate from Parent Rate Plan. When Parent Rate Plan is changed, Rate Plan will be automatically updated.

inherit_closed_to_arrival [optional]

Boolean value. Field is optional. By default equal to false if parent_rate_plan_id is empty, true if parent_rate_plan_id is present. Allow Rate Plan derive closed_to_arrival from Parent Rate Plan. When Parent Rate Plan is changed, Rate Plan will be automatically updated.

inherit_closed_to_departure [optional]

Boolean value. Field is optional. By default equal to false if parent_rate_plan_id is empty, true if parent_rate_plan_id is present. Allow Rate Plan derive closed_to_departure from Parent Rate Plan. When Parent Rate Plan is changed, Rate Plan will be automatically updated.

inherit_stop_sell [optional]

Boolean value. Field is optional. By default equal to false if parent_rate_plan_id is empty, true if parent_rate_plan_id is present. Allow Rate Plan derive stop_sell from Parent Rate Plan. When Parent Rate Plan is changed, Rate Plan will be automatically updated.

inherit_min_stay_arrival [optional]

Boolean value. Field is optional. By default equal to false if parent_rate_plan_id is empty, true if parent_rate_plan_id is present. Allow Rate Plan derive min_stay_arrival from Parent Rate Plan. When Parent Rate Plan is changed, Rate Plan will be automatically updated.

inherit_max_stay [optional]

Boolean value. Field is optional. By default equal to false if parent_rate_plan_id is empty, true if parent_rate_plan_id is present. Allow Rate Plan derive max_stay from Parent Rate Plan. When Parent Rate Plan is changed, Rate Plan will be automatically updated.

inherit_max_sell [optional]

Boolean value. Field is optional. By default equal to false if parent_rate_plan_id is empty, true if parent_rate_plan_id is present. Allow Rate Plan derive max_sell from Parent Rate Plan. When Parent Rate Plan is changed, Rate Plan will be automatically updated.

inherit_max_availability [optional]

Boolean value. Field is optional. By default equal to false if parent_rate_plan_id is empty, true if parent_rate_plan_id is present. Allow Rate Plan derive max_availability from Parent Rate Plan. When Parent Rate Plan is changed, Rate Plan will be automatically updated.

inherit_availability_offset [optional]

Boolean value. Field is optional. By default equal to false if parent_rate_plan_id is empty, true if parent_rate_plan_id is present. Allow Rate Plan derive availability_offset from Parent Rate Plan. When Parent Rate Plan is changed, Rate Plan will be automatically updated.

Occupancy Options

Occupancy options is entity chained with Rate Plan and represent prices for different count of guests. If you create Per Room Rate Plan you should pass Occupancy Option for maximum occupancy. For Per Person Rate Plan you should pass Occupancy Option for each possible count of adult guests.

Each Occupancy Option should have next fields:

occupancy [required]

Any positive integer value. Count of guests allowed for current Occupancy Option

is_primary [required]

Boolean value. Marker to show main Occupancy Option. Actual for derived options, because Main Option will be used as base point for calculations.

rate [optional]

String or non-negative integer value. Price for current Occupancy Option. Field is required if sell_mode equal to manual or if current Option is_primary equal to true and you create non-derived Rate Plan. Rate value can be passed as String or as Integer value. To prevent any mistakes with floating points values provided as String parsed as regular numbers, but Integer values parsed as count of cents (minimal fraction size of currency). To set price equal to 100 GBP you can provide: "100", "100.00" or 10000 values.

derived_options [optional]

Valid Derived Options Object. This field represent rules to derive and modify parent values for current rate occupancy option.

Derived Options

Derived Options is rules to modify value from Parent Rate Plan or Primary Occupancy Option. This field represented as Object and has next structure:

{
"rate": [["increase_by_amount", "10"]]
}

Usually this object contain information about Rate modification, but you can modify Min Stay Arrival, Availability Offset and other values.

Object should contain key of modified restriction and array of arrays with modification rules. Each modification rule should be represented as 2 items length Array, where first item is modification rule, second item is modification argument. Each modification rule applied to original value step-by-step, from left side to right.

Modification rules

increase_by_amount Add provided amount to original price. increase_by_percent Increase original value by provided percent value. Applicable only for Rate restriction. decrease_by_amount Decrease original value by provided amount. decrease_by_percent Decrease original value by provided percent value. Applicable only for Rate restriction.

Example:

{
"rate": [["increase_by_percent", "5.00"], ["increase_by_amount", "12.00"]]
}

In that example we are take original value, 100 $ as example, then add 5% and then add 12.00$ and receive 117$ as result value.

100.00$ + 5% -> 105.00$
105$ + 12.00 -> 117.00$

You are not limited at count of modification rules.

Returns

Success Method can return a Success result with 201 Created HTTP Code if operation is successful. Will contain a Rate Plan object in the answer.

Unauthorised Error Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.

Validation Error Method can return a Validation Error result with 422 Unprocessable Entity HTTP Code if any validation rule is failed.

Update Rate Plan

Update Rate Plan.

Request
Success Response
Error Response

Request:

PUT https://staging.channex.io/api/v1/rate_plans/:id

Query body (JSON):

{
"rate_plan": {
"title": "Best Available Rate",
"property_id": "716305c4-561a-4561-a187-7f5b8aeb5920",
"room_type_id": "994d1375-dbbd-4072-8724-b2ab32ce781b",
"parent_rate_plan_id": null,
"children_fee": "0.00",
"infant_fee": "0.00",
"options": [
{
"occupancy": 3,
"is_primary": true,
"rate": "200.00"
}
],
"currency": "GBP",
"sell_mode": "per_room",
"rate_mode": "manual",
"closed_to_arrival": [false, false, false, false, false, false, false],
"closed_to_departure": [false, false, false, false, false, false, false],
"stop_sell": [false, false, false, false, false, false, false],
"min_stay_arrival": [1, 1, 1, 1, 1, 1, 1],
"max_stay": [0, 0, 0, 0, 0, 0, 0],
"max_sell": null,
"max_availability": null,
"availability_offset": null,
"inherit_rate": false,
"inherit_closed_to_arrival": false,
"inherit_closed_to_departure": false,
"inherit_stop_sell": false,
"inherit_min_stay_arrival": false,
"inherit_max_stay": false,
"inherit_max_sell": false,
"inherit_max_availability": false,
"inherit_availability_offset": false,
"auto_rate_settings": null
}
}

Success Response Example

Status Code: 200 OK

{
"data": {
"type": "rate_plan",
"id": "bab451e7-9ab1-4cc4-aa16-107bf7bbabb2",
"attributes": {
"id": "bab451e7-9ab1-4cc4-aa16-107bf7bbabb2",
"title": "Best Available Rate",
"sell_mode": "per_room",
"rate_mode": "manual",
"currency": "GBP",
"children_fee": "0.00",
"infant_fee": "0.00",
"options": [
{
"rate": "200.00",
"occupancy": 3,
"is_primary": true,
"derived_option": null
}
],
"closed_to_arrival": [false, false, false, false, false, false, false],
"closed_to_departure": [false, false, false, false, false, false, false],
"stop_sell": [false, false, false, false, false, false, false],
"min_stay_arrival": [1, 1, 1, 1, 1, 1, 1],
"max_stay": [0, 0, 0, 0, 0, 0, 0],
"availability_offset": 0,
"max_sell": null,
"max_availability": null,
"inherit_rate": false,
"inherit_closed_to_arrival": false,
"inherit_closed_to_departure": false,
"inherit_stop_sell": false,
"inherit_min_stay_arrival": false,
"inherit_max_stay": false,
"inherit_availability_offset": false,
"inherit_max_sell": false,
"inherit_max_availability": false,
"auto_rate_settings": null
},
"relationships": {
"room_type": {
"data": {
"type": "room_type",
"id": "994d1375-dbbd-4072-8724-b2ab32ce781b"
}
},
"property": {
"data": {
"type": "property",
"id": "716305c4-561a-4561-a187-7f5b8aeb5920"
}
}
}
}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
"errors": {
"code": "unauthorized",
"title": "Unauthorized"
}
}

Not Found Error

Status Code: 404 Not Found

{
"errors": {
"code": "resource_not_found"
"title": "Resource Not Found"
}
}

Validation Error Response

Status Code: 422 Unprocessable Entity

{
"errors": {
"code": "validation_error",
"title": "Validation Error",
"details": {
"title": [
"can't be blank"
]
}
}
}

Fields

This method use same fields as Create Rate Plan method.

Returns

Success Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a Rate Plan object in the answer. Unauthorised Error Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.

Not Found Error Method can return a Not Found Error result with 404 Not Found HTTP Code if Rate Plan with provided ID is not present at system.

Validation Error Method can return a Validation Error result with 422 Unprocessable Entity HTTP Code if any validation rule is failed.

Remove Rate Plan

Remove Rate Plan.

Request
Success Response
Error Response

Request:

DELETE https://staging.channex.io/api/v1/rate_plans/:id

Success Response Example

Status Code: 200 OK

{
"meta": {
"message": "Success"
}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
"errors": {
"code": "unauthorized",
"title": "Unauthorized"
}
}

Not Found Error

Status Code: 404 Not Found

{
"errors": {
"code": "resource_not_found"
"title": "Resource Not Found"
}
}

Returns

Success Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a Meta object with message in the answer.

Unauthorised Error Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.

Not Found Error Method can return a Not Found Error result with 404 Not Found HTTP Code if Rate Plan with provided ID is not present at system.