Property Comparison: frontend guide
This page is for the CRS frontend. It covers comparing 2–4 listings, editing the price the guest sees, sharing a frozen view with the guest, and the guest page itself (CN-45). For every field and example, see the reference pages under CRS API → Comparison and CRS API → Public comparison.
The flow
Search card ──► POST /api/v1/search/pricing agent picks units, meals, VAS, cancellation plan
└─ response.encodedId carries all of those selections
│
Compare page ──► POST /api/v1/search/comparison one item per card (its encodedId), draft view
│ agent edits dates/price, hides rows
▼
POST /api/v1/search/comparison/share freezes it, returns { token, url }
│
┌───────────────┴────────────────┐
Agent: GET /api/v1/search/comparison/share/{token} read-only view + Duplicate
Guest: GET /api/v1/public/comparison/{token} no sign-in, view only
| Call | Auth | Purpose |
|---|---|---|
POST /api/v1/search/pricing | Agent JWT | Price a card with its selections; returns encodedId |
POST /api/v1/search/comparison | Agent JWT | The comparison table (draft) |
POST /api/v1/search/comparison/export | Agent JWT | Same body as compare; returns CSV |
PUT /api/v1/search/comparison/notes/{listingId} | Agent JWT | Save the agent's own note for a listing |
POST /api/v1/search/comparison/share | Agent JWT | Share: freeze and create the guest link |
GET /api/v1/search/comparison/share | Agent JWT | Links I have shared (newest first, limit, default 20) |
GET /api/v1/search/comparison/share/{token} | Agent JWT | Open a link I shared (read-only) |
DELETE /api/v1/search/comparison/share/{token} | Agent JWT | Revoke a link |
GET /api/v1/public/comparison/{token} | None | The guest page |
1. Selections come from the pricing API
The agent picks units, meals, VAS and a cancellation plan on the search card, and the card is priced with
POST /api/v1/search/pricing. The response's encodedId carries every selection: listing, units, unit
quantity, cancellationPlanId, meals (with dates), VAS, coupon and bank offer.
The comparison does not read the cart. Pass the card's encodedId and the comparison prices and shows
exactly what was selected.
2. Compare: POST /api/v1/search/comparison
{
"checkIn": "2026-12-20",
"checkOut": "2026-12-23",
"adults": 6,
"children": 2,
"channelId": "B2B",
"items": [
{ "encodedId": "<encodedId of card 1 from /search/pricing>" },
{ "encodedId": "<encodedId of card 2 from /search/pricing>" }
]
}
Request rules
-
2 to 4 items. Fewer or more returns 400.
-
One stay for all columns.
checkIn/checkOutbelong to the request; the token's own dates are ignored.checkOutmust be aftercheckIn. -
adults/children/infantscan be set on the request (all columns) or per item. The per-item value wins. -
Explicit fields override the token. Send
encodedIdand only the field the agent changed, for example a different plan:{ "encodedId": "<card 1>", "cancellationPlanId": "plan_flexi" }Item fields that override the token:
listingId,selectedProperties([{ propertyId, selectedQuantity }]),unitQuantity,cancellationPlanId,meals(same shape as the pricing/cartUpsertMeal:mealId,dates,unsureOfDates,adults,children,chefOnCall) andvas(UpsertVas:vasId,variantId,dates,unsureOfDates,quantity,dateQuantities). -
Without an
encodedId,listingIdis required, and only what you send explicitly is selected. Sending justlistingIdgives empty Meal, VAS and Cancellation rows. -
sectionslimits which rows are computed. Omit it for all rows (see Rows and chips).
Response (ComparisonResponse): checkIn, checkOut, nights, channelId and one entry in
columns per item, in request order. Each column:
| Field | Row / use |
|---|---|
listingId, title, shortName, propertyType, brand, coverPicture, badges, location | Column header |
encodedId | Book Now / add to cart. Re-minted with the comparison's dates and selections |
soldOut | true when the selection can't be booked for these dates (also when it can't be priced) |
units[] | Units row: label (e.g. "Raha farms • 1BHK"), shortName, bhk, bedrooms, units (count), thumbnail |
accommodation | Accommodation row: show adults/children (what was priced), bedrooms, bathrooms. guests is the listing's capacity, not for this row |
price | Price row: total (the card's total for the selection), perNight, totalBeforeDiscount, totalSaving, discountPercent |
editedPrice | Agent view only. The amount the agent set; absent when not edited (see Editable price) |
reviews | Reviews row: rating, count, elfsightIds for the reviews popup. No reviews → show "No reviews yet" |
meals[], vas[] | Meal / VAS rows: id, name, dates, unsureOfDates, meta (thumbnail). Empty → "NA" |
cancellation | Cancellation row: the chosen plan, planId, name, planType, summary (one-line policy) |
cancellationPlans[] | Every plan available for this selection (to switch plan): id, name, planType, cancellationSummary, totalAfterDiscount, … |
usps[] | USPs row, best first: name, description, details, isDifferentiator. Show 3, then "View all" |
amenityGroups[], amenitiesTotal | Amenities row grouped by unit (unitLabel, items) and the "View all N" count |
spaceGroups[], spacesTotal, keyHighlights, cautions, saleSummary | Spaces, highlights, caution and sale-summary rows (out of scope for CN-45, still returned) |
restrictions[] | Agent only: code, label, blocking (true = cannot book) |
agentNotes | Agent only: the agent's own note for this listing |
price.total is the same total the search card shows for the selection: the stay plus the selected
meals and VAS, after the cancellation plan's discount, with GST. totalBeforeDiscount and
totalSaving are on the same basis. A selection with no meals or VAS is priced as before. The
cancellationPlans[] figures stay on the stay alone, since that is what a plan changes.
3. Editable price
The agent can set the total the guest is quoted, per column, while the comparison is a draft. Send
it on the item as priceOverride (whole rupees):
{ "encodedId": "<card 1>", "priceOverride": 34000 }
- Any amount above 0 is accepted.
0or less returns 400 with "Enter an amount greater than ₹0". - It's display-only. It never reaches a cart, and Book Now still books at the CRS price.
- The agent view returns the CRS figure in
priceand the edited amount ineditedPrice. ShoweditedPriceas the main figure and "Original: ₹price.total/ N nights" beneath it. - To clear an edit, stop sending
priceOverride. If the agent changes dates or units before sharing, drop thepriceOverrideyou're holding so the new CRS price shows; the API doesn't know an edit is stale.
4. Share: POST /api/v1/search/comparison/share
Send the same body as the compare call (selections, priceOverrides and sections included). The API
re-prices it, freezes the guest view and returns:
{
"token": "cmp_7Fk2p",
"url": "https://…/cmp_7Fk2p",
"sharedAt": "2026-11-04T10:15:00Z",
"expiresAt": "2026-12-04T10:15:00Z"
}
urlis the link to send the guest. It's null when no base URL is configured; build the link fromtokenin that case.expiresAtis 30 days after sharing.nullmeans the link doesn't expire.- The share is locked. Nothing about it can change; the guest always sees this snapshot.
5. The agent's shared view: GET /api/v1/search/comparison/share/{token}
{ "token": "…", "url": "…", "sharedAt": "…", "expiresAt": "…",
"request": { …the body that was shared… },
"comparison": { …ComparisonResponse, agent view, with sharedAt set… } }
- Render
comparisonread-only with a "Shared onsharedAt" banner. It carries the CRS price inpriceand the edited one ineditedPrice, as in the draft. - Duplicate: send
requesttoPOST /api/v1/search/comparisonand open the result as a new draft. Sharing that draft creates a new link; the old link stays as it was. - 404 for a token this agent didn't create.
- "Links I have shared" is
GET /api/v1/search/comparison/share?limit=20. - Revoke (wrong guest):
DELETE /api/v1/search/comparison/share/{token}. Only its creator can revoke it, and the link stops working at once.
6. The guest page: GET /api/v1/public/comparison/{token}
No sign-in. It returns the same ComparisonResponse shape, narrowed for a guest:
- Price:
pricecarries onlytotal. That's the agent'spriceOverrideif one was set, otherwise the CRS total. There's noeditedPrice, per-night, before-discount or saving figure, so the guest can't work back to the CRS price. Show "₹total" with "Total for N nights, incl. taxes" beneath it. sharedAt: for "Prices as ofsharedAt, subject to availability", shown once near the top.shareMessage: the plain-text message the copy icon copies (dates and nights, occupancy, each property with its units and quoted price, the PDP and Brochures & media links, and the page link). Copy it as-is and show "Copied".- Per column:
pdpUrl(the arrow icon; the guest PDP has no pricing) andmediaUrl(Brochures & media). - Never present:
restrictions,agentNotes,editedPriceand the agent-only rows, whateversectionswas shared. - Errors: 404 for an unknown, revoked or expired link. The message distinguishes "expired" from "no longer available".
- The response is cached publicly for 60 seconds.
All timestamps (sharedAt, expiresAt) are UTC (…Z). Convert them to IST for display.
Rows and chips
sections controls which rows are computed. The agent's chips map one to one, in this order:
| Chip / row | sections value | Guest page |
|---|---|---|
| Accommodation | ACCOMMODATION | Yes |
| Units | UNITS | Yes |
| Price | PRICE | Yes |
| Reviews | REVIEWS | Yes |
| Meal | MEAL | Yes |
| VAS | VAS | Yes |
| USPs | USPS | Yes |
| Amenities | AMENITIES | Yes |
| Cancellation | CANCELLATION | Yes |
| (header) | LOCATION | Yes |
| Spaces, Key highlights, Caution, Sale summary | SPACES, KEY_HIGHLIGHTS, CAUTION, SALE_SUMMARY | Yes |
Restrictions (and the plan list cancellationPlans) | RESTRICTIONS | No |
| Agent notes | AGENT_NOTES | No |
- Hiding a row with its chip means leaving it out of
sectionson the share call. The guest page then doesn't show it either. - Omitting
sectionscomputes every row. A shared link with no guest-visible rows falls back to the full guest set. - Values are case-insensitive. Unknown values are ignored.
- Empty rows: if no column has data for a row, hide the row rather than printing "-".
Errors
All errors use the shared error envelope (message is user-readable).
| Status | When |
|---|---|
| 400 | Fewer than 2 or more than 4 listings; missing or invalid dates; priceOverride ≤ 0; an invalid encodedId; an item with neither listingId nor encodedId |
| 401 | Missing or invalid agent JWT (agent endpoints) |
| 404 | Shared view: not this agent's token. Guest page: unknown, revoked or expired token |