HTS APIs
Every endpoint, schema and error code, rendered from the published OpenAPI files, in the order you integrate them.
/api/lodging/v1/preCancelPre-cancelPre-Cancel a booking order
Quote the cancellation for given order id. We determine whether a product in the order is within the cancellation policy, and if it is what the appropriate sell refund value are for the product. Calling precancel does not change the state of the booking order. It is only at the time of cancel that the booking order is actually cancelled.
Request body application/json · required
Order ID to quote cancellation and obtain a cancellation token.
request_idUnique value used to identify this request. If provided to us during operational questions, it will help us provide better support.
123e4567-e89b-12d3-a456-426614174000order_idUnique Hopper-generated order id corresponding to the booking order
L2J982VT3J28Responses
200Pre-cancel a booking order by order id successfully
cancellation_penaltyCancellation penalty for a lodging.
This object will contain an ordered sequence of gapless penalty ranges starting from the booking time and ending at the check-in time.
The penalty amount will be withheld if the cancellation time falls within the range of the start time (inclusive) and end time (exclusive).
A penalty range with 0 amount indicates that the rate if fully refundable on that range. On the other hand, if the penalty amount equals the booking amount, the rate is non-refundable on that range.
Show fields
penalty_rangesOrdered sequence of gapless penalty ranges from booking time to check-in
Show fields
start_timeStart time of the penalty range (Inclusive), in ISO 8601 format
2020-01-01T00:00:00Zend_timeEnd time of the penalty range (Exclusive), in ISO 8601 format
2020-01-02T00:00:00ZpenaltyMonetary amount withheld from the client if cancellation falls within this range
Show fields
currencyCurrency code, in ISO 4217 format.
^[A-Z]{3}$ · Example USDamountMonetary amount value Serialized BigDecimal value
123.45refund_amountThe amount that will be refunded to the client
Show fields
amountMonetary amount value Serialized BigDecimal value
123.45currencyCurrency code, in ISO 4217 format.
^[A-Z]{3}$ · Example USDcancellation_tokenToken to use to complete the cancellation, using the cancel operation
stringvalid_untilISO 8601 timestamp until which the cancellation quote remains valid.
2025-01-13T13:45:15.523Zresponse_idUnique identifier of the specific response. Use this identifier when you need to refer to a specific response, when requiring technical support.
123e4567-e89b-12d3-a456-426614174000400Invalid Request. There will be an error code in the response detailing the issue.
error_codeError codes for the pre-cancel operation. This is a non-exhaustive list of enum values, which will be extended in the future.
invalid_inputorder_not_foundorder_already_cancelledunauthorizeddescriptionA human-readable description of the error.
response_idUnique identifier of the specific response. Use this identifier when you need to refer to a specific response, when requiring technical support.
123e4567-e89b-12d3-a456-426614174000Example
{
"error_code": "invalid_input",
"description": "string",
"response_id": "123e4567-e89b-12d3-a456-426614174000"
}404Invalid Request. There will be an error code in the response detailing the issue.
error_codeError codes for the pre-cancel operation. This is a non-exhaustive list of enum values, which will be extended in the future.
invalid_inputorder_not_foundorder_already_cancelledunauthorizeddescriptionA human-readable description of the error.
response_idUnique identifier of the specific response. Use this identifier when you need to refer to a specific response, when requiring technical support.
123e4567-e89b-12d3-a456-426614174000Example
{
"error_code": "invalid_input",
"description": "string",
"response_id": "123e4567-e89b-12d3-a456-426614174000"
}409Conflict. Returned when the order is already cancelled. The response will contain the error code `order_already_cancelled`.
error_codeError codes for the pre-cancel operation. This is a non-exhaustive list of enum values, which will be extended in the future.
invalid_inputorder_not_foundorder_already_cancelledunauthorizeddescriptionA human-readable description of the error.
response_idUnique identifier of the specific response. Use this identifier when you need to refer to a specific response, when requiring technical support.
123e4567-e89b-12d3-a456-426614174000Example
{
"error_code": "invalid_input",
"description": "string",
"response_id": "123e4567-e89b-12d3-a456-426614174000"
}499Client closed the connection before the response could be sent (HTTP 499). This occurs when clients timeout or cancel requests while the server is still processing. The client will not receive this response. This means a quote, a booking or any other long running process may have been processed.
error_codeError returned when a client closes the connection before the response could be sent.
client_closed_requestdescriptionA human-readable description of what happened. For booking requests, this may include the partner reference ID for tracking.
response_idUnique identifier of the specific response. Use this identifier when you need to refer to a specific response, when requiring technical support.
123e4567-e89b-12d3-a456-426614174000additional_contextAdditional context about the error. For booking requests, includes partner_reference_id for tracking in BigQuery.
Example
{
"error_code": "client_closed_request",
"description": "string",
"response_id": "123e4567-e89b-12d3-a456-426614174000",
"additional_context": {}
}500Internal server error
error_codeError returned when an internal server error occurs.
internal_server_errordescriptionA human-readable description of the error.
response_idUnique identifier of the specific response. Use this identifier when you need to refer to a specific response, when requiring technical support.
123e4567-e89b-12d3-a456-426614174000Example
{
"error_code": "internal_server_error",
"description": "string",
"response_id": "123e4567-e89b-12d3-a456-426614174000"
}curl -X PUT "https://travel-distribution.staging.htsapis.com/api/lodging/v1/preCancel" \
-H "HTS-API-KEY: $HTS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"request_id": "123e4567-e89b-12d3-a456-426614174000",
"order_id": "L2J982VT3J28"
}'{
"cancellation_penalty": {
"penalty_ranges": [
{
"start_time": "2020-01-01T00:00:00Z",
"end_time": "2020-01-02T00:00:00Z",
"penalty": {
"currency": "USD",
"amount": "0.00"
}
},
{
"start_time": "2020-01-02T00:00:00Z",
"end_time": "2020-01-03T00:00:00Z",
"penalty": {
"currency": "USD",
"amount": "75.00"
}
},
{
"start_time": "2020-01-03T00:00:00Z",
"end_time": "2020-01-05T00:00:00Z",
"penalty": {
"currency": "USD",
"amount": "135.00"
}
}
]
},
"refund_amount": {
"amount": "123.45",
"currency": "USD"
},
"cancellation_token": "string",
"valid_until": "2025-01-13T13:45:15.523Z",
"response_id": "123e4567-e89b-12d3-a456-426614174000"
}Examples are generated from the schema where the spec publishes none; field values are illustrative.
