Skip to main content

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
CallAuthPurpose
POST /api/v1/search/pricingAgent JWTPrice a card with its selections; returns encodedId
POST /api/v1/search/comparisonAgent JWTThe comparison table (draft)
POST /api/v1/search/comparison/exportAgent JWTSame body as compare; returns CSV
PUT /api/v1/search/comparison/notes/{listingId}Agent JWTSave the agent's own note for a listing
POST /api/v1/search/comparison/shareAgent JWTShare: freeze and create the guest link
GET /api/v1/search/comparison/shareAgent JWTLinks I have shared (newest first, limit, default 20)
GET /api/v1/search/comparison/share/{token}Agent JWTOpen a link I shared (read-only)
DELETE /api/v1/search/comparison/share/{token}Agent JWTRevoke a link
GET /api/v1/public/comparison/{token}NoneThe 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/checkOut belong to the request; the token's own dates are ignored. checkOut must be after checkIn.

  • adults/children/infants can be set on the request (all columns) or per item. The per-item value wins.

  • Explicit fields override the token. Send encodedId and 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/cart UpsertMeal: mealId, dates, unsureOfDates, adults, children, chefOnCall) and vas (UpsertVas: vasId, variantId, dates, unsureOfDates, quantity, dateQuantities).

  • Without an encodedId, listingId is required, and only what you send explicitly is selected. Sending just listingId gives empty Meal, VAS and Cancellation rows.

  • sections limits 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:

FieldRow / use
listingId, title, shortName, propertyType, brand, coverPicture, badges, locationColumn header
encodedIdBook Now / add to cart. Re-minted with the comparison's dates and selections
soldOuttrue 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
accommodationAccommodation row: show adults/children (what was priced), bedrooms, bathrooms. guests is the listing's capacity, not for this row
pricePrice row: total (the card's total for the selection), perNight, totalBeforeDiscount, totalSaving, discountPercent
editedPriceAgent view only. The amount the agent set; absent when not edited (see Editable price)
reviewsReviews 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"
cancellationCancellation 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[], amenitiesTotalAmenities row grouped by unit (unitLabel, items) and the "View all N" count
spaceGroups[], spacesTotal, keyHighlights, cautions, saleSummarySpaces, highlights, caution and sale-summary rows (out of scope for CN-45, still returned)
restrictions[]Agent only: code, label, blocking (true = cannot book)
agentNotesAgent 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. 0 or 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 price and the edited amount in editedPrice. Show editedPrice as 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 the priceOverride you'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"
}
  • url is the link to send the guest. It's null when no base URL is configured; build the link from token in that case.
  • expiresAt is 30 days after sharing. null means 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 comparison read-only with a "Shared on sharedAt" banner. It carries the CRS price in price and the edited one in editedPrice, as in the draft.
  • Duplicate: send request to POST /api/v1/search/comparison and 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: price carries only total. That's the agent's priceOverride if one was set, otherwise the CRS total. There's no editedPrice, 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 of sharedAt, 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) and mediaUrl (Brochures & media).
  • Never present: restrictions, agentNotes, editedPrice and the agent-only rows, whatever sections was 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 / rowsections valueGuest page
AccommodationACCOMMODATIONYes
UnitsUNITSYes
PricePRICEYes
ReviewsREVIEWSYes
MealMEALYes
VASVASYes
USPsUSPSYes
AmenitiesAMENITIESYes
CancellationCANCELLATIONYes
(header)LOCATIONYes
Spaces, Key highlights, Caution, Sale summarySPACES, KEY_HIGHLIGHTS, CAUTION, SALE_SUMMARYYes
Restrictions (and the plan list cancellationPlans)RESTRICTIONSNo
Agent notesAGENT_NOTESNo
  • Hiding a row with its chip means leaving it out of sections on the share call. The guest page then doesn't show it either.
  • Omitting sections computes 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).

StatusWhen
400Fewer than 2 or more than 4 listings; missing or invalid dates; priceOverride ≤ 0; an invalid encodedId; an item with neither listingId nor encodedId
401Missing or invalid agent JWT (agent endpoints)
404Shared view: not this agent's token. Guest page: unknown, revoked or expired token