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/bookBook

Book a lodging

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

Finalizes and confirms the reservation for a lodging using the provided quote token and primary guest information. This endpoint processes the booking transaction and returns a confirmation with reservation details.

Idempotency and Retry Behavior

This endpoint is idempotent for retries of the same booking attempt:

  • Safe to retry with the same request_id, book_token, partner_reference_id, and guest details if the connection is lost
  • Returns the same order_id and booking confirmation for identical retry requests

Important: Do NOT reuse a book_token for different bookings:

  • Each unique booking (different guests, different reservations) requires a new /quote call to obtain a fresh book_token
  • Reusing a book_token from a completed booking with different guest details will result in an error
  • Even for identical hotel/dates/room combinations with different guests, you must call /quote again to get a new book_token

Payment declined:

  • A 422 payment_declined is final for that book_token: no reservation was created and no charge was made, and the book_token cannot be reused
  • To try again, call /quote for a fresh book_token and book with corrected payment details or a different payment method

One application per funnel:

  • Call /shop, /quote and /book with the API key of that same application
  • A book_token obtained by another application is rejected with 403 token_application_mismatch

Request body application/json · required

Quote token and primary guest details to finalize the booking.

book_token
string
required

Opaque token from the /quote response used to finalize this booking. Important: Use the book_token only for the booking it was generated for. Each unique booking (different guests or reservations) requires calling /quote to obtain a new token. Reusing a token from a completed booking will result in an error. The token is also bound to the application that quoted it. Call /book with the API key of that same application, otherwise the request is rejected with 403 token_application_mismatch.

Example string
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
partner_reference_id
string
required

A client-determined unique identifier for this booking, used for reconciliation and tracking. Important: This identifier must be unique across all your bookings. Reusing the same partner_reference_id for different bookings will result in an error. Use a different value for each unique reservation, even when booking the same hotel/dates/room with different guests.

Example 123e4567-e89b-12d3-a456-426614174000
primary_guest
PrimaryGuest
required

Details of the primary guest who will check in for the reservation.

Show fields
first_name
string · person-name
required

First name of the primary guest. Validation allows ANY character in any language (Latin, CJK, Arabic, etc), numbers, and punctuation. Strictly blocks Emojis and other 4-byte Unicode characters.

Length ≥ 1, ≤ 255 · Pattern ^[\u0000-\uD7FF\uE000-\uFFFF]+$ · Example Fred
last_name
string · person-name
required

Last name of the primary guest. Validation allows ANY character in any language, numbers, and punctuation. Strictly blocks Emojis and other 4-byte Unicode characters.

Length ≥ 1, ≤ 255 · Pattern ^[\u0000-\uD7FF\uE000-\uFFFF]+$ · Example Lalonde
email
string · email
required

Email address of the primary guest.

Example fred@example.com
phone
string

Phone number of the primary guest.

Pattern ^\+?[0-9]{7,15}$ · Example +18339334671
hotel_loyalty
array of hotel_loyalty

Optional. The guest's hotel loyalty memberships. Send whichever the guest holds; we forward the one matching the program on the rate being booked. Always accepted, whatever the quote said. loyalty.loyalty_transmission on the quote advises whether collecting a membership is worth it — where it is not eligible we may have no way to transmit one, so the guest should verify at check-in — but it never gates this field.

Items ≤ 10
Show fields
Array of hotel_loyalty · Optional. The guest's hotel loyalty memberships. Send whichever the guest holds; we forward the one matching the program on the rate being booked. Always accepted, whatever the quote said. `loyalty.loyalty_transmission` on the quote advises whether collecting a membership is worth it — where it is not `eligible` we may have no way to transmit one, so the guest should verify at check-in — but it never gates this field.
Items ≤ 10
program_code
string
required

The 3-character code identifying a hotel loyalty program.

Codes are added as more programs are supported, so treat an unrecognised code as a program you do not yet know about rather than as invalid.

Eligibility is determined by the provider from the rate plan; it is never derived from the traveller, and no loyalty membership is required to shop or book a loyalty-eligible rate.

Length ≥ 3, ≤ 3 · Pattern ^[A-Z0-9]{3}$
loyalty_number
string
required

The guest's membership number for this loyalty program.

Length ≥ 1, ≤ 64 · Example 123456789
payment_method
book_payment_method · one of 1

Payment method for direct credit card payment. Required for tenants configured for direct payment processing; ignored for others. Use the provider-specific variant to supply the vault token. Contact Hopper to enable this feature for your tenant.

