HTS APIs
Every endpoint, schema and error code, rendered from the published OpenAPI files, in the order you integrate them.
/contractsOtherCreate Draft Contract
Create a draft contract for a customer's chosen offer.
HTS uses an external payment gateway to tokenize payment cards as well as process payments and payouts.
When HTS is the Merchant of Record (MOR) for the purchase of the order or remitting any product payout to a customer's credit card, HTS requires a tokenized credit card to be present in the payments array in the request below.
Expand this section for instructions about testing and Spreedly integration.
The returned payment method token MxyYEhDK12CUAA18bJDkAq0ab3y (from the sample response below) should be passed in the payment_card type with a token identifier as a part of the payments array in the request below.
When using the staging environment, make sure to use one of Adyen's test credit card numbers.
Tokenization URL: https://core.spreedly.com/v1/payment_methods.json
- Documentation: Spreedly API docs
Example Tokenization Request:
curl --request POST --url https://core.spreedly.com/v1/payment_methods.json --header 'content-type: application/json' -u "login:password" --data '{
"payment_method": {
"email": "aaa@bbb.com",
"credit_card": {
"number": "4000020000000000",
"month": "03",
"year": "2030",
"first_name": "John",
"last_name": "Smith",
"address1": "123 12th St",
"address2": "Building B",
"city": "Boston",
"state": "MA",
"zip": "02121",
"country": "US",
"verification_value": "737"
}
}
}'
Example Tokenization Response:
{
"transaction": {
"token": "KtToV20m9qT1Yi8pbTeLNz0Ypns",
"created_at": "2023-11-29T13:31:56Z",
"updated_at": "2023-11-29T13:31:56Z",
"succeeded": true,
"transaction_type": "AddPaymentMethod",
"retained": false,
"state": "succeeded",
"message_key": "messages.transaction_succeeded",
"message": "Succeeded!",
"payment_method": {
"token": "MxyYEhDK12CUAA18bJDkAq0ab3y",
"created_at": "2023-11-29T13:31:56Z",
"updated_at": "2023-11-29T13:31:56Z",
"email": "aaa@bbb.com",
"data": null,
"storage_state": "cached",
"test": true,
"metadata": null,
"callback_url": null,
"last_four_digits": "0000",
"first_six_digits": "400002",
"card_type": "visa",
"first_name": "John",
"last_name": "Smith",
"month": 3,
"year": 2030,
"address1": "123 12th St",
"address2": "Building B",
"city": "Boston",
"state": "MA",
"zip": "02121",
"country": "US",
"phone_number": null,
"company": null,
"full_name": "John Smith",
"eligible_for_card_updater": true,
"shipping_address1": null,
"shipping_address2": null,
"shipping_city": null,
"shipping_state": null,
"shipping_zip": null,
"shipping_country": null,
"shipping_phone_number": null,
"issuer_identification_number": "40000200",
"click_to_pay": false,
"managed": true,
"payment_method_type": "credit_card",
"errors": [],
"bin_metadata": {
"message": "BIN Metadata is available only to Advanced Vault enrolled customers and payment methods. Reach out to your account representative for more details."
},
"fingerprint": "7ccffcf38900f224fc946cf2a9c8e260072b",
"verification_value": "XXX",
"number": "XXXX-XXXX-XXXX-0000"
}
}
}
Parameters
Idempotency-KeyUnique key that makes resource creation idempotent. Send the same value when retrying a request to avoid creating duplicate resources. Send a new key to create a new resource.
Request body application/json · required
offer_idPriced offer to be purchased by the user.
currencyCurrency of all pricing fields within the request.
localeThe user's locale, as an IETF BCP 47 language tag in {language}-{region} form, where region is an ISO 3166-1 alpha-2 country code or a UN M.49 macro-region code (e.g. en-US, es-419). Determines the language of user-facing content.
payment_informationPayment information for the contract. Either a detailed breakdown of payment methods (Provided) or a signal that no payment details are available (NotProvided). Payments should equate to the total amount for which a partner is the MoR, e.g. if the partner is collecting the ancillary price, the total of the payments should be inclusive of the price. Must include a tokenized payment card if HTS is merchant of record. If both payments and payment_information are provided, payment_information takes precedence.
Show fields
Payment information for the contract. Either a detailed breakdown of payment methods (Provided) or a signal that no payment details are available (NotProvided). Payments should equate to the total amount for which a partner is the MoR, e.g. if the partner is collecting the ancillary price, the total of the payments should be inclusive of the price. Must include a tokenized payment card if HTS is merchant of record. If both payments and payment_information are provided, payment_information takes precedence.
type:not_provided (not_provided) not_provided
typevalue: not_provided
amountTotal amount of the transaction.
provided (provided) provided
typevalue: provided
payment_methodsList of payment methods used to pay for the booking.
Show fields
type:alternate_payment_method (alternate_payment_method) alternate_payment_method
typeA payment that cannot be tokenized. eg: ApplePay.
amountloyalty_program (loyalty_program) loyalty_program
typevalue: loyalty_program
amountnameThe name of the of the loyalty program, e.g. points, miles, cash_rewards, etc. Required, to ensure that the amounts are refunded to the same loyalty program used during purchase.
unitsThe unit to currency exchange rate is implicit from the amount in the Payment object and this number of points.
non_refundable_discounts (non_refundable_discounts) non_refundable_discounts
typeA discount to the booking that won't be refunded if the booking is canceled or CFAR is exercised. eg: $5 off first time booking.
amountnameThe name of the non-refundable discount, e.g. first time booker incentive, etc. Set if useful for refund during exercise, e.g. for display, book keeping, etc.
payment_card (payment_card) payment_card
merchant_of_recordParty responsible for processing the payment for the purchased offers.
partnerhtscontact_infoContact information of the user buying the product(s).
Show fields
email_addressShow fields
type:hashed (hashed) hashed
typevalue: hashed
valueA stable hash of the user's email address. Must be stable across different API calls and different bookings. Used for transaction correlation for fraud analysis.
literal (literal) literal
typevalue: literal
valueThe actual email address for the user.
^[^@\s]+@[^@\s]+\.[^@\s]+$not_provided (not_provided1) not_provided1
typevalue: not_provided
phone_number^\+[1-9][0-9]{1,14}$additional_recipientsShow fields
email_addressEmail address of the additional recipient to notify.
Show fields
valueThe actual email address for the user.
^[^@\s]+@[^@\s]+\.[^@\s]+$phone_numberSMS notifications are not currently supported; a request that includes a phone number is rejected.
^\+[1-9][0-9]{1,14}$notification_preferencesConsent for the PRIMARY BOOKER (the email_address / phone_number on this contact_info) to receive disruption notifications via SMS/push. Applies to the primary booker only: additional_recipients never receive SMS or push (they are email-only, notification-only). Captured per offer at purchase; does not persist across offers. Recording consent does not trigger delivery.
Show fields
smsSMS consent for the primary booker's phone_number. Omit = not specified, true = opt-in, false = declined. Requires phone_number to be present; the request is rejected if sms=true and phone_number is absent.
pushPush consent for the primary booker. Omit = not specified, true = opt-in, false = declined.
paymentsDEPRECATED: Use payment_information instead. List of payment methods used to pay for the booking (includes flights and ancillaries). Payments should equate to the total amount for which a partner is the MoR, e.g. if the partner is collecting the ancillary price, the total of the payments should be inclusive of the price. Must include a tokenized payment card if HTS is merchant of record.
Show fields
type:alternate_payment_method (alternate_payment_method) alternate_payment_method
typeA payment that cannot be tokenized. eg: ApplePay.
amountmethodThe method of payment.
Show fields
The method of payment.
type:apple_pay (apple_pay) apple_pay
typevalue: apple_pay
other (other) other
typevalue: other
nameName of the alternate payment method for unsupported types, e.g. Bank Transfer.
paypal (paypal) paypal
typevalue: paypal
venmo (venmo) venmo
typevalue: venmo
loyalty_program (loyalty_program) loyalty_program
typevalue: loyalty_program
amountnameThe name of the of the loyalty program, e.g. points, miles, cash_rewards, etc. Required, to ensure that the amounts are refunded to the same loyalty program used during purchase.
unitsThe unit to currency exchange rate is implicit from the amount in the Payment object and this number of points.
non_refundable_discounts (non_refundable_discounts) non_refundable_discounts
typeA discount to the booking that won't be refunded if the booking is canceled or CFAR is exercised. eg: $5 off first time booking.
amountnameThe name of the non-refundable discount, e.g. first time booker incentive, etc. Set if useful for refund during exercise, e.g. for display, book keeping, etc.
payment_card (payment_card) payment_card
typeA credit or debit card. Must be tokenized (refer to above documentation).
amountidentifierShow fields
type:details (details) details
typevalue: details
last_four_digitsLast four digits of the payment card.
[0-9]{4}expiration_monthTwo digits expiration month of the payment card.
[0-9]{2}expiration_yearFour digits expiration year of the payment card.
[0-9]{4}token (token) token
typevalue: token
valueThe token representing a credit card or a debit card. Used to process refunds to the original form of payment.
billing_infoBilling information of the user buying the product(s). Required if HTS is merchant of record.
Show fields
first_nameFirst name of the customer.
last_nameLast name of the customer.
street_addressStreet address of the customer billing address.
cityCity of the customer billing address.
state_provinceState or province of the customer billing address.
postal_codePostal code of the customer billing address.
countryCountry of the customer billing address.
[A-Z]{2}user_idPartner's unique ID of the user making the purchase. This is used for fraud prevention.
Responses
201The created contract
idUnique identifier for a contract.
statusCurrent status of the contract.
canceledconfirmeddraftedexercise_eligibleexpiredexercisedvoidedpriceThe price breakdown of the product.
Show fields
total_amountTotal amount to be paid for the product, including taxes.
base_amountAmount to be paid for the product, excluding taxes.
taxesShow fields
codeCode representing this tax.
amountTotal amount of the tax.
eligible_disruptionsThe disruption events which allow a customer to exercise their product.
Show fields
flight_cancellationThe product becomes exercise eligible in the event of a flight cancellation.
flight_delayThe product becomes exercise eligible in the event of a flight delay.
Show fields
delay_minutes_thresholdThe number of minutes a flight must be delayed to qualify for disruption exercise eligibility.
missed_connectionThe product becomes exercise eligible in the event of a missed connection.
Show fields
minimum_connection_minutes_thresholdThe minimum number of minutes between connections for which the product will consider a connection missed in the event of a disruption.
rebooking_allowance_per_passengerTotal monetary allowance per passenger for rebooking a flight in case a disruption occurs.
window_minutes_before_departureThe number of minutes before departure of each slice from which a purchased contract would be eligible for exercise in the event of a disruption.
currencyCurrency of all pricing fields within the contract.
expires_atDate and time at which the contract will expire, once purchased, as a UTC RFC3339 formatted datetime.
booking_referencesRecord locators if PSS, Order ID if OMS, etc. Used to retrieve the flight booking later. It's a dictionary of key/value pairs. The keys can be anything, but they are referenced in the configuration when retrieving the booking, so those must align.
exercisesDetails of how this contract was exercised (payout and/or rebook). Always present as a list. Populated when exercised, empty otherwise.
Show fields
type:payout (payout1) payout1
typevalue: payout
idUnique identifier for this exercise.
contract_idThe contract that was exercised.
payoutsThe payouts issued to the customer.
Show fields
type:original_form_of_payment (original_form_of_payment) original_form_of_payment
typevalue: original_form_of_payment
payoutThe payment details for this payout.
Show fields
rebook (rebook) rebook
typevalue: rebook
idUnique identifier for this exercise.
contract_idThe contract that was exercised.
rebooked_segmentsThe new flight segments the customer was rebooked on.
Show fields
origin_airportIATA airport code of origin.
[A-Z]{3}destination_airportIATA airport code of destination.
[A-Z]{3}departure_date_timeLocal date and time of departure, in ISO 8601 format.
arrival_date_timeLocal date and time of arrival, in ISO 8601 format.
cabinCabin of the segment.
economypremium_economybusinessfirstmarketing_carrier_codeIATA airline code of the marketing carrier for this segment.
[A-Z0-9]{2}marketing_flight_numberFlight number for the marketing carrier.
[0-9]{1,4}reservation_booking_designatorReservation Booking Designator (RBD) for this segment: the booking code the airline sold the seat under, one uppercase letter and an optional second letter or digit. Also known as booking class, booking code, class of service, or fare class (e.g. Y, B, M, Q, N, J, F, E1). Pass the code exactly as it appears on the ticket/PNR.
^[A-Z][A-Z0-9]?$operating_carrier_codeIATA airline code of the operating carrier for this segment. Assumed to be the same asmarketing_carrier_code if not set.
[A-Z0-9]{2}operating_flight_numberFlight number for the operating carrier. Assumed to be the same asmarketing_flight_number if not set.
[0-9]{1,4}itineraryThe new itinerary details.
Show fields
currencyslicesList of slices of the itinerary; 1 (one way), 2 (round trip), or up to 10 (multi-destination) slices are allowed
Show fields
segmentsA list of segments which make up the slice.
Show fields
fare_brandName of the brand for the fare of the slice.
alternative_faresA list of alternative fares which were also available to the user in the same cabin.
Show fields
fare_rulesThe fare rules for the slice detailing cancel and change policies with associated penalties and refund methods. Fare rules which are not sent are assumed to be unknown.
Show fields
void_policyThe void policy for the slice, describing whether and how long a booking can be voided after purchase. If not specified, the void policy is unknown.
Show fields
passengersList of passengers on the itinerary.
Show fields
typeType of passenger:
* adult - 12+ years of age
* child - 2-11 years of age
* seated_infant - < 2 years of age, in their own seat
* lap_infant - < 2 years of age, not in their own seat
adultchildseated_infantlap_infantfare_amountTotal price of the fare for this passenger
booking_referencesuser_idUser ID in the partner system.
payoutIf the product is eligible for payout, the payout to be issued upon exercise.
Show fields
amountThe total amount to be paid out upon exercise.
percentageThe percentage of the booking to be paid out upon exercise.
itineraryThe trip as purchased, with each slice's exercise eligibility and each segment's rebook eligibility and disruption. It doesn't change after a rebook; the rebooked flights are in that rebook's exercise. Populated on Get Contract and the contract webhooks; absent on Create Contract.
Show fields
slicesThe slices of the trip as purchased, in purchase order.
Show fields
segmentsThe ordered list of segments that make up this slice.
Show fields
idBase64-encoded string of "=; treat the id as an opaque string.
origin_airportIATA airport code of origin.
[A-Z]{3}destination_airportIATA airport code of destination.
[A-Z]{3}departure_date_timeLocal date and time of departure, in ISO 8601 format.
arrival_date_timeLocal date and time of arrival, in ISO 8601 format.
cabinCabin of the segment.
economypremium_economybusinessfirstmarketing_carrier_codeIATA airline code of the marketing carrier for this segment.
[A-Z0-9]{2}marketing_flight_numberFlight number for the marketing carrier.
[0-9]{1,4}rebook_eligibilityWhether a rebook can start from this segment, with the search criteria when it can.
Show fields
Whether a rebook can start from this segment, with the search criteria when it can.
type:eligible (eligible) eligible
ineligible (ineligible) ineligible
reservation_booking_designatorReservation Booking Designator (RBD) for this segment: the booking code the airline sold the seat under, one uppercase letter and an optional second letter or digit. Also known as booking class, booking code, class of service, or fare class (e.g. Y, B, M, Q, N, J, F, E1). Pass the code exactly as it appears on the ticket/PNR.
^[A-Z][A-Z0-9]?$operating_carrier_codeIATA airline code of the operating carrier for this segment. Assumed to be the same as marketing_carrier_code if not set.
[A-Z0-9]{2}operating_flight_numberFlight number for the operating carrier. Assumed to be the same as marketing_flight_number if not set.
[0-9]{1,4}disruptionThe disruption on this segment. Absent when the segment has not been disrupted.
Show fields
The disruption on this segment. Absent when the segment has not been disrupted.
type:canceled (canceled) canceled
delayed (delayed) delayed
missed_connection (missed_connection1) missed_connection1
fare_brandName of the brand for the fare of the slice.
exercise_eligibilityWhether this slice can be exercised, and how.
Show fields
Whether this slice can be exercised, and how.
type:eligible (eligible1) eligible1
typevalue: eligible
exercise_optionsThe ways the slice can be exercised.
ineligible (ineligible1) ineligible1
typevalue: ineligible
400Syntactic errors were encountered while handling the request
messagecodeExample
[
{
"message": "string",
"code": "string"
}
]401The client could not be authenticated
403The authenticated client does not have permission to call this endpoint
422Semantic errors were encountered while handling the request
code:idempotency_key_reused (idempotency_key_reused) idempotency_key_reused
messageA human-readable message describing the error
codeinvalid_email (invalid_email) invalid_email
messageA human-readable message describing the error
codeoffer_not_found (offer_not_found2) offer_not_found2
messageA human-readable message describing the error
codeorder_already_exists (order_already_exists) order_already_exists
messageA human-readable message describing the error
codepayment_authorization_failure (payment_authorization_failure) payment_authorization_failure
messageA human-readable message describing the error
codeunsupported_trip_type (unsupported_trip_type) unsupported_trip_type
messageA human-readable message describing the error
codeExample
[
{
"message": "string",
"code": "string"
}
]499The client cancelled the request
500The server encountered an internal error
curl -X POST "https://fintech.staging.htsapis.com/flights-dafar/v2/contracts" \
-H "X-Api-Key: $HTS_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"offer_id": "string",
"currency": "CAD",
"locale": "en-US",
"payment_information": {
"type": "provided",
"amount": "200.00"
},
"merchant_of_record": "partner",
"contact_info": {
"email_address": {
"type": "string",
"value": "a8cfcd74832004951b4408cdb0a5dbcd8c7e5243f7fe-244bf72058205241da"
},
"phone_number": "string",
"additional_recipients": [
{
"email_address": {
"value": "john@email.com"
},
"phone_number": "string"
}
],
"notification_preferences": {
"sms": true,
"push": true
}
},
"billing_info": {
"first_name": "string",
"last_name": "string",
"street_address": "string",
"city": "string",
"state_province": "string",
"postal_code": "string",
"country": "US"
},
"user_id": "33bb4eb2-2937-4bd3-97b1-7796206712f0"
}'{
"id": "string",
"user_id": "33bb4eb2-2937-4bd3-97b1-7796206712f0",
"status": "Confirmed",
"price": {
"total_amount": "40.80",
"base_amount": "30.20",
"taxes": [
{
"code": "VAT",
"amount": "20.00"
}
]
},
"eligible_disruptions": {
"flight_cancellation": {},
"flight_delay": {
"delay_minutes_threshold": 120
},
"missed_connection": {
"minimum_connection_minutes_threshold": 120
}
},
"payout": {
"amount": "400.00",
"percentage": 100
},
"rebooking_allowance_per_passenger": "1000.00",
"window_minutes_before_departure": 1440,
"currency": "CAD",
"expires_at": "2020-12-20T12:15:48Z",
"booking_references": {},
"itinerary": {
"slices": [
{
"segments": [
{
"id": "MDow",
"origin_airport": "YUL",
"destination_airport": "SFO",
"departure_date_time": "2026-11-15T08:00",
"arrival_date_time": "2026-11-15T11:15",
"cabin": "Economy",
"reservation_booking_designator": "Y",
"marketing_carrier_code": "AC",
"marketing_flight_number": "759",
"operating_carrier_code": "AC",
"operating_flight_number": "759",
"rebook_eligibility": {
"type": "eligible"
},
"disruption": {
"type": "canceled"
}
}
],
"fare_brand": "Standard",
"exercise_eligibility": {
"type": "string",
"exercise_options": [
"payout"
]
}
}
]
},
"exercises": [
{
"type": "string",
"id": "string",
"contract_id": "string",
"payouts": [
{
"type": "string"
}
]
}
]
}Examples are generated from the schema where the spec publishes none; field values are illustrative.
