Hotel Contracts
A hotel sells under one or more contract lines, one per market ("WW", "UK/AU/NZ"). A line holds the hotel's successive dated contracts for that market. These endpoints are v1, for DMC keys; for every schema see the API Reference.
Lines
- Every hotel with contracts has exactly one default line. It serves every tour operator (TO) the hotel is distributed to that is not linked to a live specific line.
- A specific line serves only the TOs linked to it. A line is live once one of its contracts has left draft (publishing, published or archived, deleted since or not); links on a line with only drafts wait for its first publication.
- No fallback: a TO linked to a live line is never served by the default line, even on dates its line does not cover, or once all its contracts are archived or deleted. Those nights are unavailable; removing the link sends the TO back to the default line. The line list flags such a line (
linkedTosGetNothing: linked TOs, no published contract from today on), and the DMC app warns on it. - A link does not distribute: a hotel not distributed to a TO stays invisible to it.
| What | Endpoint |
|---|---|
| List, create a line | GET, POST /api/v1/hotels/{id}/contract-lines |
| Rename a line | PATCH /api/v1/hotels/{id}/contract-lines/{lineId} |
| Make a line the default | PUT .../contract-lines/{lineId}/default |
| Delete a line | DELETE .../contract-lines/{lineId} |
TOs of a line (?candidates=true) | GET, PUT .../contract-lines/{lineId}/organizations |
- A line name may not be blank (
400 CONTRACT_LINE_NAME_REQUIRED). - Only a line with a published contract can become the default (
400 CONTRACT_LINE_NOT_PUBLISHED). - Candidates are the TOs with an accepted connection to the DMC.
- Deleting a line also removes its offer and cancellation links. It is refused when an offer (
409 CONTRACT_LINE_HAS_OFFERS) or a cancellation rule (409 CONTRACT_LINE_HAS_CANCEL_CONDITIONS) is linked to that line alone; the message names them.
POST /contracts takes an optional lineId; without it the contract joins the default line. Contract responses carry their line.
The applicable contract
For a hotel and a TO: if the TO is linked to live specific lines, the published contracts of those lines; otherwise those of the default line. They never overlap, so a night has at most one. A stay may span two successive contracts of one line; each night is priced by its own contract. Search, room details, booking and every channel (Koedia included) use the same rule, and a booking freezes its contract and cancellation policy.
The DMC's booking read (GET /v1/bookings/{id} and v2, which the Easia ERP reads after each push) lists the booking's contracts (id, line name, dates) and, on each of roomsBooked, the contracts its nights came from with firstNight and lastNight. A TO sees neither.
Uniqueness. Published contracts of one line never overlap, and neither do the published or publishing contracts of the lines linked to one TO. It is checked when a link is saved and when a contract is published (409 CONTRACT_LINE_OVERLAP, naming the TO, the other line and the dates). The default line takes no links.
Renewal, market copy, archive
- Renewal (
POST /contracts/{id}/duplicate): the next contract of the same line. Before publishing,GET /contracts/{id}/publication-checklists the previous contract and the bookings a shortened end would touch. Publish withoutshortenPrevious: trueis refused with409 CONTRACT_OVERLAPS_PREVIOUSwhen it would shorten the previous one. The previous contract is shortened in the same transaction as the publication, and only when the two overlap: a renewal after a gap leaves it as it is. Bookings on its cut nights keep its rates and policies. - Market copy (
POST /contracts/{id}/market-copy): a new non-default line with a draft copy of the contract, same dates and seasons. The DMC's and each TO's settings come along: future stop sales, allotments, free sales and on-request days, night rates, and the TOs' season distribution; the TOs' period settings (visibility, margin, allotment) follow when the copy is published. Offers and cancellation policies linked to the source line gain the new line. TO links and bookings do not come along. - Archive (
PUT /contracts/{id}/archive): a published contract becomesarchivedand stops selling; bookings keep it. - Delete (
DELETE /contracts/{id}, and lines): refused with409 CONTRACT_HAS_BOOKINGSonce a booking exists.
Offers and cancellation policies
Offers (promotions, supplements) and cancellation policies stay on the factsheet and each links to one or more lines, mandatory on write (PROMOTION_CONTRACT_LINES_REQUIRED, CANCEL_CONDITION_CONTRACT_LINES_REQUIRED). A TO sees only those linked to its applicable lines.
An operational hotel offer is refused (400 PROMOTION_PERIODS_NOT_COVERED, details.uncovered lists the missing days) unless the published contracts of its lines, end to end, cover every day of its periods from today on; a past period is left out, a draft is not checked. A cancellation policy's period counts in the hotel's days (its timezone), as the DMC enters it: it applies to a stay with a night between its first and last day, the check-in on its last day included. The coverage alert counts the same days, for each contract and each kind of policy its buyers apply (the DMC, and each TO the hotel is distributed to, as its connection chooses).
Client folders
A folder carries toOrganizationId, a TO connected to the folder's DMC. The TO's contracts do not apply to the DMC's search and booking: a DMC always prices and books on the default line, with its own offers and cancellation policy, whether the folder has a TO or not (KD-4071). The search only flags the hotels not distributed to the folder's TO (notDistributedToTo). The TO of a folder holding a booking, in any state, cannot change (409 FOLDER_TO_LOCKED).
Errors
| Status | Code | When |
|---|---|---|
| 400 | CONTRACT_LINE_NAME_TAKEN | The hotel has a line with that name. |
| 400 | CONTRACT_LINE_IS_DEFAULT | Deleting the default line, or linking TOs to it. |
| 400 | CONTRACT_LINE_HAS_LINKS | Making a line with TO links the default. |
| 400 | CONTRACT_LINE_ORGANIZATION_NOT_CONNECTED | A TO the hotel's DMC is not connected to. |
| 404 | CONTRACT_LINE_NOT_FOUND | A line that is not the hotel's. |
| 409 | CONTRACT_LINE_OVERLAP | Two published contracts would cover one night for a TO. |
| 409 | CONTRACT_HAS_BOOKINGS | Deleting a contract or line with bookings. |
| 409 | CONTRACT_NOT_PUBLISHED | Archiving a contract that is not published. |
| 409 | CONTRACT_OVERLAPS_PREVIOUS | Publishing a renewal that shortens its predecessor, unconfirmed. |