Show fields

Payment method for direct credit card payment. Required for tenants configured for direct payment processing; ignored for others. Use the provider-specific variant to supply the vault token. Contact Hopper to enable this feature for your tenant.

Exactly one of the following, selected by provider:
spreedly (spreedly_payment_method) spreedly_payment_method
provider
string enum
required

Identifies this as a Spreedly payment method.

Values spreedly · Example spreedly
token
string
required

Payment method token issued by the Spreedly vault.

Length ≥ 1 · Example LbDpERKx17Y8PGeR4EvnMVdB1bN
fraud_prevention
fraud_prevention · one of 1

Fraud prevention data collected by the partner. Required for tenants using partner-managed fraud prevention; ignored for others. Use the type-specific variant to supply session data. Contact Hopper to enable this feature for your tenant.

Show fields

Fraud prevention data collected by the partner. Required for tenants using partner-managed fraud prevention; ignored for others. Use the type-specific variant to supply session data. Contact Hopper to enable this feature for your tenant.

Exactly one of the following, selected by type:
riskified (riskified_fraud_prevention) riskified_fraud_prevention
type
string enum
required

Identifies this as a Riskified fraud prevention payload.

Values riskified · Example riskified
customer_ip_address
string
required

The IP address of the customer making the booking.

Length ≥ 1 · Example 203.0.113.42
session_token
string

Session token from the fraud prevention provider (e.g. the Riskified Beacon session ID).

Example 00000000-0000-0000-0000-000000000000
user_agent
string

The User-Agent string of the customer's browser or device.

Example Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)

Responses

200Booking confirmation details with reservation information.
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
order_id
string
required

Unique Hopper-generated order id corresponding to the booking order

Example L2J982VT3J28
booking_warnings
array of booking_warning

Non-fatal issues encountered while creating this booking. The reservation is confirmed regardless; an empty or absent list means no issues. Warnings describe what happened at booking time and are not repeated on the order.

Show fields
Array of booking_warning · Non-fatal issues encountered while creating this booking. The reservation is confirmed regardless; an empty or absent list means no issues. Warnings describe what happened at booking time and are not repeated on the order.
type
string enum
required

Which warning this is, and therefore which sub-field below is populated.

  • loyalty_not_applied: a loyalty membership supplied on the book request was rejected.
Values loyalty_not_applied · Example loyalty_not_applied
loyalty_not_applied
loyalty_not_applied

A loyalty membership supplied on the book request was rejected. The reservation is confirmed; the stay will not be credited to that membership.

This warning is only emitted where the outcome is known. Pass-through is best effort: most supply sources never confirm either way, and silence produces no warning — so the absence of one means we sent what we could and have nothing to report, not that the stay was credited.

Show fields
reason
string enum
required

Why the membership was rejected. This is a non-exhaustive list of enum values, which will be extended in the future.

  • not_supported_for_rate: the booking path for this rate cannot transmit a loyalty membership. Known in advance when loyalty.loyalty_transmission on the quote was ineligible; where it was unknown this may be the first confirmation.
  • id_not_found: the membership number was not recognised.
  • invalid_format: the membership number was malformed for this program.
  • unspecified: rejected for a reason that does not map to the values above.
Values not_supported_for_rateid_not_foundinvalid_formatunspecified · Example id_not_found
400Invalid Request. There will be an error code in the response detailing the issue.
error_code
string enum
required

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

  • token_application_mismatch - the book_token could not be shown to belong to the calling application. A funnel must be completed by the application that started it: shop, quote and book must all be called with the API key of that 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.
  • loyalty_number_failure - the booking was rejected by the provider over the guest's hotel loyalty membership. Covers three underlying causes — the provider required a loyalty number and none was supplied, the number was not recognised, or the number was malformed for that provider; the description says which. Expected to be rare: where the provider allows the booking to be retried without the membership it is, and the reservation is confirmed instead, so this error is only returned where it cannot be.
  • payment_declined - the payment for the booking was declined. No reservation was created and no charge was made. The book_token cannot be reused; call /quote again and book with corrected payment details or a different payment method.
