---
title: "Recommend Item Segments to User"
method: POST
path: "/{databaseId}/recomms/users/{userId}/item-segments/"
tags: ["Recommendations"]
---

# Recommend Item Segments to User

`POST /{databaseId}/recomms/users/{userId}/item-segments/`

Recommends the top Segments from a [Segmentation](https://docs.recombee.com/segmentations) for a particular user, based on the user's past interactions.

Based on the used Segmentation, this endpoint can be used for example for:

  - Recommending the top categories for the user
  - Recommending the top genres for the user
  - Recommending the top brands for the user
  - Recommending the top artists for the user

You need to set the used Segmentation the Admin UI in the [Scenario settings](https://docs.recombee.com/scenarios) prior to using this endpoint.

The returned segments are sorted by relevance (first segment being the most relevant).

It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.

## Path parameters

- `databaseId` string, required
- `userId` string, required

## Request body

- RecommendItemSegmentsToUserParameters
  - `count` integer, required — Number of item segments to be recommended (N for the top-N recommendation).
  - `scenario` string — Scenario defines a particular application of recommendations. It can be, for example, "homepage", "cart", or "emailing". You can set various settings to the [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com). You can also see the performance of each scenario in the Admin UI separately, so you can check how well each application performs. The AI that optimizes models to get the best results may optimize different scenarios separately or even use different models in each of the scenarios.
  - `cascadeCreate` boolean — If the user does not exist in the database, returns a list of non-personalized recommendations and creates the user in the database. This allows, for example, rotations in the following recommendations for that user, as the user will be already known to the system.
  - `filter` string — Boolean-returning [ReQL](https://docs.recombee.com/reql) expression which allows you to filter recommended segments based on the `segmentationId`.
  - `booster` string — Number-returning [ReQL](https://docs.recombee.com/reql) expression which allows you to boost recommendation rate of some segments based on the `segmentationId`.
  - `logic` union
    - string
    - object
      - `name` string — Name of the logic that should be used
      - `settings` object — Parameters passed to the logic
  - `expertSettings` object — Dictionary of custom options.
  - `returnAbGroup` boolean — If there is a custom AB-testing running, return the name of the group to which the request belongs.
  - `reqlExpressions` object — A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended Item Segment. This can be used to compute additional properties of the recommended Item Segments. The keys are the names of the expressions, and the values are the actual ReQL expressions. Example request: ```json { "reqlExpressions": { "countItems": "size(segment_items(\"categories\", 'segmentId'))" } } ``` Example response: ```json { "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8", "recomms": [ { "id": "category-fantasy-books", "reqlEvaluations": { "countItems": 486 } }, { "id": "category-sci-fi-costumes", "reqlEvaluations": { "countItems": 19 } } ], "numberNextRecommsCalls": 0 } ```

## Response `200`

successful operation

- RecommendationResponse
  - `recommId` string, required — Id of the recommendation request
  - `recomms` Recommendation[], required — Obtained recommendations
    - `id` string, required — Id of the recommended item
    - `values` object — Property values of the recommended item
    - `reqlEvaluations` object — Dictionary of evaluated ReQL expressions specified in the request and calculated for the recommended item. The keys are the names of the ReQL expressions, and the values are the results of the evaluations.
  - `numberNextRecommsCalls` integer — How many times *Recommend Next Items* have been called for this `recommId`
  - `abGroup` string — Name of AB-testing group to which the request belongs if there is a custom AB-testing running.

## Other responses

- `400` — Used Segmentation not configured for the scenario. userId does not match ^[a-zA-Z0-9_\-:@\.]+$, count is not a positive integer.
- `404` — userId not found in the database and cascadeCreate is false

---

[API](https://skmtc.dev/recombee/apis/recombee-api.md) · [All operations](https://skmtc.dev/recombee/apis/recombee-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/recombee/recombee-api/revisions/a9c9c33eb2e8/schema)
