Segmentations Definition

Segmentations allow you to group the Items into various segments: For example segment articles or products by categories, segment movies by genres, etc. The Segmentations can be used in recommendations (e.g. return the most relevant categories for a user).

See this section for more info.

Property-based Segmentation groups the Items by the value of a particular property. See this section for more info.

put

Creates a Segmentation that splits the items into segments based on values of a particular item property.

A segment is created for each unique value of the property. In case of set properties, a segment is created for each value in the set. Item belongs to all these segments.

Copy
Initialization
client.send(new requests.CreatePropertyBasedSegmentation(segmentationId, sourceType, propertyName, {
  // optional parameters:
  title: 'Categories',                                    // string
  description: 'Segmentation based on item categories.',  // string
}));

4.1.0

String
Located in: path
Required: Yes
Since version: 4.1.0

ID of your database.


String
Located in: path
Required: Yes
Since version: 4.1.0

ID of the newly created Segmentation


String
Located in: body
Required: Yes
Since version: 4.1.0

What type of data should be segmented. Currently only items are supported.


String
Located in: body
Required: Yes
Since version: 4.1.0

Name of the property on which the Segmentation should be based


String
Located in: body
Required: No
Since version: 4.1.0

Human-readable name that is shown in the Recombee Admin UI.


String
Located in: body
Required: No
Since version: 4.1.0

Description that is shown in the Recombee Admin UI.


successful operation


segmentationId does not match ^[a-zA-Z0-9_-:@.]+$, property is not of supported type (string or set).


Property does not exist.


post

Updates a Property Based Segmentation

Copy
Initialization
client.send(new requests.UpdatePropertyBasedSegmentation(segmentationId, {
  // optional parameters:
  propertyName: 'categories',                             // string
  title: 'Categories',                                    // string
  description: 'Segmentation based on item categories.',  // string
}));

4.1.0

String
Located in: path
Required: Yes
Since version: 4.1.0

ID of your database.


String
Located in: path
Required: Yes
Since version: 4.1.0

ID of the updated Segmentation


String
Located in: body
Required: No
Since version: 4.1.0

Name of the property on which the Segmentation should be based


String
Located in: body
Required: No
Since version: 4.1.0

Human-readable name that is shown in the Recombee Admin UI.


String
Located in: body
Required: No
Since version: 4.1.0

Description that is shown in the Recombee Admin UI.


successful operation


segmentationId does not match ^[a-zA-Z0-9_-:@.]+$, property is not of supported type (string or set).


Property does not exist. Segmentation with given ID does not exist.


Segmentation whose Segments are defined by ReQL filters. See this section for more info.

put

Segment the items using multiple ReQL filters.

Use the Add Manual ReQL Items Segment endpoint to create the individual segments.

Copy
Initialization
client.send(new requests.CreateManualReqlSegmentation(segmentationId, sourceType, {
  // optional parameters:
  title: 'Homepage Rows',                                                       // string
  description: 'Segmentation grouping items into rows shown on the homepage.',  // string
}));

4.1.0

String
Located in: path
Required: Yes
Since version: 4.1.0

ID of your database.


String
Located in: path
Required: Yes
Since version: 4.1.0

ID of the newly created Segmentation


String
Located in: body
Required: Yes
Since version: 4.1.0

What type of data should be segmented. Currently only items are supported.


String
Located in: body
Required: No
Since version: 4.1.0

Human-readable name that is shown in the Recombee Admin UI.


String
Located in: body
Required: No
Since version: 4.1.0

Description that is shown in the Recombee Admin UI.


successful operation


segmentationId does not match ^[a-zA-Z0-9_-:@.]+$.


Each Segment is defined by a ReQL filter: Items passing the filter belong to the Segment.

Here we create two Segments in the homepage-rows Segmentation:

  • made-in-us contains items that were created in the US
  • short-laughs contains comedies with runtime under 30 minutes

See this section for more info.

Copy
reqs = [
  CreateManualReqlSegmentation("homepage-rows", "items"),
  AddManualReqlSegment("homepage-rows", "made-in-us", "'country' == \"US\" "),
  AddManualReqlSegment("homepage-rows", "short-laughs", "\"Comedy\" in 'genres' and 'runtime' < 30")
]