Values invalid_inputinvalid_book_tokenrate_unavailableduplicate_partner_reference_idpayment_gateway_errorbook_token_already_usedunauthorizedtoken_application_mismatchloyalty_number_failurepayment_declined
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": "invalid_input",
  "description": "string",
  "response_id": "123e4567-e89b-12d3-a456-426614174000"
}
403Forbidden. Returned when the `book_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 book operation. This is a non-exhaustive list of enum values, which will be extended in the future.

  • token_application_mismatch - the book_token could not be shown to belong to the calling application. A funnel must be completed by the application that started it: shop, quote and book must all be called with the API key of that 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.
  • loyalty_number_failure - the booking was rejected by the provider over the guest's hotel loyalty membership. Covers three underlying causes — the provider required a loyalty number and none was supplied, the number was not recognised, or the number was malformed for that provider; the description says which. Expected to be rare: where the provider allows the booking to be retried without the membership it is, and the reservation is confirmed instead, so this error is only returned where it cannot be.
  • payment_declined - the payment for the booking was declined. No reservation was created and no charge was made. The book_token cannot be reused; call /quote again and book with corrected payment details or a different payment method.
Values invalid_inputinvalid_book_tokenrate_unavailableduplicate_partner_reference_idpayment_gateway_errorbook_token_already_usedunauthorizedtoken_application_mismatchloyalty_number_failurepayment_declined
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": "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 book operation. This is a non-exhaustive list of enum values, which will be extended in the future.

  • token_application_mismatch - the book_token could not be shown to belong to the calling application. A funnel must be completed by the application that started it: shop, quote and book must all be called with the API key of that 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.
  • loyalty_number_failure - the booking was rejected by the provider over the guest's hotel loyalty membership. Covers three underlying causes — the provider required a loyalty number and none was supplied, the number was not recognised, or the number was malformed for that provider; the description says which. Expected to be rare: where the provider allows the booking to be retried without the membership it is, and the reservation is confirmed instead, so this error is only returned where it cannot be.
  • payment_declined - the payment for the booking was declined. No reservation was created and no charge was made. The book_token cannot be reused; call /quote again and book with corrected payment details or a different payment method.
Values invalid_inputinvalid_book_tokenrate_unavailableduplicate_partner_reference_idpayment_gateway_errorbook_token_already_usedunauthorizedtoken_application_mismatchloyalty_number_failurepayment_declined
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": "invalid_input",
  "description": "string",
  "response_id": "123e4567-e89b-12d3-a456-426614174000"
}
422Unprocessable. The payment for the booking was declined. No reservation was created and no charge was made. The response will contain the error code `payment_declined`.
error_code
string enum
required

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

  • token_application_mismatch - the book_token could not be shown to belong to the calling application. A funnel must be completed by the application that started it: shop, quote and book must all be called with the API key of that 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.
  • loyalty_number_failure - the booking was rejected by the provider over the guest's hotel loyalty membership. Covers three underlying causes — the provider required a loyalty number and none was supplied, the number was not recognised, or the number was malformed for that provider; the description says which. Expected to be rare: where the provider allows the booking to be retried without the membership it is, and the reservation is confirmed instead, so this error is only returned where it cannot be.
  • payment_declined - the payment for the booking was declined. No reservation was created and no charge was made. The book_token cannot be reused; call /quote again and book with corrected payment details or a different payment method.
Values invalid_inputinvalid_book_tokenrate_unavailableduplicate_partner_reference_idpayment_gateway_errorbook_token_already_usedunauthorizedtoken_application_mismatchloyalty_number_failurepayment_declined
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": "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/book" \
  -H "HTS-API-KEY: $HTS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "book_token": "string",
  "request_id": "123e4567-e89b-12d3-a456-426614174000",
  "partner_reference_id": "123e4567-e89b-12d3-a456-426614174000",
  "primary_guest": {
    "first_name": "Fred",
    "last_name": "Lalonde",
    "email": "fred@example.com",
    "phone": "+18339334671",
    "hotel_loyalty": [
      {
        "program_code": "string",
        "loyalty_number": "123456789"
      }
    ]
  },
  "payment_method": {
    "provider": "spreedly",
    "token": "LbDpERKx17Y8PGeR4EvnMVdB1bN"
  },
  "fraud_prevention": {
    "type": "riskified",
    "session_token": "00000000-0000-0000-0000-000000000000",
    "customer_ip_address": "203.0.113.42",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)"
  }
}'
Response 200
{
  "response_id": "123e4567-e89b-12d3-a456-426614174000",
  "order_id": "L2J982VT3J28",
  "booking_warnings": [
    {
      "type": "loyalty_not_applied",
      "loyalty_not_applied": {
        "reason": "id_not_found"
      }
    }
  ]
}

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