This endpoint populates the authenticated user’s recommendation profile with their attraction type preferences and a set of free-text interest labels. It accepts two pieces of data: a 9-element binary array (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/viet2811/uk-travel-recommendation/llms.txt
Use this file to discover all available pages before exploring further.
preferences) that encodes which broad attraction categories the user is interested in, and a list of human-readable label strings (labels) that describe their interests in natural language. Internally, the labels are encoded into a dense 384-dimensional vector using the all-MiniLM-L12-v2 sentence-transformer model and stored as labelEmbed and summaryEmbed on the user’s UserProfile. The preferences array is stored directly as labelMHE. Until this endpoint is called, all three vectors remain at zero (as set during registration), and the recommendation engine will return generic results. Bearer token authentication is required.
Endpoint
| Method | POST |
| Path | /api/user/preferences/ |
| Auth required | Yes — Authorization: Bearer <access_token> |
| Content-Type | application/json |
Request Body
A fixed-length array of exactly 9 integers. Each element must be either
0 (not interested) or 1 (interested), corresponding to one of the 9 UK attraction category groups. The array is stored directly as the labelMHE field on the user’s profile and is used as a multi-hot encoding of category interest.An array of human-readable strings describing the user’s interests. Each string is encoded individually by the
all-MiniLM-L12-v2 sentence-transformer, and the resulting embeddings are averaged into a single 384-dimensional vector. That vector is stored as both labelEmbed and summaryEmbed on the user’s UserProfile and is used for semantic similarity matching during recommendation retrieval. If the array is empty, labelEmbed and summaryEmbed are left unchanged and only labelMHE is updated. More descriptive, specific labels yield more precise semantic embeddings.Example values: "historic castle", "coastal walk", "national park", "contemporary art museum".Responses
200 OK
Returned when both fields pass validation and theUserProfile is updated successfully. The response body is empty.
200 OK
400 Bad Request
Three distinct validation errors can be returned:A message describing the validation failure. One of the three values below.
401 Unauthorized
Returned when theAuthorization header is absent, the access token is missing, or the token has expired. Obtain a fresh token via Refresh Token or Login.
401 Unauthorized
How the embedding works
When a valid request is received, the backend performs the following steps:- Validates
preferences(list, length 9) andlabels(list). - Passes
labelsto the pre-loadedall-MiniLM-L12-v2sentence-transformer model. - Encodes each label individually, then averages the embeddings (
np.mean(embeddings, axis=0)) into a single 384-dimensional vector. - Persists the update to the authenticated user’s
UserProfile:
| Field | Value stored |
|---|---|
labelMHE | The 9-element preferences array as provided |
labelEmbed | The 384-dim sentence-transformer embedding of labels |
summaryEmbed | The same 384-dim embedding (used in a separate similarity pass) |