responses = client.send(Batch(reqs))
post

Update an existing Segmentation.

Copy
Initialization
client.send(new requests.UpdateManualReqlSegmentation(segmentationId, {
  // optional parameters:
  title: 'Homepage Rows',                                                       // string
  description: 'Segmentation grouping items into rows shown on the homepage.',  // string
}));

4.1.0

String
Located in: path
Required: Yes
Since version: 4.1.0

ID of your database.


String
Located in: path
Required: Yes
Since version: 4.1.0

ID of the updated Segmentation


String
Located in: body
Required: No
Since version: 4.1.0

Human-readable name that is shown in the Recombee Admin UI.


String
Located in: body
Required: No
Since version: 4.1.0

Description that is shown in the Recombee Admin UI.


successful operation


segmentationId does not match ^[a-zA-Z0-9_-:@.]+$. Given Segmentation is of different type.


Segmentation with given ID does not exist.


put

Adds a new Segment into a Manual ReQL Segmentation.

The new Segment is defined by a ReQL filter that returns true for an item in case that this item belongs to the segment.

Copy
Initialization
client.send(new requests.AddManualReqlSegment(segmentationId, segmentId, filter, {
  // optional parameters:
  title: 'Newly published',  // string
}));

4.1.0

String
Located in: path
Required: Yes
Since version: 4.1.0

ID of your database.


String
Located in: path
Required: Yes
Since version: 4.1.0

ID of the Segmentation to which the new Segment should be added


String
Located in: path
Required: Yes
Since version: 4.1.0

ID of the newly created Segment


String
Located in: body
Required: Yes
Since version: 4.1.0

ReQL filter that returns true for items that belong to this Segment. Otherwise returns false.


String
Located in: body
Required: No
Since version: 4.1.0

Human-readable name of the Segment that is shown in the Recombee Admin UI.


successful operation


segmentationId or segmentId does not match ^[a-zA-Z0-9_-:@.]+$. Segmentation is of wrong type.


Segmentation with given ID does not exist.


post

Update definition of the Segment.

Copy
Initialization
client.send(new requests.UpdateManualReqlSegment(segmentationId, segmentId, filter, {
  // optional parameters:
  title: 'Newly published',  // string
}));

4.1.0

String
Located in: path
Required: Yes
Since version: 4.1.0

ID of your database.


String
Located in: path
Required: Yes
Since version: 4.1.0

ID of the Segmentation to which the updated Segment belongs


String
Located in: path
Required: Yes
Since version: 4.1.0

ID of the Segment that will be updated


String
Located in: body
Required: Yes
Since version: 4.1.0

ReQL filter that returns true for items that belong to this Segment. Otherwise returns false.


String
Located in: body
Required: No
Since version: 4.1.0

Human-readable name of the Segment that is shown in the Recombee Admin UI.


successful operation


segmentationId or segmentId does not match ^[a-zA-Z0-9_-:@.]+$. Segmentation is of wrong type.


Segmentation with given ID does not exist. Segment with given ID does not exist in the Segmentation.


delete

Delete a Segment from a Manual ReQL Segmentation.

Copy
Initialization
client.send(new requests.DeleteManualReqlSegment(segmentationId, segmentId));

4.1.0

String
Located in: path
Required: Yes
Since version: 4.1.0

ID of your database.


String
Located in: path
Required: Yes
Since version: 4.1.0

ID of the Segmentation from which the Segment should be deleted


String
Located in: path
Required: Yes
Since version: 4.1.0

ID of the Segment that should be deleted


successful operation


segmentationId or segmentId does not match ^[a-zA-Z0-9_-:@.]+$. Segmentation is of wrong type.


Segmentation with given ID does not exist. Segment with given ID does not exist in the Segmentation.


Auto ReQL Segmentation is specified by a ReQL expression that for each Item returns a set of Segments to which the Item belongs. See this section for more info.

put

Segment the items using a ReQL expression.

For each item, the expression should return a set that contains IDs of segments to which the item belongs to.

