---
title: "Record a view"
method: POST
path: "/v1/recent-views"
tags: ["favorites"]
---

# Record a view

`POST /v1/recent-views`

## Request

- Base URL: `https://api.getmyhotels.com`
- URL: `https://api.getmyhotels.com/v1/recent-views`
- Auth: HTTP bearer

Runs `user.trackView`. Call when the customer opens a hotel. Send the hotel's `hotelKey` (`hk_…`, from search or detail) as `entityId`, plus its `ref` and the display fields `name`, `imageUrl` (https or site-relative), `city`, `country`, `starRating` (0-5) so the list can open and render the hotel on any device. A `ref` naming a different hotel than `entityId` is a 400. An `sh_` ref sent as `entityId` is accepted and filed under its hotel key. A repeat view of the same hotel moves it to the top and refreshes its snapshot instead of adding an entry. Returns `{ success: true }`. Best-effort on the client: a failure here must never block the screen.

## Request body

- object
  - `entityType` 'hotel' | 'flight' | 'car', required
  - `entityId` string, required
  - `ref` string, nullable
  - `name` string, nullable
  - `imageUrl` string, nullable
  - `city` string, nullable
  - `country` string, nullable
  - `starRating` number, nullable

## Response `200`

Success

- unknown

## Other responses

- `400`: Request validation failed or the router rejected the input
- `401`: Missing or invalid bearer session token
- `426`: Reported X-GMH-App-Version is below the supported minimum — the app must update
- `500`: Unexpected server error (opaque; details stay in logs)

---

[API](https://skmtc.dev/getmyhotels/apis/getmyhotels-rest-api.md) · [All operations](https://skmtc.dev/getmyhotels/apis/getmyhotels-rest-api/llms.txt) · [OpenAPI document](https://skmtc.dev/getmyhotels/apis/getmyhotels-rest-api/revisions/cba24a9c13f0?raw)
