Skip to main content
Hotels run public promotions, including time-limited flash sales, and distribute private codes through email, social, or partner channels. The Booking Engine API exposes both: read the active promotion to display it, and seed a code into the session to unlock the rates it grants.
The examples reuse the OAuth 1.0 signing from the Quick start. Replace {sessionId} with your session.

Show the active promotion

GET /v2/{sessionId}/promotion returns the latest active public promotion for the session’s hotel, or 204 No Content when none is running. Use it to render a promotional banner, with a countdown when the promotion is a flash sale.
A running promotion comes back with its discount and, for a flash sale, a deadline:
Show the countdown only when displayCountdown is true, and hide the banner on a 204.

Build a promo-code landing page

A promo code converts best when its landing page opens straight onto the offer it unlocks. Seed the code into context.promoCode when you create the session (see the Quick start), then search as usual: the results are scoped to the rates the code grants. Confirm the code resolved by reading the session scope:
type tells you what the code is (RateCode, OfferCode, or DiscountCode), and rateIds lists the rates it unlocked. When the code does not apply, session creation can return 400 with Code: InvalidPromoCode (unknown code), InvalidPromoCodeBookingPeriod (booked outside the campaign window), or InvalidPromoCodeStayPeriod (stay dates outside the offer). Catch these codes and show a fallback explaining why the code is not valid for this stay, rather than a raw error.

Tips

  • Pass the code through the URL. A campaign link like https://book.example.com/offer?code=AUTUMN2026 opens the page on the offer in one flow, with no form.
  • Treat a 204 as “no promotion”, not an error. Hide the banner when no promotion is active.
  • Log every code, even unresolved ones. Marketing needs both how many guests arrived with a code and how many got a valid offer: the gap surfaces a misconfigured offer fast.

Get a promotion

Full schema for the promotion endpoint.

Create a session

Seed context.promoCode when you open the session.