API reference

HTS APIs

Every endpoint, schema and error code, rendered from the published OpenAPI files, in the order you integrate them.

POST/api/lodging/v1/cancelCancel

Cancel a booking order

https://travel-distribution.staging.htsapis.com/api/lodging/v1/cancel

Completes the cancellation of an order, which was previously pre-canceled. You must first use the precancel operation to obtain a cancellation token, which is then used to complete the cancellation.

Note that this endpoint is idempotent, and the client can safely retry the request with the same cancellation token if the connection is lost.

The cancellation token is bound to the application that pre-cancelled: call /cancel with the API key of that same application, otherwise the request is rejected with 403 token_application_mismatch.

Request body application/json · required

Order ID and cancellation token from the precancel operation.

request_id
string · uuid
required

Unique value used to identify this request. If provided to us during operational questions, it will help us provide better support.

Example 123e4567-e89b-12d3-a456-426614174000
cancellation_token
string
required

Opaque token generated at cancellation quote time. Important: the token is bound to the application that pre-cancelled. Call /cancel with the API key of that same application, otherwise the request is rejected with 403 token_application_mismatch.

Example string

Responses

200Cancel a booking order by order id successfully
order_status
order_status · one of 2
required

Describes the status of a order.

  • confirmed - order was booked successfully
  • cancelled - order was cancelled successfully

This is a non-exhaustive list of enum values, which may be extended in the future."

Show fields

Describes the status of a order.

  • confirmed - order was booked successfully
  • cancelled - order was cancelled successfully

This is a non-exhaustive list of enum values, which may be extended in the future."

Exactly one of the following, selected by type:
cancelled (order_status_cancelled) order_status_cancelled
type
string enum
required

Discriminator value for cancelled order status

Values cancelled · Example cancelled
cancellation_info
cancellation_info · one of 2
required

Information on a cancelled order

Show fields

Information on a cancelled order

Exactly one of the following, selected by type:
hotel (cancellation_info_hotel) cancellation_info_hotel
type
string enum
required

Discriminator value identifying this cancellation info type.

Values hotel
vacation_rental (cancellation_info_vacation_rental) cancellation_info_vacation_rental
type
string enum
required

Discriminator value identifying this cancellation info type.

Values vacation_rental
instigator
string enum
required

Indicates who initiated the cancellation.

Values guesthost · Example guest
guest_refund_amount
object

The amount refunded to the guest for the cancelled vacation rental

Show fields
currency
string
required

Currency code, in ISO 4217 format.

Pattern ^[A-Z]{3}$ · Example USD
amount
string
required

Monetary amount value Serialized BigDecimal value

Example 123.45
confirmed (order_status_confirmed) order_status_confirmed
type
string enum
required

Discriminator value for confirmed order status

Values confirmed · Example confirmed
response_id
string · uuid
required

Unique identifier of the specific response. Use this identifier when you need to refer to a specific response, when requiring technical support.

Example 123e4567-e89b-12d3-a456-426614174000
400Invalid Request. There will be an error code in the response detailing the issue.
error_code
string enum
required

Error codes for the cancel operation. This is a non-exhaustive list of enum values, which will be extended in the future.

  • invalid_input - the request was malformed.
  • invalid_cancel_token - the cancellation token is invalid or expired.
  • order_already_cancelled - the order has already been cancelled.
  • unauthorized - the caller is not authorized to cancel this order.
  • cannot_be_cancelled - the reservation cannot be cancelled (e.g. the provider rejected the cancellation, the cancellation deadline has passed, or it is non-refundable). This is a terminal outcome; the description field carries the specific reason.
  • token_application_mismatch - the cancellation_token could not be shown to belong to the calling application. Precancel and cancel must be called with the API key of the same application. Returned when the token belongs to a different application, when it carries no application binding, and when the calling application cannot be determined; the description says which.
Values invalid_inputinvalid_cancel_tokenorder_already_cancelledunauthorizedcannot_be_cancelledtoken_application_mismatch
description
string
required

A human-readable description of the error. For cannot_be_cancelled, this conveys the specific reason (e.g. requires_agent_cancellation, past_cancellation_deadline, cancellation_not_allowed).

response_id
string · uuid
required

Unique identifier of the specific response. Use this identifier when you need to refer to a specific response, when requiring technical support.

Example 123e4567-e89b-12d3-a456-426614174000
Example
{
  "error_code": "invalid_input",
  "description": "string",
  "response_id": "123e4567-e89b-12d3-a456-426614174000"
}
403Forbidden. Returned when the `cancellation_token` cannot be shown to belong to the calling application — it was issued to a different application, it carries no application binding, or the calling application could not be determined. The response will contain the error code `token_application_mismatch`, with the specific reason in `description`.
error_code
string enum
required