Copy
Initialization
client.send(new requests.CreateAutoReqlSegmentation(segmentationId, sourceType, expression, {
  // optional parameters:
  title: 'Country and Genre',                                               // string
  description: 'Segmentation combining item genre and country of origin.',  // string
}));

4.1.0

String
Located in: path
Required: Yes
Since version: 4.1.0

ID of your database.


String
Located in: path
Required: Yes
Since version: 4.1.0

ID of the newly created Segmentation


String
Located in: body
Required: Yes
Since version: 4.1.0

What type of data should be segmented. Currently only items are supported.


String
Located in: body
Required: Yes
Since version: 4.1.0

ReQL expression that returns for each item a set with IDs of segments to which the item belongs


String
Located in: body
Required: No
Since version: 4.1.0

Human-readable name that is shown in the Recombee Admin UI.


String
Located in: body
Required: No
Since version: 4.1.0

Description that is shown in the Recombee Admin UI.


successful operation


segmentationId does not match ^[a-zA-Z0-9_-:@.]+$, ReQL expression is invalid.


Create a Segmentation, whose Segments combine the country of origin and the genre.

See this section for more info.

Copy
req = CreateAutoReqlSegmentation(
    "country-and-genre",
    "items",
    "map(lambda 'genre': 'genre' + \"-\" + 'country', 'genres')",
)

response = client.send(req)
post

Update an existing Segmentation.

Copy
Initialization
client.send(new requests.UpdateAutoReqlSegmentation(segmentationId, {
  // optional parameters:
  expression: 'map(lambda \'genre\': \'genre\' + "-" + \'country\', \'genres\')',  // string
  title: 'Country and Genre',                                                      // string
  description: 'Segmentation combining item genre and country of origin.',         // string
}));

4.1.0

String
Located in: path
Required: Yes
Since version: 4.1.0

ID of your database.


String
Located in: path
Required: Yes
Since version: 4.1.0

ID of the updated Segmentation


String
Located in: body
Required: No
Since version: 4.1.0

ReQL expression that returns for each item a set with IDs of segments to which the item belongs


String
Located in: body
Required: No
Since version: 4.1.0

Human-readable name that is shown in the Recombee Admin UI.


String
Located in: body
Required: No
Since version: 4.1.0

Description that is shown in the Recombee Admin UI.


successful operation


segmentationId does not match ^[a-zA-Z0-9_-:@.]+$. ReQL expression is invalid. Given Segmentation is of different type.


Segmentation with given ID does not exist.


get

Return all existing items Segmentations.

Copy
Initialization
const result = await client.send(new requests.ListSegmentations(sourceType));

4.1.0

60

String
Located in: path
Required: Yes
Since version: 4.1.0

ID of your database.


String
Located in: query
Required: Yes
Since version: 4.1.0

List Segmentations based on a particular type of data. Currently only items are supported.


{
  "segmentations": [
    {
      "segmentationId": "category",
      "sourceType": "items",
      "segmentationType": "property",
      "title": "Category Segmentation",
      "description": "Groups items by their category"
    },
    {
      "segmentationId": "homepage-rows",
      "sourceType": "items",
      "segmentationType": "manualReQL",
      "title": "Homepage Rows",
      "description": "Defines individual content rows that can be shown on the homepage"
    }
  ]
}

get

Get existing Segmentation.

Copy
Initialization
const result = await client.send(new requests.GetSegmentation(segmentationId));

4.1.0

String
Located in: path
Required: Yes
Since version: 4.1.0

ID of your database.


String
Located in: path
Required: Yes
Since version: 4.1.0

ID of the Segmentation that should be returned


{
  "segmentationId": "category",
  "sourceType": "items",
  "segmentationType": "property",
  "title": "Category Segmentation",
  "description": "Groups items by their category"
}

Segmentation with given ID does not exist.


delete

Delete existing Segmentation.

Copy
Initialization
client.send(new requests.DeleteSegmentation(segmentationId));

4.1.0

String
Located in: path
Required: Yes
Since version: 4.1.0

ID of your database.


String
Located in: path
Required: Yes
Since version: 4.1.0

ID of the Segmentation that should be deleted


successful operation


Segmentation with given ID does not exist.


© Copyright 2026, Recombee s.r.o
docs.recombee.com