Error codes for the cancel operation. This is a non-exhaustive list of enum values, which will be extended in the future.

  • invalid_input - the request was malformed.
  • invalid_cancel_token - the cancellation token is invalid or expired.
  • order_already_cancelled - the order has already been cancelled.
  • unauthorized - the caller is not authorized to cancel this order.
  • cannot_be_cancelled - the reservation cannot be cancelled (e.g. the provider rejected the cancellation, the cancellation deadline has passed, or it is non-refundable). This is a terminal outcome; the description field carries the specific reason.
  • token_application_mismatch - the cancellation_token could not be shown to belong to the calling application. Precancel and cancel must be called with the API key of the same application. Returned when the token belongs to a different application, when it carries no application binding, and when the calling application cannot be determined; the description says which.
Values invalid_inputinvalid_cancel_tokenorder_already_cancelledunauthorizedcannot_be_cancelledtoken_application_mismatch
description
string
required

A human-readable description of the error. For cannot_be_cancelled, this conveys the specific reason (e.g. requires_agent_cancellation, past_cancellation_deadline, cancellation_not_allowed).

response_id
string · uuid
required

Unique identifier of the specific response. Use this identifier when you need to refer to a specific response, when requiring technical support.

Example 123e4567-e89b-12d3-a456-426614174000
Example
{
  "error_code": "invalid_input",
  "description": "string",
  "response_id": "123e4567-e89b-12d3-a456-426614174000"
}
409Invalid Request. There will be an error code in the response detailing the issue.
error_code
string enum
required

Error codes for the cancel operation. This is a non-exhaustive list of enum values, which will be extended in the future.

  • invalid_input - the request was malformed.
  • invalid_cancel_token - the cancellation token is invalid or expired.
  • order_already_cancelled - the order has already been cancelled.
  • unauthorized - the caller is not authorized to cancel this order.
  • cannot_be_cancelled - the reservation cannot be cancelled (e.g. the provider rejected the cancellation, the cancellation deadline has passed, or it is non-refundable). This is a terminal outcome; the description field carries the specific reason.
  • token_application_mismatch - the cancellation_token could not be shown to belong to the calling application. Precancel and cancel must be called with the API key of the same application. Returned when the token belongs to a different application, when it carries no application binding, and when the calling application cannot be determined; the description says which.
Values invalid_inputinvalid_cancel_tokenorder_already_cancelledunauthorizedcannot_be_cancelledtoken_application_mismatch
description
string
required

A human-readable description of the error. For cannot_be_cancelled, this conveys the specific reason (e.g. requires_agent_cancellation, past_cancellation_deadline, cancellation_not_allowed).

response_id
string · uuid
required

Unique identifier of the specific response. Use this identifier when you need to refer to a specific response, when requiring technical support.

Example 123e4567-e89b-12d3-a456-426614174000
Example
{
  "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_code
string enum
required

Error returned when a client closes the connection before the response could be sent.

Values client_closed_request
description
string
required

A human-readable description of what happened. For booking requests, this may include the partner reference ID for tracking.

response_id
string · uuid
required

Unique identifier of the specific response. Use this identifier when you need to refer to a specific response, when requiring technical support.

Example 123e4567-e89b-12d3-a456-426614174000
additional_context
object

Additional 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_code
string enum
required

Error returned when an internal server error occurs.

Values internal_server_error
description
string
required

A human-readable description of the error.

response_id
string · uuid
required

Unique identifier of the specific response. Use this identifier when you need to refer to a specific response, when requiring technical support.

Example 123e4567-e89b-12d3-a456-426614174000
Example
{
  "error_code": "internal_server_error",
  "description": "string",
  "response_id": "123e4567-e89b-12d3-a456-426614174000"
}
Request
curl -X POST "https://travel-distribution.staging.htsapis.com/api/lodging/v1/cancel" \
  -H "HTS-API-KEY: $HTS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": "123e4567-e89b-12d3-a456-426614174000",
  "cancellation_token": "string"
}'
Response 200
{
  "order_status": {
    "type": "cancelled",
    "cancellation_info": {
      "type": "hotel",
      "cancellation_datetime": "2025-02-17T18:31:15.523Z"
    }
  },
  "response_id": "123e4567-e89b-12d3-a456-426614174000"
}

Examples are generated from the schema where the spec publishes none; field values are illustrative.