# API Reference

> Source: https://docs.recombee.com/api

> For the complete documentation index, see [llms.txt](/llms.txt).

# API Reference

This section lists all the available API endpoints, that allow you to manage item catalog, users, their interactions and get recommendations.

* Version: `6.3.0`
* Base URL: Based on the [region](/regions) of your database
* API consumes: `application/json`
* API produces: `application/json`
* Authentication: [HMAC](/authentication) (already implemented in the SDKs)
* OpenAPI definition: [YAML](/openapi.yaml) | [JSON](/openapi.json)

## Items

The following methods allow you to maintain the set of items in the catalog. The items are specified using their ids, which are unique string identifiers matching _^\[a-zA-Z0-9\_-:@.\]+$_, i.e., they may consist of digits, Latin letters, underscores, colons, minus signs, at signs, and dots. Item ID `undefined` is forbidden.

put

#### Add Item

Adds new item of the given `itemId` to the items catalog.

All the item properties for the newly created items are set to null.

```js
client.send(new requests.AddItem(itemId));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

itemId

String

Located in: **path**

Required: **Yes**

ID of the item to be created.

---

##### Responses

201

Successful operation.

---

400

The `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

409

The `itemId` is already present in the item catalog. In many cases, you may consider this code a success – it only tells you that nothing has been written to the database.

---

delete

#### Delete Item

Deletes an item of the given `itemId` from the catalog.

If there are any _purchases_, _ratings_, _bookmarks_, _cart additions_, or _detail views_ of the item present in the database, they will be deleted in cascade as well. Also, if the item is present in some _series_, it will be removed from all the _series_ where present.

If an item becomes obsolete/no longer available, it is meaningful to keep it in the catalog (along with all the interaction data, which are very useful), and **only exclude the item from recommendations**. In such a case, use [ReQL filter](https://docs.recombee.com/reql) instead of deleting the item completely.

```js
client.send(new requests.DeleteItem(itemId));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

itemId

String

Located in: **path**

Required: **Yes**

ID of the item to be deleted.

---

##### Responses

200

Successful operation.

---

400

The `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

404

The `itemId` is not present in the item catalog. In many cases, you may consider this code a success – it only tells you that nothing has been deleted from the database since the item was already not present. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### List Items

Gets a list of IDs of items currently present in the catalog.

```js
const result = await client.send(new requests.ListItems({
  // optional parameters:
  filter: 'price > 50',                                   // string
  count: 10,                                              // integer
  offset: 0,                                              // integer
  returnProperties: true,                                 // boolean
  includedProperties: ['title', 'price', 'publishedAt'],  // array
}));
```

---

Calls Limit Per Minute

100

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

filter

String

Located in: **query**

Required: **No**

Boolean-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to filter items to be listed. Only the items for which the expression is _true_ will be returned.

---

count

Integer

Located in: **query**

Required: **No**

The number of items to be listed.

---

offset

Integer

Located in: **query**

Required: **No**

Specifies the number of items to skip (ordered by `itemId`).

---

returnProperties

Boolean

Located in: **query**

Required: **No**

Since version: **1.4.0**

With `returnProperties=true`, property values of the listed items are returned along with their IDs in a JSON dictionary.

Example response:

```
  [
    {
      "itemId": "tv-178",
      "description": "4K TV with 3D feature",
      "categories":   ["Electronics", "Televisions"],
      "price": 342,
      "url": "myshop.com/tv-178"
    },
    {
      "itemId": "mixer-42",
      "description": "Stainless Steel Mixer",
      "categories":   ["Home & Kitchen"],
      "price": 39,
      "url": "myshop.com/mixer-42"
    }
  ]
```

---

includedProperties

Array

Located in: **query**

Required: **No**

Since version: **1.4.0**

Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.

Example response for `includedProperties=description,price`:

```
  [
    {
      "itemId": "tv-178",
      "description": "4K TV with 3D feature",
      "price": 342
    },
    {
      "itemId": "mixer-42",
      "description": "Stainless Steel Mixer",
      "price": 39
    }
  ]
```

---

##### Responses

200

Successful operation.

```
[
  "item-1",
  "item-2",
  "item-3"
]
```

---

404

If present, `filter` contains a non-existing item property.

---

delete

#### Delete More Items

Deletes all the items that pass the filter.

If an item becomes obsolete/no longer available, it is meaningful to **keep it in the catalog** (along with all the interaction data, which are very useful) and **only exclude the item from recommendations**. In such a case, use [ReQL filter](https://docs.recombee.com/reql) instead of deleting the item completely.

```js
const result = await client.send(new requests.DeleteMoreItems(filter));
```

---

Since version

3.3.0

---

Calls Limit Per Minute

1000

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **3.3.0**

ID of your database.

---

filter

String

Located in: **body**

Required: **Yes**

Since version: **3.3.0**

A [ReQL](https://docs.recombee.com/reql) expression, which returns `true` for the items that shall be updated.

---

##### Responses

200

Successful operation.

```
{
  "itemIds": [
    "item-42",
    "item-125",
    "item-11"
  ],
  "count": 3
}
```

---

400

Invalid filter.

---

## Item Properties

### Item properties definition

Item properties are used for modeling your domain. The following methods allow the definition of item properties. The properties may be thought of as columns in a relational database table.

put

#### Add Item Property

Adding an item property is somewhat equivalent to adding a column to the table of items. The items may be characterized by various properties of different types.

```js
client.send(new requests.AddItemProperty(propertyName, type, {
  // optional parameters:
  role: 'title',  // string / Object
  metadata: [],   // array
}));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

propertyName

String

Located in: **path**

Required: **Yes**

Name of the item property to be created. Currently, the following names are reserved: `id`, `itemid`, case-insensitively. Also, the length of the property name must not exceed 63 characters.

---

type

String

Located in: **body**

Required: **Yes**

Value type of the item property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`, `image` or `imageList`.

* `int` \- Signed integer number.
* `double` \- Floating point number. It uses 64-bit base-2 format (IEEE 754 standard).
* `string` \- UTF-8 string.
* `boolean` \- _true_ / _false_
* `timestamp` \- Value representing date and time. ISO8601-1 pattern (string) or UTC epoch time (number).
* `set` \- Set of strings.
* `image` \- URL of an image (`jpeg`, `png` or `gif`).
* `imageList` \- List of URLs that refer to images.

---

role

String

Object

Located in: **body**

Required: **No**

Since version: **6.3.0**

[Role](https://docs.recombee.com/api/property_roles_metadata#roles) to assign to the property.

---

metadata

Array

Located in: **body**

Required: **No**

Since version: **6.3.0**

List of [metadata](https://docs.recombee.com/api/property_roles_metadata#metadata) entries to assign to the property.

---

##### Responses

201

Successful operation.

---

400

Property name does not match ^\[a-zA-Z0-9\_-:\]+$, or it is a reserved keyword (''id'', ''itemid''), or its length exceeds 63 characters. Type information is missing, or the given type is invalid.

---

409

Property of the given name is already present in the database. In many cases, you may consider this code a success – it only tells you that nothing has been written to the database.

---

delete

#### Delete Item Property

Deleting an item property is roughly equivalent to removing a column from the table of items.

```js
client.send(new requests.DeleteItemProperty(propertyName));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

propertyName

String

Located in: **path**

Required: **Yes**

Name of the property to be deleted.

---

##### Responses

200

Successful operation.

---

400

Property name does not match ^\[a-zA-Z0-9\_-:\]+$.

---

404

Property of the given name is not present in the database. In many cases, you may consider this code a success – it only tells you that nothing has been deleted from the database since the item property was already not present. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### Get Item Property Info

Gets information about specified item property.

```js
const result = await client.send(new requests.GetItemPropertyInfo(propertyName));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

propertyName

String

Located in: **path**

Required: **Yes**

Name of the property about which the information is to be retrieved.

---

##### Responses

200

Successful operation.

```
{
  "name": "num-processors",
  "type": "int"
}
```

---

400

Property name does not match ^\[a-zA-Z0-9\_-:\]+$.

---

404

Property of the given name is not present in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### List Item Properties

Gets the list of all the item properties in your database.

```js
const result = await client.send(new requests.ListItemProperties());
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

##### Responses

200

Successful operation.

```
[
  {
    "name": "tags",
    "type": "set"
  },
  {
    "name": "release-date",
    "type": "timestamp"
  },
  {
    "name": "description",
    "type": "string"
  }
]
```

---

404

Invalid URL.

---

### Values of item properties

The following methods allow assigning property values to items in the catalog. Set values are examined by content-based algorithms and used for recommendations, especially in the case of cold-start items that have no interactions yet. Properties are also used in [ReQL](https://docs.recombee.com/reql) for filtering and boosting according to your business rules.

post

#### Set Item Values

Sets/updates (some) property values of the given item. The properties (columns) must be previously created by [Add item property](https://docs.recombee.com/api#add-item-property).

```js
client.send(new requests.SetItemValues(itemId, values, {
  // optional parameters:
  cascadeCreate: true,  // boolean
}));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

itemId

String

Located in: **path**

Required: **Yes**

ID of the item which will be modified.

---

Object

Located in: **body**

Required: **Yes**

The values for the individual properties.

Example of the body:

```
  {
    "product_description": "4K TV with 3D feature",
    "categories":   ["Electronics", "Televisions"],
    "price_usd": 342,
    "in_stock_from": "2016-11-16T08:00Z",
    "image": "http://myexamplesite.com/products/4ktelevision3d/image.jpg",
    "other_images": ["http://myexamplesite.com/products/4ktelevision3d/image2.jpg",
                     "http://myexamplesite.com/products/4ktelevision3d/image3.jpg"]
  }
```

Set item values can also **cascade create** the item if it's not already present in the database.

For this functionality:

* _When using the client libraries_: Set the optional _cascadeCreate_ parameter to true, just like when creating an interaction.
* _When using directly REST API_: Set special "property" `!cascadeCreate`.  
Example:  
```  
  {  
    "product_description": "4K TV with 3D feature",  
    "!cascadeCreate": true  
  }  
```  
Note the exclamation mark (!) at the beginning of the parameter's name to distinguish it from item property names.

---

##### Responses

200

Successful operation.

---

400

Property name does not match ''^\[a-zA-Z0-9\_-:\]+$'', value does not match the property type.

---

404

Property of the given name is not present in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### Get Item Values

Gets all the current property values of the given item.

```js
const result = await client.send(new requests.GetItemValues(itemId));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

itemId

String

Located in: **path**

Required: **Yes**

ID of the item whose properties are to be obtained.

---

##### Responses

200

Successful operation.

```
{
  "release-date": null,
  "tags": [
    "electronics",
    "laptops"
  ],
  "num-processors": 12,
  "description": "Very powerful laptop",
  "weight": 1.6
}
```

---

400

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

---

404

Item of the given _itemId_ is not present in the catalog. If there is no additional info in the JSON response, you probably have an error in your URL.

---

post

#### Update More Items

Updates (some) property values of all the items that pass the filter.

Example: _Setting all the items that are older than a week as unavailable_

```
  {
    "filter": "'releaseDate' < now() - 7*24*3600",
    "changes": {"available": false}
  }
```

```js
const result = await client.send(new requests.UpdateMoreItems(filter, changes));
```

---

Since version

3.3.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **3.3.0**

ID of your database.

---

filter

String

Located in: **body**

Required: **Yes**

Since version: **3.3.0**

A [ReQL](https://docs.recombee.com/reql) expression, which returns `true` for the items that shall be updated.

---

changes

Object

Located in: **body**

Required: **Yes**

Since version: **3.3.0**

A dictionary where the keys are properties that shall be updated.

---

##### Responses

200

Successful operation. Returns IDs of updated items and their count.

```
{
  "itemIds": [
    "item-42",
    "item-125",
    "item-11"
  ],
  "count": 3
}
```

---

400

Invalid filter, property name does not match ''^\[a-zA-Z0-9\_-:\]+$'', value does not match the property type.

---

404

Property of the given name is not present in the database.

---

## Users

The following methods allow you to manage users in your database. User ID `undefined` is forbidden.

put

#### Add User

Adds a new user to the database.

```js
client.send(new requests.AddUser(userId));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

userId

String

Located in: **path**

Required: **Yes**

ID of the user to be added.

---

##### Responses

201

Successful operation.

---

400

The `userId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

409

User of the given userId is already present in the database. In many cases, you may consider this code a success – it only tells you that nothing has been written to the database.

---

delete

#### Delete User

Deletes a user of the given _userId_ from the database.

If there are any purchases, ratings, bookmarks, cart additions or detail views made by the user present in the database, they will be deleted in cascade as well.

```js
client.send(new requests.DeleteUser(userId));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

userId

String

Located in: **path**

Required: **Yes**

ID of the user to be deleted.

---

##### Responses

200

Successful operation.

---

400

The _userId_ does not match ''^\[a-zA-Z0-9\_-:@.\]+$''.

---

404

User of the given `userId` is not present in the database. In many cases, you may consider this code a success – it only tells you that nothing has been deleted from the database since the user was already not present. If there is no additional info in the JSON response, you probably have an error in your URL.

---

put

#### Merge Users

Allowed on Client-Side

Merges interactions (purchases, ratings, bookmarks, detail views ...) of two different users under a single user ID. This is especially useful for online e-commerce applications working with anonymous users identified by unique tokens such as the session ID. In such applications, it may often happen that a user owns a persistent account, yet accesses the system anonymously while, e.g., putting items into a shopping cart. At some point in time, such as when the user wishes to confirm the purchase, (s)he logs into the system using his/her username and password. The interactions made under anonymous session ID then become connected with the persistent account, and merging these two becomes desirable.

Merging happens between two users referred to as the _target_ and the _source_. After the merge, all the interactions of the source user are attributed to the target user, and the source user is **deleted**.

By default, the _Merge Users_ request is only available from server-side integrations for security reasons, to prevent potential abuse. If you need to call this request from a client-side environment (such as a web or mobile app), please contact our support and request access to enable this feature for your database.

```js
client.send(new recombee.MergeUsers(targetUserId, sourceUserId, {
  // optional parameters:
  cascadeCreate: true,  // boolean
}));
```

---

Calls Limit Per Minute

100

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

targetUserId

String

Located in: **path**

Required: **Yes**

ID of the target user.

---

sourceUserId

String

Located in: **path**

Required: **Yes**

ID of the source user.

---

cascadeCreate

Boolean

Located in: **query**

Required: **No**

Sets whether the user _targetUserId_ should be created if not present in the database.

---

##### Responses

201

Successful operation.

---

400

The _sourceUserId_ or _targetUserId_ does not match ^\[a-zA-Z0-9\_-:@.\]+$

---

404

The _sourceUserId_ or _targetUserId_ does not exist in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### List Users

Gets a list of IDs of users currently present in the catalog.

```js
const result = await client.send(new requests.ListUsers({
  // optional parameters:
  filter: '\'country\' == "US"',                // string
  count: 10,                                    // integer
  offset: 0,                                    // integer
  returnProperties: true,                       // boolean
  includedProperties: ['username', 'country'],  // array
}));
```

---

Calls Limit Per Minute

100

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

filter

String

Located in: **query**

Required: **No**

Boolean-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to filter users to be listed. Only the users for which the expression is _true_ will be returned.

---

count

Integer

Located in: **query**

Required: **No**

The number of users to be listed.

---

offset

Integer

Located in: **query**

Required: **No**

Specifies the number of users to skip (ordered by `userId`).

---

returnProperties

Boolean

Located in: **query**

Required: **No**

Since version: **1.4.0**

With `returnProperties=true`, property values of the listed users are returned along with their IDs in a JSON dictionary.

Example response:

```
  [
    {
      "userId": "user-81",
      "country": "US",
      "sex": "M"
    },
    {
      "userId": "user-314",
      "country": "CAN",
      "sex": "F"
    }
  ]
```

---

includedProperties

Array

Located in: **query**

Required: **No**

Since version: **1.4.0**

Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.

Example response for `includedProperties=country`:

```
  [
    {
      "userId": "user-81",
      "country": "US"
    },
    {
      "userId": "user-314",
      "country": "CAN"
    }
  ]
```

---

##### Responses

200

Successful operation.

```
[
  "user-1",
  "user-2",
  "user-3"
]
```

---

404

Invalid URL.

---

## User Properties

### User properties definition

User properties are used for modeling users. The following methods allow the definition of user properties. The properties may be thought of as columns in a relational database table.

put

#### Add User Property

Adding a user property is somewhat equivalent to adding a column to the table of users. The users may be characterized by various properties of different types.

```js
client.send(new requests.AddUserProperty(propertyName, type, {
  // optional parameters:
  role: 'title',  // string / Object
  metadata: [],   // array
}));
```

---

Since version

1.3.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **1.3.0**

ID of your database.

---

propertyName

String

Located in: **path**

Required: **Yes**

Since version: **1.3.0**

Name of the user property to be created. Currently, the following names are reserved: `id`, `userid`, case-insensitively. Also, the length of the property name must not exceed 63 characters.

---

type

String

Located in: **body**

Required: **Yes**

Value type of the user property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`.

* `int` \- Signed integer number.
* `double` \- Floating point number. It uses 64-bit base-2 format (IEEE 754 standard).
* `string` \- UTF-8 string.
* `boolean` \- _true_ / _false_
* `timestamp` \- Value representing date and time. ISO8601-1 pattern (string) or UTC epoch time (number).
* `set` \- Set of strings.

---

role

String

Object

Located in: **body**

Required: **No**

[Role](https://docs.recombee.com/api/property_roles_metadata#roles) to assign to the property.

---

metadata

Array

Located in: **body**

Required: **No**

List of [metadata](https://docs.recombee.com/api/property_roles_metadata#metadata) entries to assign to the property.

---

##### Responses

201

Successful operation.

---

400

Property name does not match ^\[a-zA-Z0-9\_-:\]+$, or it is a reserved keyword (''id'', ''userid''), or its length exceeds 63 characters. Type information is missing, or the given type is invalid.

---

409

Property of the given name is already present in the database. In many cases, you may consider this code a success – it only tells you that nothing has been written to the database.

---

delete

#### Delete User Property

Deleting a user property is roughly equivalent to removing a column from the table of users.

```js
client.send(new requests.DeleteUserProperty(propertyName));
```

---

Since version

1.3.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **1.3.0**

ID of your database.

---

propertyName

String

Located in: **path**

Required: **Yes**

Since version: **1.3.0**

Name of the property to be deleted.

---

##### Responses

200

Successful operation.

---

400

Property name does not match ^\[a-zA-Z0-9\_-:\]+$.

---

404

Property of the given name is not present in the database. In many cases, you may consider this code a success – it only tells you that nothing has been deleted from the database since the user property was already not present. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### Get User Property Info

Gets information about specified user property.

```js
const result = await client.send(new requests.GetUserPropertyInfo(propertyName));
```

---

Since version

1.3.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **1.3.0**

ID of your database.

---

propertyName

String

Located in: **path**

Required: **Yes**

Since version: **1.3.0**

Name of the property about which the information is to be retrieved.

---

##### Responses

200

Successful operation.

```
{
  "name": "country",
  "type": "string"
}
```

---

400

Property name does not match ^\[a-zA-Z0-9\_-:\]+$.

---

404

Property of the given name is not present in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### List User Properties

Gets the list of all the user properties in your database.

```js
const result = await client.send(new requests.ListUserProperties());
```

---

Since version

1.3.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **1.3.0**

ID of your database.

---

##### Responses

200

Successful operation.

```
[
  {
    "name": "country",
    "type": "string"
  },
  {
    "name": "sex",
    "type": "string"
  }
]
```

---

404

Invalid URL.

---

### Values of user properties

The following methods allow assigning property values to the user. Set values are examined by content-based algorithms and used in building recommendations, especially for users that have only a few interactions (e.g., new users). Useful properties may be, for example, gender or region. The values can be used in filtering using the [context\_user ReQL function](https://docs.recombee.com/reql_functions#context-user-function).

post

#### Set User Values

Sets/updates (some) property values of the given user. The properties (columns) must be previously created by [Add user property](https://docs.recombee.com/api#add-user-property).

```js
client.send(new requests.SetUserValues(userId, values, {
  // optional parameters:
  cascadeCreate: true,  // boolean
}));
```

---

Since version

1.3.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **1.3.0**

ID of your database.

---

userId

String

Located in: **path**

Required: **Yes**

Since version: **1.3.0**

ID of the user which will be modified.

---

Object

Located in: **body**

Required: **Yes**

Since version: **1.3.0**

The values for the individual properties.

Example of the body:

```
  {
    "country": "US",
    "sex": "F"
  }
```

Set user values can also **cascade create** the user if it's not already present in the database.

For this functionality:

* _When using the client libraries_: Set the optional _cascadeCreate_ parameter to true, just like when creating an interaction.
* _When using directly REST API_: Set special "property" `!cascadeCreate`.  
Example:  
```  
  {  
    "country": "US",  
    "!cascadeCreate": true  
  }  
```  
Note the exclamation mark (!) at the beginning of the parameter's name to distinguish it from item property names.

---

##### Responses

200

Successful operation.

---

400

Property name does not match ''^\[a-zA-Z0-9\_-:\]+$'', value does not agree to property type.

---

404

Property of the given name is not present in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### Get User Values

Gets all the current property values of the given user.

```js
const result = await client.send(new requests.GetUserValues(userId));
```

---

Since version

1.3.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **1.3.0**

ID of your database.

---

userId

String

Located in: **path**

Required: **Yes**

Since version: **1.3.0**

ID of the user whose properties are to be obtained.

---

##### Responses

200

Successful operation.

```
{
  "country": "US",
  "sex": "F"
}
```

---

400

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

---

404

User of the given _userId_ is not present in the catalog. If there is no additional info in the JSON response, you probably have an error in your URL.

---

## User-Item Interactions

The following methods allow adding, deleting, and listing interactions between the users and the items.

### Detail Views

post

#### Add Detail View

Allowed on Client-Side

Adds a detail view of the given item made by the given user.

```js
client.send(new recombee.AddDetailView(userId, itemId, {
  // optional parameters:
  timestamp: '2022-05-13T18:25:43Z',                 // string / number
  duration: 35,                                      // integer
  cascadeCreate: true,                               // boolean
  recommId: 'ce52ada4-e4d9-4885-943c-407db2dee837',  // string
  additionalData: {},                                // Object
  autoPresented: false,                              // boolean
}));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

userId

String

Located in: **body**

Required: **Yes**

User who viewed the item

---

itemId

String

Located in: **body**

Required: **Yes**

Viewed item

---

timestamp

String

Number

Located in: **body**

Required: **No**

UTC timestamp of the view as ISO8601-1 pattern or UTC epoch time. The default value is the current time.

---

duration

Integer

Located in: **body**

Required: **No**

Duration of the view

---

cascadeCreate

Boolean

Located in: **body**

Required: **No**

Sets whether the given user/item should be created if not present in the database.

---

recommId

String

Located in: **body**

Required: **No**

Since version: **2.2.0**

If this detail view is based on a recommendation request, `recommId` is the id of the clicked recommendation.

---

additionalData

Object

Located in: **body**

Required: **No**

Since version: **2.3.0**

Additional data associated with the interaction. The expected structure is defined for specific use cases and will be provided by the Recombee Support team when applicable.

---

autoPresented

Boolean

Located in: **body**

Required: **No**

Since version: **6.0.0**

Indicates whether the item was automatically presented to the user (e.g., in a swiping feed) or explicitly requested by the user (e.g., by clicking on a link). Defaults to `false`.

---

##### Responses

200

Successful operation.

---

400

Given `userId` or `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$. `timestamp` or `duration` is not a real number ≥ 0.

---

404

The `cascadeCreate` is not set true and the `userId` or the `itemId` were found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

409

A detail view of the exact same `userId`, `itemId`, and `timestamp` is already present in the database. Note that a user may view an item's details multiple times, yet triplets (`userId`, `itemId`, `timestamp`) must be unique. In many cases, you may consider this code a success – it only tells you that nothing has been written to the database.

---

delete

#### Delete Detail View

Deletes an existing detail view uniquely specified by (`userId`, `itemId`, and `timestamp`) or all the detail views with the given `userId` and `itemId` if `timestamp` is omitted.

```js
client.send(new requests.DeleteDetailView(userId, itemId, {
  // optional parameters:
  timestamp: 1652466343,  // number
}));
```

---

Calls Limit Per Minute

1000

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

userId

String

Located in: **query**

Required: **Yes**

ID of the user who made the detail view.

---

itemId

String

Located in: **query**

Required: **Yes**

ID of the item whose details were viewed.

---

timestamp

Number

Located in: **query**

Required: **No**

Unix timestamp of the detail view. If the `timestamp` is omitted, then all the detail views with the given `userId` and `itemId` are deleted.

---

##### Responses

200

Successful operation.

---

400

Given `userId` or `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$, or `timestamp` is not a real number ≥ 0.

---

404

The `userId`, `itemId`, or detail view with the given (`userId`, `itemId`, `timestamp`) not found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### List Item Detail Views

Lists all the detail views of the given item ever made by different users.

```js
const result = await client.send(new requests.ListItemDetailViews(itemId));
```

---

Calls Limit Per Minute

60

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

itemId

String

Located in: **path**

Required: **Yes**

ID of the item whose detail views are to be listed.

---

##### Responses

200

Successful operation.

```
[
  {
    "itemId": "item-x",
    "userId": "user-a",
    "duration": 14.23,
    "autoPresented": true,
    "timestamp": 1348151906.0
  },
  {
    "itemId": "item-x",
    "userId": "user-b",
    "duration": null,
    "autoPresented": false,
    "timestamp": 1348239363.0
  }
]
```

---

400

The `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

404

Given `itemId` not found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### List User Detail Views

Lists all the detail views of different items ever made by the given user.

```js
const result = await client.send(new requests.ListUserDetailViews(userId));
```

---

Calls Limit Per Minute

60

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

userId

String

Located in: **path**

Required: **Yes**

ID of the user whose detail views are to be listed.

---

##### Responses

200

Successful operation.

```
[
  {
    "itemId": "item-y",
    "userId": "user-a",
    "duration": 134.03,
    "autoPresented": true,
    "timestamp": 1348139180.0
  },
  {
    "itemId": "item-x",
    "userId": "user-a",
    "duration": 14.23,
    "autoPresented": false,
    "timestamp": 1348151906.0
  }
]
```

---

400

The `userId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

404

Given `userId` not found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

### Purchases

post

#### Add Purchase

Allowed on Client-Side

Adds a purchase of the given item made by the given user.

```js
client.send(new recombee.AddPurchase(userId, itemId, {
  // optional parameters:
  timestamp: '2022-05-13T18:25:43Z',                 // string / number
  cascadeCreate: true,                               // boolean
  amount: 1,                                         // number
  price: 25.0,                                       // number
  profit: 5.0,                                       // number
  recommId: 'ce52ada4-e4d9-4885-943c-407db2dee837',  // string
  additionalData: {},                                // Object
}));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

userId

String

Located in: **body**

Required: **Yes**

User who purchased the item

---

itemId

String

Located in: **body**

Required: **Yes**

Purchased item

---

timestamp

String

Number

Located in: **body**

Required: **No**

UTC timestamp of the purchase as ISO8601-1 pattern or UTC epoch time. The default value is the current time.

---

cascadeCreate

Boolean

Located in: **body**

Required: **No**

Sets whether the given user/item should be created if not present in the database.

---

amount

Number

Located in: **body**

Required: **No**

Since version: **1.6.0**

Amount (number) of purchased items. The default is 1\. For example, if `user-x` purchases two `item-y` during a single order (session...), the `amount` should equal 2.

---

price

Number

Located in: **body**

Required: **No**

Since version: **1.6.0**

Price paid by the user for the item. If `amount` is greater than 1, the sum of prices of all the items should be given.

---

profit

Number

Located in: **body**

Required: **No**

Since version: **1.6.0**

Your profit from the purchased item. The profit is natural in the e-commerce domain (for example, if `user-x` purchases `item-y` for $100 and the gross margin is 30 %, then the profit is $30) but is also applicable in other domains (for example, at a news company it may be income from a displayed advertisement on article page). If `amount` is greater than 1, the sum of profit of all the items should be given.

---

recommId

String

Located in: **body**

Required: **No**

Since version: **2.2.0**

If this purchase is based on a recommendation request, `recommId` is the id of the clicked recommendation.

---

additionalData

Object

Located in: **body**

Required: **No**

Since version: **2.3.0**

Additional data associated with the interaction. The expected structure is defined for specific use cases and will be provided by the Recombee Support team when applicable.

---

##### Responses

200

Successful operation.

---

400

The `userId` or `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$. `timestamp` is not a real number ≥ 0.

---

404

The `cascadeCreate` is not set true and the `userId` or the `itemId` were found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

409

A purchase of the exact same `userId`, `itemId`, and `timestamp` is already present in the database. In many cases, you may consider this code a success – it only tells you that nothing has been written to the database.

---

delete

#### Delete Purchase

Deletes an existing purchase uniquely specified by `userId`, `itemId`, and `timestamp` or all the purchases with the given `userId` and `itemId` if `timestamp` is omitted.

```js
client.send(new requests.DeletePurchase(userId, itemId, {
  // optional parameters:
  timestamp: 1652466343,  // number
}));
```

---

Calls Limit Per Minute

1000

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

userId

String

Located in: **query**

Required: **Yes**

ID of the user who made the purchase.

---

itemId

String

Located in: **query**

Required: **Yes**

ID of the item which was purchased.

---

timestamp

Number

Located in: **query**

Required: **No**

Unix timestamp of the purchase. If the `timestamp` is omitted, then all the purchases with the given `userId` and `itemId` are deleted.

---

##### Responses

200

Successful operation.

---

400

Given `userId` or `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$, or `timestamp` is not a real number ≥ 0.

---

404

The `userId`, `itemId`, or purchase with the given (`userId`, `itemId`, `timestamp`) not found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### List Item Purchases

Lists all the ever-made purchases of the given item.

```js
const result = await client.send(new requests.ListItemPurchases(itemId));
```

---

Calls Limit Per Minute

60

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

itemId

String

Located in: **path**

Required: **Yes**

ID of the item whose purchases are to be listed.

---

##### Responses

200

Successful operation.

```
[
  {
    "itemId": "item-x",
    "userId": "user-a",
    "timestamp": 1348151906.0
  },
  {
    "itemId": "item-x",
    "userId": "user-b",
    "timestamp": 1348327154.0
  }
]
```

---

400

The `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

404

Given `itemId` not found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### List User Purchases

Lists all the purchases ever made by the given user.

```js
const result = await client.send(new requests.ListUserPurchases(userId));
```

---

Calls Limit Per Minute

60

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

userId

String

Located in: **path**

Required: **Yes**

ID of the user whose purchases are to be listed.

---

##### Responses

200

Successful operation.

```
[
  {
    "itemId": "item-x",
    "timestamp": 1348151906.0,
    "userId": "user-a"
  },
  {
    "itemId": "item-z",
    "timestamp": 1348239363.0,
    "userId": "user-a"
  }
]
```

---

400

The `userId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

404

Given `userId` not found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

### Ratings

post

#### Add Rating

Allowed on Client-Side

Adds a rating of the given item made by the given user.

```js
client.send(new recombee.AddRating(userId, itemId, rating, {
  // optional parameters:
  timestamp: '2022-05-13T18:25:43Z',                 // string / number
  cascadeCreate: true,                               // boolean
  recommId: 'ce52ada4-e4d9-4885-943c-407db2dee837',  // string
  additionalData: {},                                // Object
}));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

userId

String

Located in: **body**

Required: **Yes**

User who submitted the rating

---

itemId

String

Located in: **body**

Required: **Yes**

Rated item

---

timestamp

String

Number

Located in: **body**

Required: **No**

UTC timestamp of the rating as ISO8601-1 pattern or UTC epoch time. The default value is the current time.

---

rating

Number

Located in: **body**

Required: **Yes**

Rating rescaled to interval \[-1.0,1.0\], where -1.0 means the worst rating possible, 0.0 means neutral, and 1.0 means absolutely positive rating. For example, in the case of 5-star evaluations, rating = (numStars-3)/2 formula may be used for the conversion.

---

cascadeCreate

Boolean

Located in: **body**

Required: **No**

Sets whether the given user/item should be created if not present in the database.

---

recommId

String

Located in: **body**

Required: **No**

Since version: **2.2.0**

If this rating is based on a recommendation request, `recommId` is the id of the clicked recommendation.

---

additionalData

Object

Located in: **body**

Required: **No**

Since version: **2.3.0**

Additional data associated with the interaction. The expected structure is defined for specific use cases and will be provided by the Recombee Support team when applicable.

---

##### Responses

200

Successful operation.

---

400

The `userId` or `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$, or rating is not a real number from \[-1.0,1.0\], or timestamp is not a real number ≥ 0.

---

404

The `cascadeCreate` is not set true and the `userId` or the `itemId` were found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

409

A rating of the exact same `userId`, `itemId`, and `timestamp` is already present in the database. Note that a user may rate an item multiple times, yet triplets (userId, itemId, timestamp) must be unique. In many cases, you may consider this code a success – it only tells you that nothing has been written to the database.

---

delete

#### Delete Rating

Deletes an existing rating specified by (`userId`, `itemId`, `timestamp`) from the database or all the ratings with the given `userId` and `itemId` if `timestamp` is omitted.

```js
client.send(new requests.DeleteRating(userId, itemId, {
  // optional parameters:
  timestamp: 1652466343,  // number
}));
```

---

Calls Limit Per Minute

1000

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

userId

String

Located in: **query**

Required: **Yes**

ID of the user who rated the item.

---

itemId

String

Located in: **query**

Required: **Yes**

ID of the item which was rated.

---

timestamp

Number

Located in: **query**

Required: **No**

Unix timestamp of the rating. If the `timestamp` is omitted, then all the ratings with the given `userId` and `itemId` are deleted.

---

##### Responses

200

Successful operation.

---

400

Given `userId` or `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$, or `timestamp` is not a real number ≥ 0.

---

404

The `userId`, `itemId` or rating with the given (`userId`, `itemId`, `timestamp`) not found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### List Item Ratings

Lists all the ratings of an item ever submitted by different users.

```js
const result = await client.send(new requests.ListItemRatings(itemId));
```

---

Calls Limit Per Minute

60

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

itemId

String

Located in: **path**

Required: **Yes**

ID of the item whose ratings are to be listed.

---

##### Responses

200

Successful operation.

```
[
  {
    "itemId": "item-x",
    "userId": "user-a",
    "rating": -0.25,
    "timestamp": 1348151906.0
  },
  {
    "itemId": "item-x",
    "userId": "user-b",
    "rating": 0.0,
    "timestamp": 1348239363.0
  }
]
```

---

400

The `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

404

Given `itemId` not found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### List User Ratings

Lists all the ratings ever submitted by the given user.

```js
const result = await client.send(new requests.ListUserRatings(userId));
```

---

Calls Limit Per Minute

60

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

userId

String

Located in: **path**

Required: **Yes**

ID of the user whose ratings are to be listed.

---

##### Responses

200

Successful operation.

```
[
  {
    "itemId": "item-y",
    "userId": "user-a",
    "rating": 0.5,
    "timestamp": 1348139180.0
  },
  {
    "itemId": "item-x",
    "userId": "user-a",
    "rating": -0.25,
    "timestamp": 1348151906.0
  }
]
```

---

400

The `userId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

404

Given `userId` not found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

### Cart Additions

post

#### Add Cart Addition

Allowed on Client-Side

Adds a cart addition of the given item made by the given user.

```js
client.send(new recombee.AddCartAddition(userId, itemId, {
  // optional parameters:
  timestamp: '2022-05-13T18:25:43Z',                 // string / number
  cascadeCreate: true,                               // boolean
  amount: 1,                                         // number
  price: 25.0,                                       // number
  recommId: 'ce52ada4-e4d9-4885-943c-407db2dee837',  // string
  additionalData: {},                                // Object
}));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

userId

String

Located in: **body**

Required: **Yes**

User who added the item to the cart

---

itemId

String

Located in: **body**

Required: **Yes**

Item added to the cart

---

timestamp

String

Number

Located in: **body**

Required: **No**

UTC timestamp of the cart addition as ISO8601-1 pattern or UTC epoch time. The default value is the current time.

---

cascadeCreate

Boolean

Located in: **body**

Required: **No**

Sets whether the given user/item should be created if not present in the database.

---

amount

Number

Located in: **body**

Required: **No**

Since version: **1.6.0**

Amount (number) added to cart. The default is 1\. For example, if `user-x` adds two `item-y` during a single order (session...), the `amount` should equal 2.

---

price

Number

Located in: **body**

Required: **No**

Since version: **1.6.0**

Price of the added item. If `amount` is greater than 1, the sum of prices of all the items should be given.

---

recommId

String

Located in: **body**

Required: **No**

Since version: **2.2.0**

If this cart addition is based on a recommendation request, `recommId` is the id of the clicked recommendation.

---

additionalData

Object

Located in: **body**

Required: **No**

Since version: **2.3.0**

Additional data associated with the interaction. The expected structure is defined for specific use cases and will be provided by the Recombee Support team when applicable.

---

##### Responses

200

Successful operation.

---

400

The `userId` or `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$, `timestamp` is not a real number ≥ 0.

---

404

The `cascadeCreate` is not set true and the `userId` or the `itemId` were found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

409

A cart addition of the exact same `userId`, `itemId`, and `timestamp` is already present in the database. In many cases, you may consider this code a success – it only tells you that nothing has been written to the database.

---

delete

#### Delete Cart Addition

Deletes an existing cart addition uniquely specified by `userId`, `itemId`, and `timestamp` or all the cart additions with the given `userId` and `itemId` if `timestamp` is omitted.

```js
client.send(new requests.DeleteCartAddition(userId, itemId, {
  // optional parameters:
  timestamp: 1652466343,  // number
}));
```

---

Calls Limit Per Minute

1000

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

userId

String

Located in: **query**

Required: **Yes**

ID of the user who made the cart addition.

---

itemId

String

Located in: **query**

Required: **Yes**

ID of the item which was added to the cart.

---

timestamp

Number

Located in: **query**

Required: **No**

Unix timestamp of the cart addition. If the `timestamp` is omitted, then all the cart additions with the given `userId` and `itemId` are deleted.

---

##### Responses

200

Successful operation.

---

400

Given `userId` or `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$, or `timestamp` is not a real number ≥ 0.

---

404

The `userId`, `itemId`, or cart addition with the given (`userId`, `itemId`, `timestamp`) not found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### List Item Cart Additions

Lists all the ever-made cart additions of the given item.

```js
const result = await client.send(new requests.ListItemCartAdditions(itemId));
```

---

Calls Limit Per Minute

60

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

itemId

String

Located in: **path**

Required: **Yes**

ID of the item whose cart additions are to be listed.

---

##### Responses

200

Successful operation.

```
[
  {
    "itemId": "item-x",
    "userId": "user-a",
    "timestamp": 1348151906.0
  },
  {
    "itemId": "item-x",
    "userId": "user-a",
    "timestamp": 1348327154.0
  }
]
```

---

400

The `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

404

Given `itemId` not found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### List User Cart Additions

Lists all the cart additions ever made by the given user.

```js
const result = await client.send(new requests.ListUserCartAdditions(userId));
```

---

Calls Limit Per Minute

60

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

userId

String

Located in: **path**

Required: **Yes**

ID of the user whose cart additions are to be listed.

---

##### Responses

200

Successful operation.

```
[
  {
    "itemId": "item-x",
    "timestamp": 1348151906.0,
    "userId": "user-a"
  },
  {
    "itemId": "item-z",
    "timestamp": 1348239363.0,
    "userId": "user-a"
  }
]
```

---

400

The `userId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

404

Given `userId` not found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

### Bookmarks

post

#### Add Bookmark

Allowed on Client-Side

Adds a bookmark of the given item made by the given user.

```js
client.send(new recombee.AddBookmark(userId, itemId, {
  // optional parameters:
  timestamp: '2022-05-13T18:25:43Z',                 // string / number
  cascadeCreate: true,                               // boolean
  recommId: 'ce52ada4-e4d9-4885-943c-407db2dee837',  // string
  additionalData: {},                                // Object
}));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

userId

String

Located in: **body**

Required: **Yes**

User who bookmarked the item

---

itemId

String

Located in: **body**

Required: **Yes**

Bookmarked item

---

timestamp

String

Number

Located in: **body**

Required: **No**

UTC timestamp of the bookmark as ISO8601-1 pattern or UTC epoch time. The default value is the current time.

---

cascadeCreate

Boolean

Located in: **body**

Required: **No**

Sets whether the given user/item should be created if not present in the database.

---

recommId

String

Located in: **body**

Required: **No**

Since version: **2.2.0**

If this bookmark is based on a recommendation request, `recommId` is the id of the clicked recommendation.

---

additionalData

Object

Located in: **body**

Required: **No**

Since version: **2.3.0**

Additional data associated with the interaction. The expected structure is defined for specific use cases and will be provided by the Recombee Support team when applicable.

---

##### Responses

200

Successful operation.

---

400

The `userId` or `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$, `timestamp` is not a real number ≥ 0.

---

404

The `cascadeCreate` is not set true and the `userId` or the `itemId` were found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

409

A bookmark of the exact same `userId`, `itemId`, and `timestamp` is already present in the database. In many cases, you may consider this code a success – it only tells you that nothing has been written to the database.

---

delete

#### Delete Bookmark

Deletes a bookmark uniquely specified by `userId`, `itemId`, and `timestamp` or all the bookmarks with the given `userId` and `itemId` if `timestamp` is omitted.

```js
client.send(new requests.DeleteBookmark(userId, itemId, {
  // optional parameters:
  timestamp: 1652466343,  // number
}));
```

---

Calls Limit Per Minute

1000

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

userId

String

Located in: **query**

Required: **Yes**

ID of the user who made the bookmark.

---

itemId

String

Located in: **query**

Required: **Yes**

ID of the item which was bookmarked.

---

timestamp

Number

Located in: **query**

Required: **No**

Unix timestamp of the bookmark. If the `timestamp` is omitted, then all the bookmarks with the given `userId` and `itemId` are deleted.

---

##### Responses

200

Successful operation.

---

400

Given `userId` or `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$, or `timestamp` is not a real number ≥ 0.

---

404

The `userId`, `itemId`, or bookmark with the given (`userId`, `itemId`, `timestamp`) not found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### List Item Bookmarks

Lists all the ever-made bookmarks of the given item.

```js
const result = await client.send(new requests.ListItemBookmarks(itemId));
```

---

Calls Limit Per Minute

60

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

itemId

String

Located in: **path**

Required: **Yes**

ID of the item whose bookmarks are to be listed.

---

##### Responses

200

Successful operation.

```
[
  {
    "itemId": "item-x",
    "userId": "user-a",
    "timestamp": 1348151906.0
  },
  {
    "itemId": "item-x",
    "userId": "user-a",
    "timestamp": 1348327154.0
  }
]
```

---

400

The `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

404

Given `itemId` not found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### List User Bookmarks

Lists all the bookmarks ever made by the given user.

```js
const result = await client.send(new requests.ListUserBookmarks(userId));
```

---

Calls Limit Per Minute

60

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

userId

String

Located in: **path**

Required: **Yes**

ID of the user whose bookmarks are to be listed.

---

##### Responses

200

Successful operation.

```
[
  {
    "itemId": "item-x",
    "timestamp": 1348151906.0,
    "userId": "user-a"
  },
  {
    "itemId": "item-z",
    "timestamp": 1348239363.0,
    "userId": "user-a"
  }
]
```

---

400

The `userId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

404

Given `userId` not found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

### View Portions

post

#### Set View Portion

Allowed on Client-Side

Sets viewed portion of an item (for example a video or article) by a user (at a session). If you send a new request with the same (`userId`, `itemId`, `sessionId`), the portion gets updated.

```js
client.send(new recombee.SetViewPortion(userId, itemId, portion, {
  // optional parameters:
  sessionId: 'ABAD1D',                               // string
  timestamp: '2022-05-13T18:25:43Z',                 // string / number
  cascadeCreate: true,                               // boolean
  recommId: 'ce52ada4-e4d9-4885-943c-407db2dee837',  // string
  additionalData: {},                                // Object
  autoPresented: false,                              // boolean
  timeSpent: 42,                                     // number
}));
```

---

Since version

2.1.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **2.1.0**

ID of your database.

---

userId

String

Located in: **body**

Required: **Yes**

Since version: **2.1.0**

User who viewed a portion of the item

---

itemId

String

Located in: **body**

Required: **Yes**

Since version: **2.1.0**

Viewed item

---

portion

Number

Located in: **body**

Required: **Yes**

Since version: **2.1.0**

Viewed portion of the item (number between 0.0 (viewed nothing) and 1.0 (viewed full item) ). It should be the actual viewed part of the item, no matter the seeking. For example, if the user seeked immediately to half of the item and then viewed 10% of the item, the `portion` should still be `0.1`.

---

sessionId

String

Located in: **body**

Required: **No**

Since version: **2.1.0**

ID of the session in which the user viewed the item. Default is `null` (`None`, `nil`, `NULL` etc., depending on the language).

---

timestamp

String

Number

Located in: **body**

Required: **No**

Since version: **2.1.0**

UTC timestamp of the view portion as ISO8601-1 pattern or UTC epoch time. The default value is the current time.

---

cascadeCreate

Boolean

Located in: **body**

Required: **No**

Since version: **2.1.0**

Sets whether the given user/item should be created if not present in the database.

---

recommId

String

Located in: **body**

Required: **No**

Since version: **2.2.0**

If this view portion is based on a recommendation request, `recommId` is the id of the clicked recommendation.

---

additionalData

Object

Located in: **body**

Required: **No**

Since version: **2.3.0**

Additional data associated with the interaction. The expected structure is defined for specific use cases and will be provided by the Recombee Support team when applicable.

---

autoPresented

Boolean

Located in: **body**

Required: **No**

Since version: **6.0.0**

Indicates whether the item was automatically presented to the user (e.g., in a swiping feed) or explicitly requested by the user (e.g., by clicking on a link). Defaults to `false`.

---

timeSpent

Number

Located in: **body**

Required: **No**

Since version: **6.0.0**

The duration (in seconds) that the user viewed the item. In update requests, this value may only increase and is required only if it has changed.

---

##### Responses

200

Successful operation.

---

400

The `userId`, `itemId` or `sessionId` does not match ^\[a-zA-Z0-9\_-:@.\]+$, or the `portion` is not a real number from \[0.0,1.0\].

---

404

The `cascadeCreate` is not set true and the `userId` or the `itemId` were found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

409

A view portion of the exact same `userId`, `itemId`, and a greater or equal `timestamp` (or a greater `portion`) is already present in the database. In many cases, you may consider this code a success – it only tells you that nothing has been written to the database.

---

delete

#### Delete View Portion

Deletes an existing view portion specified by (`userId`, `itemId`, `sessionId`) from the database.

```js
client.send(new requests.DeleteViewPortion(userId, itemId, {
  // optional parameters:
  sessionId: 'ABAD1D',  // string
}));
```

---

Since version

2.1.0

---

Calls Limit Per Minute

1000

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **2.1.0**

ID of your database.

---

userId

String

Located in: **query**

Required: **Yes**

Since version: **2.1.0**

ID of the user who rated the item.

---

itemId

String

Located in: **query**

Required: **Yes**

Since version: **2.1.0**

ID of the item which was rated.

---

sessionId

String

Located in: **query**

Required: **No**

Since version: **2.1.0**

Identifier of a session.

---

##### Responses

200

Successful operation.

---

400

Given `userId`, `itemId` or `sessionId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

404

The `userId`, `itemId` or view portion with the given (`userId`, `itemId`, `sessionId`) not found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### List Item View Portions

Lists all the view portions of an item ever submitted by different users.

```js
const result = await client.send(new requests.ListItemViewPortions(itemId));
```

---

Since version

2.1.0

---

Calls Limit Per Minute

60

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **2.1.0**

ID of your database.

---

itemId

String

Located in: **path**

Required: **Yes**

Since version: **2.1.0**

ID of the item whose view portions are to be listed.

---

##### Responses

200

Successful operation.

```
[
  {
    "itemId": "item-x",
    "userId": "user-a",
    "sessionId": "ABAD1D",
    "portion": 0.5,
    "autoPresented": true,
    "timeSpent": 40.5,
    "timestamp": 1348151906.0
  },
  {
    "itemId": "item-x",
    "userId": "user-b",
    "sessionId": null,
    "portion": 1,
    "autoPresented": false,
    "timeSpent": 0,
    "timestamp": 1348239363.0
  }
]
```

---

400

The `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

404

Given `itemId` not found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### List User View Portions

Lists all the view portions ever submitted by the given user.

```js
const result = await client.send(new requests.ListUserViewPortions(userId));
```

---

Since version

2.1.0

---

Calls Limit Per Minute

60

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **2.1.0**

ID of your database.

---

userId

String

Located in: **path**

Required: **Yes**

Since version: **2.1.0**

ID of the user whose view portions are to be listed.

---

##### Responses

200

Successful operation.

```
[
  {
    "itemId": "item-x",
    "userId": "user-a",
    "sessionId": "ABAD1D",
    "portion": 0.25,
    "autoPresented": false,
    "timeSpent": 1.5,
    "timestamp": 1348151906.0
  },
  {
    "itemId": "item-y",
    "userId": "user-a",
    "sessionId": "EWQKOL",
    "portion": 0.1,
    "autoPresented": true,
    "timeSpent": 231.25,
    "timestamp": 1348239363.0
  }
]
```

---

400

The `userId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

404

Given `userId` not found in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

## Recommendations

Recommendation methods are capable of recommending items (Recommend Items to User, Recommend Items to Item) or users (Recommend Users to Item, Recommend Users to User).

See Segmentations section for recommendation endpoints that return Segments (e.g. "recommend categories to a user").

### Recommending Items

Recommendation endpoints that return the Items (content, products, etc.).

post

#### Recommend Items to User

Allowed on Client-Side

Based on the user's past interactions (purchases, ratings, etc.) with the items, recommends top-N items that are most likely to be of high value for the given user.

The most typical use cases are recommendations on the homepage, in some "Picked just for you" section, or in email.

The returned items are sorted by relevance (the first item being the most relevant).

Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to:

* Let Recombee know that this recommendation was successful (e.g., user clicked one of the recommended items). See [Reported metrics](https://docs.recombee.com/admin_ui#reported-metrics).
* Get subsequent recommended items when the user scrolls down (_infinite scroll_) or goes to the next page. See [Recommend Next Items](https://docs.recombee.com/api#recommend-next-items).

It is also possible to use GET HTTP method - body parameters then become query parameters.

```js
const result = await client.send(new recombee.RecommendItemsToUser(userId, count, {
  // optional parameters:
  scenario: 'homepage',                                                  // string
  cascadeCreate: true,                                                   // boolean
  returnProperties: true,                                                // boolean
  includedProperties: ['title', 'price', 'publishedAt'],                 // array
  filter: 'price > 50',                                                  // string
  booster: 'if now() - \'publishedAt\' <= 7 * 24 * 3600 then 2 else 1',  // string
  logic: 'recombee:default',                                             // string / Object
  reqlExpressions: {
    isInUsersCity: 'context_user["city"] in \'cities\'',
  },                                                                     // Object
  minRelevance: 'low',                                                   // string
  rotationRate: 0.1,                                                     // number
  rotationTime: 7200.0,                                                  // number
}));
```

---

Since version

2.0.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **2.0.0**

ID of your database.

---

userId

String

Located in: **path**

Required: **Yes**

Since version: **2.0.0**

ID of the user for whom personalized recommendations are to be generated.

---

count

Integer

Located in: **body**

Required: **Yes**

Since version: **2.0.0**

Number of items to be recommended (N for the top-N recommendation).

---

scenario

String

Located in: **body**

Required: **No**

Since version: **2.0.0**

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

Located in: **body**

Required: **No**

Since version: **2.0.0**

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.

---

returnProperties

Boolean

Located in: **body**

Required: **No**

Since version: **2.0.0**

With `returnProperties=true`, property values of the recommended items are returned along with their IDs in a JSON dictionary. The acquired property values can be used to easily display the recommended items to the user.

Example response:

```
  {
    "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
    "recomms": 
      [
        {
          "id": "tv-178",
          "values": {
            "description": "4K TV with 3D feature",
            "categories":   ["Electronics", "Televisions"],
            "price": 342,
            "url": "myshop.com/tv-178"
          }
        },
        {
          "id": "mixer-42",
          "values": {
            "description": "Stainless Steel Mixer",
            "categories":   ["Home & Kitchen"],
            "price": 39,
            "url": "myshop.com/mixer-42"
          }
        }
      ],
     "numberNextRecommsCalls": 0
  }
```

---

includedProperties

Array

Located in: **body**

Required: **No**

Since version: **2.0.0**

Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.

Example response for `includedProperties=description,price`:

```
  {
    "recommId": "a86ee8d5-cd8e-46d1-886c-8b3771d0520b",
    "recomms":
      [
        {
          "id": "tv-178",
          "values": {
            "description": "4K TV with 3D feature",
            "price": 342
          }
        },
        {
          "id": "mixer-42",
          "values": {
            "description": "Stainless Steel Mixer",
            "price": 39
          }
        }
      ],
    "numberNextRecommsCalls": 0
  }
```

---

filter

String

Located in: **body**

Required: **No**

Since version: **2.0.0**

Boolean-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to filter recommended items based on the values of their attributes.

Filters can also be assigned to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

booster

String

Located in: **body**

Required: **No**

Since version: **2.0.0**

Number-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to boost the recommendation rate of some items based on the values of their attributes.

Boosters can also be assigned to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

logic

String

Object

Located in: **body**

Required: **No**

Since version: **2.4.0**

Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case. See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.

The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.

Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

reqlExpressions

Object

Located in: **body**

Required: **No**

Since version: **6.0.0**

A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended item. This can be used to compute additional properties of the recommended items that are not stored in the database.

The keys are the names of the expressions, and the values are the actual ReQL expressions.

Example request:

```
{
  "reqlExpressions": {
    "isInUsersCity": "context_user[\"city\"] in 'cities'",
    "distanceToUser": "earth_distance('location', context_user[\"location\"])"
  }
}
```

Example response:

```
{
  "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
  "recomms": 
    [
      {
        "id": "restaurant-178",
        "reqlEvaluations": {
          "isInUsersCity": true,
          "distanceToUser": 5200.2
        }
      },
      {
        "id": "bar-42",
        "reqlEvaluations": {
          "isInUsersCity": false,
          "distanceToUser": 2516.0
        }
      }
    ],
   "numberNextRecommsCalls": 0
}
```

---

minRelevance

String

Located in: **body**

Required: **No**

Since version: **2.0.0**

**Expert option:** Specifies the threshold of how relevant must the recommended items be to the user. Possible values one of: "low", "medium", "high". The default value is "low", meaning that the system attempts to recommend a number of items equal to _count_ at any cost. If there is not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be appended to reach the full _count_. This behavior may be suppressed by using "medium" or "high" values. In such a case, the system only recommends items of at least the requested relevance and may return less than _count_ items when there is not enough data to fulfill it.

---

rotationRate

Number

Located in: **body**

Required: **No**

Since version: **2.0.0**

**Expert option:** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per request in a backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example, `rotationRate=0.2` for only slight rotation of recommended items. Default: `0`.

---

rotationTime

Number

Located in: **body**

Required: **No**

Since version: **2.0.0**

**Expert option:** Taking _rotationRate_ into account, specifies how long it takes for an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. Default: `7200.0`.

---

##### Responses

200

Successful operation.

```
{
  "recommId": "3f6ad2f2-a3f1-4ba1-a690-f4f01f76d4eb",
  "recomms": [
    {
      "id": "item-146"
    },
    {
      "id": "item-462"
    },
    {
      "id": "item-463"
    }
  ],
  "numberNextRecommsCalls": 0
}
```

---

400

userId does not match ^\[a-zA-Z0-9\_-:@.\]+$, count is not a positive integer, filter or booster is not valid [ReQL](https://docs.recombee.com/reql) expressions, filter expression does not return boolean, booster does not return double or integer.

---

404

userId not found in the database and cascadeCreate is false. If there is no additional info in the JSON response, you probably have an error in your URL.

---

post

#### Recommend Items to Item

Allowed on Client-Side

Recommends a set of items that are somehow related to one given item, _X_. A typical scenario is when the user _A_ is viewing _X_. Then you may display items to the user that he might also be interested in. Recommend items to item request gives you Top-N such items, optionally taking the target user _A_ into account.

The returned items are sorted by relevance (the first item being the most relevant).

Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to:

* Let Recombee know that this recommendation was successful (e.g., user clicked one of the recommended items). See [Reported metrics](https://docs.recombee.com/admin_ui#reported-metrics).
* Get subsequent recommended items when the user scrolls down (_infinite scroll_) or goes to the next page. See [Recommend Next Items](https://docs.recombee.com/api#recommend-next-items).

It is also possible to use GET HTTP method - body parameters then become query parameters.

```js
const result = await client.send(new recombee.RecommendItemsToItem(itemId, targetUserId, count, {
  // optional parameters:
  scenario: 'homepage',                                                  // string
  cascadeCreate: true,                                                   // boolean
  returnProperties: true,                                                // boolean
  includedProperties: ['title', 'price', 'publishedAt'],                 // array
  filter: 'price > 50',                                                  // string
  booster: 'if now() - \'publishedAt\' <= 7 * 24 * 3600 then 2 else 1',  // string
  logic: 'recombee:default',                                             // string / Object
  reqlExpressions: {
    isInUsersCity: 'context_user["city"] in \'cities\'',
  },                                                                     // Object
  minRelevance: 'low',                                                   // string
  rotationRate: 0.1,                                                     // number
  rotationTime: 7200.0,                                                  // number
}));
```

---

Since version

2.0.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **2.0.0**

ID of your database.

---

itemId

String

Located in: **path**

Required: **Yes**

Since version: **2.0.0**

ID of the item for which the recommendations are to be generated.

---

targetUserId

String

Located in: **body**

Required: **Yes**

Since version: **2.0.0**

ID of the user who will see the recommendations.

Specifying the _targetUserId_ is beneficial because:

* It makes the recommendations personalized
* Allows the calculation of Actions and Conversions in the graphical user interface, as Recombee can pair the user who got recommendations and who afterward viewed/purchased an item.

If you insist on not specifying the user, pass `null`(`None`, `nil`, `NULL` etc., depending on the language) to _targetUserId_. Do not create some special dummy user for getting recommendations, as it could mislead the recommendation models, and result in wrong recommendations.

For anonymous/unregistered users, it is possible to use, for example, their session ID.

---

count

Integer

Located in: **body**

Required: **Yes**

Since version: **2.0.0**

Number of items to be recommended (N for the top-N recommendation).

---

scenario

String

Located in: **body**

Required: **No**

Since version: **2.0.0**

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

Located in: **body**

Required: **No**

Since version: **2.0.0**

If an item of the given _itemId_ or user of the given _targetUserId_ doesn't exist in the database, it creates the missing entity/entities and returns some (non-personalized) recommendations. This allows, for example, rotations in the following recommendations for the user of the given _targetUserId_, as the user will be already known to the system.

---

returnProperties

Boolean

Located in: **body**

Required: **No**

Since version: **2.0.0**

With `returnProperties=true`, property values of the recommended items are returned along with their IDs in a JSON dictionary. The acquired property values can be used to easily display the recommended items to the user.

Example response:

```
  {
    "recommId": "0c6189e7-dc1a-429a-b613-192696309361",
    "recomms":
      [
        {
          "id": "tv-178",
          "values": {
            "description": "4K TV with 3D feature",
            "categories":   ["Electronics", "Televisions"],
            "price": 342,
            "url": "myshop.com/tv-178"
          }
        },
        {
          "id": "mixer-42",
          "values": {
            "description": "Stainless Steel Mixer",
            "categories":   ["Home & Kitchen"],
            "price": 39,
            "url": "myshop.com/mixer-42"
          }
        }
      ],
    "numberNextRecommsCalls": 0
  }
```

---

includedProperties

Array

Located in: **body**

Required: **No**

Since version: **2.0.0**

Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.

Example response for `includedProperties=description,price`:

```
  {
    "recommId": "6842c725-a79f-4537-a02c-f34d668a3f80",
    "recomms":
      [
        {
          "id": "tv-178",
          "values": {
            "description": "4K TV with 3D feature",
            "price": 342
          }
        },
        {
          "id": "mixer-42",
          "values": {
            "description": "Stainless Steel Mixer",
            "price": 39
          }
        }
      ],
    "numberNextRecommsCalls": 0
  }
```

---

filter

String

Located in: **body**

Required: **No**

Since version: **2.0.0**

Boolean-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to filter recommended items based on the values of their attributes.

Filters can also be assigned to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

booster

String

Located in: **body**

Required: **No**

Since version: **2.0.0**

Number-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to boost the recommendation rate of some items based on the values of their attributes.

Boosters can also be assigned to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

logic

String

Object

Located in: **body**

Required: **No**

Since version: **2.4.0**

Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case. See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.

The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.

Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

reqlExpressions

Object

Located in: **body**

Required: **No**

Since version: **6.0.0**

A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended item. This can be used to compute additional properties of the recommended items that are not stored in the database.

The keys are the names of the expressions, and the values are the actual ReQL expressions.

Example request:

```
{
  "reqlExpressions": {
    "isInUsersCity": "context_user[\"city\"] in 'cities'",
    "distanceToUser": "earth_distance('location', context_user[\"location\"])",
    "isFromSameCompany": "'company' == context_item[\"company\"]"
  }
}
```

Example response:

```
{
  "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
  "recomms": 
    [
      {
        "id": "restaurant-178",
        "reqlEvaluations": {
          "isInUsersCity": true,
          "distanceToUser": 5200.2,
          "isFromSameCompany": false
        }
      },
      {
        "id": "bar-42",
        "reqlEvaluations": {
          "isInUsersCity": false,
          "distanceToUser": 2516.0,
          "isFromSameCompany": true
        }
      }
    ],
   "numberNextRecommsCalls": 0
}
```

---

minRelevance

String

Located in: **body**

Required: **No**

Since version: **2.0.0**

**Expert option:** If the _targetUserId_ is provided: Specifies the threshold of how relevant must the recommended items be to the user. Possible values one of: "low", "medium", "high". The default value is "low", meaning that the system attempts to recommend a number of items equal to _count_ at any cost. If there is not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations being appended to reach the full _count_. This behavior may be suppressed by using "medium" or "high" values. In such case, the system only recommends items of at least the requested relevance and may return less than _count_ items when there is not enough data to fulfill it.

---

rotationRate

Number

Located in: **body**

Required: **No**

Since version: **2.0.0**

**Expert option:** If the _targetUserId_ is provided: If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per request in a backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example, `rotationRate=0.2` for only slight rotation of recommended items.

---

rotationTime

Number

Located in: **body**

Required: **No**

Since version: **2.0.0**

**Expert option:** If the _targetUserId_ is provided: Taking _rotationRate_ into account, specifies how long it takes for an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized.

---

##### Responses

200

Successful operation.

```
{
  "recommId": "768448ea-10b3-4028-bb76-4b2f95121d19",
  "recomms": [
    {
      "id": "item-146"
    },
    {
      "id": "item-462"
    },
    {
      "id": "item-463"
    }
  ],
  "numberNextRecommsCalls": 0
}
```

---

400

itemId does not match ^\[a-zA-Z0-9\_-:@.\]+$, count is not a positive integer, filter or booster is not valid [ReQL](https://docs.recombee.com/reql) expressions, filter expression does not return boolean, booster does not return double or integer.

---

404

itemId not found in the database and cascadeCreate is false. If there is no additional info in the JSON response, you probably have an error in your URL.

---

post

#### Recommend Items to Item Segment

Allowed on Client-Side

Recommends Items that are the most relevant to a particular Segment from a context [Segmentation](https://docs.recombee.com/segmentations).

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

* Recommending articles related to a particular topic
* Recommending songs belonging to a particular genre
* Recommending products produced by a particular brand

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

The returned items are sorted by relevance (the first item being the most relevant).

It is also possible to use GET HTTP method - body parameters then become query parameters.

```js
const result = await client.send(new recombee.RecommendItemsToItemSegment(contextSegmentId, targetUserId, count, {
  // optional parameters:
  scenario: 'homepage',                                                  // string
  cascadeCreate: true,                                                   // boolean
  returnProperties: true,                                                // boolean
  includedProperties: ['title', 'price', 'publishedAt'],                 // array
  filter: 'price > 50',                                                  // string
  booster: 'if now() - \'publishedAt\' <= 7 * 24 * 3600 then 2 else 1',  // string
  logic: 'recombee:personal-from-segment',                               // string / Object
  reqlExpressions: {
    isInUsersCity: 'context_user["city"] in \'cities\'',
  },                                                                     // Object
  minRelevance: 'low',                                                   // string
  rotationRate: 0.1,                                                     // number
  rotationTime: 7200.0,                                                  // number
}));
```

---

Since version

5.0.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **5.0.0**

ID of your database.

---

contextSegmentId

String

Located in: **body**

Required: **Yes**

Since version: **5.0.0**

ID of the segment from `contextSegmentationId` for which the recommendations are to be generated.

---

targetUserId

String

Located in: **body**

Required: **Yes**

Since version: **5.0.0**

ID of the user who will see the recommendations.

Specifying the _targetUserId_ is beneficial because:

* It makes the recommendations personalized
* Allows the calculation of Actions and Conversions in the graphical user interface, as Recombee can pair the user who got recommendations and who afterward viewed/purchased an item.

If you insist on not specifying the user, pass `null`(`None`, `nil`, `NULL` etc., depending on the language) to _targetUserId_. Do not create some special dummy user for getting recommendations, as it could mislead the recommendation models, and result in wrong recommendations.

For anonymous/unregistered users, it is possible to use, for example, their session ID.

---

count

Integer

Located in: **body**

Required: **Yes**

Since version: **5.0.0**

Number of items to be recommended (N for the top-N recommendation).

---

scenario

String

Located in: **body**

Required: **No**

Since version: **5.0.0**

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

Located in: **body**

Required: **No**

Since version: **5.0.0**

If a user of the given _targetUserId_ doesn't exist in the database, it creates this user and returns some (non-personalized) recommendations. This allows, for example, rotations in the following recommendations for the user of the given _targetUserId_, as the user will be already known to the system.

---

returnProperties

Boolean

Located in: **body**

Required: **No**

Since version: **5.0.0**

With `returnProperties=true`, property values of the recommended items are returned along with their IDs in a JSON dictionary. The acquired property values can be used to easily display the recommended items to the user.

Example response:

```
  {
    "recommId": "0c6189e7-dc1a-429a-b613-192696309361",
    "recomms":
      [
        {
          "id": "tv-178",
          "values": {
            "description": "4K TV with 3D feature",
            "categories":   ["Electronics", "Televisions"],
            "price": 342,
            "url": "myshop.com/tv-178"
          }
        },
        {
          "id": "mixer-42",
          "values": {
            "description": "Stainless Steel Mixer",
            "categories":   ["Home & Kitchen"],
            "price": 39,
            "url": "myshop.com/mixer-42"
          }
        }
      ],
    "numberNextRecommsCalls": 0
  }
```

---

includedProperties

Array

Located in: **body**

Required: **No**

Since version: **5.0.0**

Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.

Example response for `includedProperties=description,price`:

```
  {
    "recommId": "6842c725-a79f-4537-a02c-f34d668a3f80",
    "recomms":
      [
        {
          "id": "tv-178",
          "values": {
            "description": "4K TV with 3D feature",
            "price": 342
          }
        },
        {
          "id": "mixer-42",
          "values": {
            "description": "Stainless Steel Mixer",
            "price": 39
          }
        }
      ],
    "numberNextRecommsCalls": 0
  }
```

---

filter

String

Located in: **body**

Required: **No**

Since version: **5.0.0**

Boolean-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to filter recommended items based on the values of their attributes.

Filters can also be assigned to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

booster

String

Located in: **body**

Required: **No**

Since version: **5.0.0**

Number-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to boost the recommendation rate of some items based on the values of their attributes.

Boosters can also be assigned to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

logic

String

Object

Located in: **body**

Required: **No**

Since version: **5.0.0**

Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case. See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.

The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.

Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

reqlExpressions

Object

Located in: **body**

Required: **No**

Since version: **6.0.0**

A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended item. This can be used to compute additional properties of the recommended items that are not stored in the database.

The keys are the names of the expressions, and the values are the actual ReQL expressions.

Example request:

```
{
  "reqlExpressions": {
    "isInUsersCity": "context_user[\"city\"] in 'cities'",
    "distanceToUser": "earth_distance('location', context_user[\"location\"])"
  }
}
```

Example response:

```
{
  "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
  "recomms": 
    [
      {
        "id": "restaurant-178",
        "reqlEvaluations": {
          "isInUsersCity": true,
          "distanceToUser": 5200.2
        }
      },
      {
        "id": "bar-42",
        "reqlEvaluations": {
          "isInUsersCity": false,
          "distanceToUser": 2516.0
        }
      }
    ],
   "numberNextRecommsCalls": 0
}
```

---

minRelevance

String

Located in: **body**

Required: **No**

Since version: **5.0.0**

**Expert option:** If the _targetUserId_ is provided: Specifies the threshold of how relevant must the recommended items be to the user. Possible values one of: "low", "medium", "high". The default value is "low", meaning that the system attempts to recommend a number of items equal to _count_ at any cost. If there is not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations being appended to reach the full _count_. This behavior may be suppressed by using "medium" or "high" values. In such case, the system only recommends items of at least the requested relevance and may return less than _count_ items when there is not enough data to fulfill it.

---

rotationRate

Number

Located in: **body**

Required: **No**

Since version: **5.0.0**

**Expert option:** If the _targetUserId_ is provided: If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per request in a backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example, `rotationRate=0.2` for only slight rotation of recommended items.

---

rotationTime

Number

Located in: **body**

Required: **No**

Since version: **5.0.0**

**Expert option:** If the _targetUserId_ is provided: Taking _rotationRate_ into account, specifies how long it takes for an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized.

---

##### Responses

200

successful operation

```
{
  "recommId": "768448ea-10b3-4028-bb76-4b2f95121d19",
  "recomms": [
    {
      "id": "item-176"
    },
    {
      "id": "item-141"
    },
    {
      "id": "item-967"
    }
  ],
  "numberNextRecommsCalls": 0
}
```

---

400

count is not a positive integer.

---

404

contextSegmentId not found in the context segmentation

---

post

#### Recommend Next Items

Allowed on Client-Side

Returns items that shall be shown to a user as next recommendations when the user e.g. scrolls the page down (_infinite scroll_) or goes to the next page.

It accepts `recommId` of a base recommendation request (e.g., request from the first page) and the number of items that shall be returned (`count`). The base request can be one of:

* [Recommend Items to Item](https://docs.recombee.com/api#recommend-items-to-item)
* [Recommend Items to User](https://docs.recombee.com/api#recommend-items-to-user)
* [Recommend Items to Item Segment](https://docs.recombee.com/api#recommend-items-to-item-segment)
* [Search Items](https://docs.recombee.com/api#search-items)

All the other parameters are inherited from the base request.

_Recommend next items_ can be called many times for a single `recommId` and each call returns different (previously not recommended) items. The number of _Recommend next items_ calls performed so far is returned in the `numberNextRecommsCalls` field.

_Recommend next items_ can be requested up to 30 minutes after the base request or a previous _Recommend next items_ call.

For billing purposes, each call to _Recommend next items_ is counted as a separate recommendation request.

It is also possible to use GET HTTP method - body parameters then become query parameters.

```js
const result = await client.send(new recombee.RecommendNextItems(recommId, count));
```

---

Since version

3.1.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **3.1.0**

ID of your database.

---

recommId

String

Located in: **path**

Required: **Yes**

Since version: **3.1.0**

ID of the base recommendation request for which next recommendations should be returned

---

count

Integer

Located in: **body**

Required: **Yes**

Since version: **3.1.0**

Number of items to be recommended

---

##### Responses

200

Successful operation.

```
{
  "recommId": "768448ea-10b3-4028-bb76-4b2f95121d19",
  "recomms": [
    {
      "id": "item-176"
    },
    {
      "id": "item-141"
    },
    {
      "id": "item-967"
    }
  ],
  "numberNextRecommsCalls": 4
}
```

---

400

Parameter `count` is not given or is not a positive integer. Parameter `recommId` is not an UUID.

---

404

Base request with the given `recommId` does not exist or has expired.

---

### Recommending Item Segments

Recommendation endpoints that return the [Item Segments](https://docs.recombee.com/segmentations) (categories, genres, artists, etc.).

post

#### Recommend Item Segments to User

Allowed on Client-Side

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 GET HTTP method - body parameters then become query parameters.

```js
const result = await client.send(new recombee.RecommendItemSegmentsToUser(userId, count, {
  // optional parameters:
  scenario: 'homepage',                                              // string
  cascadeCreate: true,                                               // boolean
  filter: '\'segmentId\' != "coupons"',                              // string
  booster: 'if \'segmentId\' == "Editors Pick" then 2 else 1',       // string
  logic: 'recombee:default',                                         // string / Object
  reqlExpressions: {
    countItems: 'size(segment_items("categories", \'segmentId\'))',
  },                                                                 // Object
}));
```

---

Since version

4.1.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of your database.

---

userId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of the user for whom personalized recommendations are to be generated.

---

count

Integer

Located in: **body**

Required: **Yes**

Since version: **4.1.0**

Number of item segments to be recommended (N for the top-N recommendation).

---

scenario

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

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

Located in: **body**

Required: **No**

Since version: **4.1.0**

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

Located in: **body**

Required: **No**

Since version: **4.1.0**

Boolean-returning [ReQL](https://docs.recombee.com/reql) expression which allows you to filter recommended segments based on the `segmentationId`.

---

booster

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

Number-returning [ReQL](https://docs.recombee.com/reql) expression which allows you to boost recommendation rate of some segments based on the `segmentationId`.

---

logic

String

Object

Located in: **body**

Required: **No**

Since version: **4.1.0**

Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case. See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.

The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.

Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

reqlExpressions

Object

Located in: **body**

Required: **No**

Since version: **6.1.0**

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:

```
{
  "reqlExpressions": {
    "countItems": "size(segment_items(\"categories\", 'segmentId'))"
  }
}
```

Example response:

```
{
  "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
  "recomms": 
    [
      {
        "id": "category-fantasy-books",
        "reqlEvaluations": {
          "countItems": 486
        }
      },
      {
        "id": "category-sci-fi-costumes",
        "reqlEvaluations": {
          "countItems": 19
        }
      }
    ],
   "numberNextRecommsCalls": 0
}
```

---

##### Responses

200

successful operation

```
{
  "recommId": "5fbd94fa-2553-422c-bdb5-af82687d8c6a",
  "recomms": [
    {
      "id": "category-rap"
    },
    {
      "id": "category-dnb"
    },
    {
      "id": "category-electronic"
    }
  ],
  "numberNextRecommsCalls": 0
}
```

---

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

---

post

#### Recommend Item Segments to Item

Allowed on Client-Side

Recommends Segments from a [Segmentation](https://docs.recombee.com/segmentations) that are the most relevant to a particular item.

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

* Recommending the related categories
* Recommending the related genres
* Recommending the related brands
* Recommending the related artists

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 GET HTTP method - body parameters then become query parameters.

```js
const result = await client.send(new recombee.RecommendItemSegmentsToItem(itemId, targetUserId, count, {
  // optional parameters:
  scenario: 'homepage',                                              // string
  cascadeCreate: true,                                               // boolean
  filter: '\'segmentId\' != "coupons"',                              // string
  booster: 'if \'segmentId\' == "Editors Pick" then 2 else 1',       // string
  logic: 'recombee:default',                                         // string / Object
  reqlExpressions: {
    countItems: 'size(segment_items("categories", \'segmentId\'))',
  },                                                                 // Object
}));
```

---

Since version

4.1.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of your database.

---

itemId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of the item for which the recommendations are to be generated.

---

targetUserId

String

Located in: **body**

Required: **Yes**

Since version: **4.1.0**

ID of the user who will see the recommendations.

Specifying the _targetUserId_ is beneficial because:

* It makes the recommendations personalized
* Allows the calculation of Actions and Conversions in the graphical user interface, as Recombee can pair the user who got recommendations and who afterward viewed/purchased an item.

If you insist on not specifying the user, pass `null`(`None`, `nil`, `NULL` etc., depending on the language) to _targetUserId_. Do not create some special dummy user for getting recommendations, as it could mislead the recommendation models, and result in wrong recommendations.

For anonymous/unregistered users, it is possible to use, for example, their session ID.

---

count

Integer

Located in: **body**

Required: **Yes**

Since version: **4.1.0**

Number of item segments to be recommended (N for the top-N recommendation).

---

scenario

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

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

Located in: **body**

Required: **No**

Since version: **4.1.0**

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

Located in: **body**

Required: **No**

Since version: **4.1.0**

Boolean-returning [ReQL](https://docs.recombee.com/reql) expression which allows you to filter recommended segments based on the `segmentationId`.

---

booster

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

Number-returning [ReQL](https://docs.recombee.com/reql) expression which allows you to boost recommendation rate of some segments based on the `segmentationId`.

---

logic

String

Object

Located in: **body**

Required: **No**

Since version: **4.1.0**

Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case. See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.

The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.

Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

reqlExpressions

Object

Located in: **body**

Required: **No**

Since version: **6.1.0**

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:

```
{
  "reqlExpressions": {
    "countItems": "size(segment_items(\"categories\", 'segmentId'))"
  }
}
```

Example response:

```
{
  "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
  "recomms": 
    [
      {
        "id": "category-fantasy-books",
        "reqlEvaluations": {
          "countItems": 486
        }
      },
      {
        "id": "category-sci-fi-costumes",
        "reqlEvaluations": {
          "countItems": 19
        }
      }
    ],
   "numberNextRecommsCalls": 0
}
```

---

##### Responses

200

successful operation

```
{
  "recommId": "5fbd94fa-2553-422c-bdb5-af82687d8c6a",
  "recomms": [
    {
      "id": "category-rap"
    },
    {
      "id": "category-dnb"
    },
    {
      "id": "category-electronic"
    }
  ],
  "numberNextRecommsCalls": 0
}
```

---

400

Used Segmentation not configured for the scenario. itemId does not match ^\[a-zA-Z0-9\_-:@.\]+$, count is not a positive integer.

---

404

itemId not found in the database and cascadeCreate is false

---

post

#### Recommend Item Segments to Item Segment

Allowed on Client-Side

Recommends Segments from a result [Segmentation](https://docs.recombee.com/segmentations) that are the most relevant to a particular Segment from a context Segmentation.

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

* Recommending the related brands to particular brand
* Recommending the related brands to particular category
* Recommending the related artists to a particular genre (assuming songs are the Items)

You need to set the used context and result 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 GET HTTP method - body parameters then become query parameters.

```js
const result = await client.send(new recombee.RecommendItemSegmentsToItemSegment(contextSegmentId, targetUserId, count, {
  // optional parameters:
  scenario: 'homepage',                                              // string
  cascadeCreate: true,                                               // boolean
  filter: '\'segmentId\' != "coupons"',                              // string
  booster: 'if \'segmentId\' == "Editors Pick" then 2 else 1',       // string
  logic: 'recombee:default',                                         // string / Object
  reqlExpressions: {
    countItems: 'size(segment_items("categories", \'segmentId\'))',
  },                                                                 // Object
}));
```

---

Since version

4.1.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of your database.

---

contextSegmentId

String

Located in: **body**

Required: **Yes**

Since version: **4.1.0**

ID of the segment from `contextSegmentationId` for which the recommendations are to be generated.

---

targetUserId

String

Located in: **body**

Required: **Yes**

Since version: **4.1.0**

ID of the user who will see the recommendations.

Specifying the _targetUserId_ is beneficial because:

* It makes the recommendations personalized
* Allows the calculation of Actions and Conversions in the graphical user interface, as Recombee can pair the user who got recommendations and who afterward viewed/purchased an item.

If you insist on not specifying the user, pass `null`(`None`, `nil`, `NULL` etc., depending on the language) to _targetUserId_. Do not create some special dummy user for getting recommendations, as it could mislead the recommendation models, and result in wrong recommendations.

For anonymous/unregistered users, it is possible to use, for example, their session ID.

---

count

Integer

Located in: **body**

Required: **Yes**

Since version: **4.1.0**

Number of item segments to be recommended (N for the top-N recommendation).

---

scenario

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

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

Located in: **body**

Required: **No**

Since version: **4.1.0**

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

Located in: **body**

Required: **No**

Since version: **4.1.0**

Boolean-returning [ReQL](https://docs.recombee.com/reql) expression which allows you to filter recommended segments based on the `segmentationId`.

---

booster

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

Number-returning [ReQL](https://docs.recombee.com/reql) expression which allows you to boost recommendation rate of some segments based on the `segmentationId`.

---

logic

String

Object

Located in: **body**

Required: **No**

Since version: **4.1.0**

Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case. See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.

The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.

Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

reqlExpressions

Object

Located in: **body**

Required: **No**

Since version: **6.1.0**

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:

```
{
  "reqlExpressions": {
    "countItems": "size(segment_items(\"categories\", 'segmentId'))"
  }
}
```

Example response:

```
{
  "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
  "recomms": 
    [
      {
        "id": "category-fantasy-books",
        "reqlEvaluations": {
          "countItems": 486
        }
      },
      {
        "id": "category-sci-fi-costumes",
        "reqlEvaluations": {
          "countItems": 19
        }
      }
    ],
   "numberNextRecommsCalls": 0
}
```

---

##### Responses

200

successful operation

```
{
  "recommId": "5fbd94fa-2553-422c-bdb5-af82687d8c6a",
  "recomms": [
    {
      "id": "category-rap"
    },
    {
      "id": "category-dnb"
    },
    {
      "id": "category-electronic"
    }
  ],
  "numberNextRecommsCalls": 0
}
```

---

400

count is not a positive integer.

---

404

contextSegmentId not found in the context segmentation

---

post

#### Recommend Next Item Segments

Allowed on Client-Side

Returns [Item Segments](https://docs.recombee.com/segmentations) to be shown as the next recommendations when a user scrolls (e.g., within a carousel or feed of Item Segments such as brands, artists, topics, or categories).

The request requires the `recommId` of a base recommendation request and the number of Segments to return (`count`).

The base request can be one of:

* [Recommend Item Segments to Item](https://docs.recombee.com/api#recommend-item-segments-to-item)
* [Recommend Item Segments to User](https://docs.recombee.com/api#recommend-item-segments-to-user)
* [Recommend Item Segments to Item Segment](https://docs.recombee.com/api#recommend-item-segments-to-item-segment)
* [Search Item Segments](https://docs.recombee.com/api#search-item-segments)

All other parameters are inherited from the base request associated with the provided `recommId`.

This endpoint can be called multiple times for a single `recommId`. Each call returns different Item Segments that have not been recommended in previous calls. The number of calls made so far is returned in the `numberNextRecommsCalls` field.

Requests can be made up to 30 minutes after the base request or the most recent Recommend Next Item Segments call.

For billing purposes, each call to this endpoint is counted as a separate recommendation request.

It is also possible to use GET HTTP method - body parameters then become query parameters.

```js
const result = await client.send(new recombee.RecommendNextItemSegments(recommId, count));
```

---

Since version

6.2.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **6.2.0**

ID of your database.

---

recommId

String

Located in: **path**

Required: **Yes**

Since version: **6.2.0**

ID of the base recommendation request for which next recommendations should be returned

---

count

Integer

Located in: **body**

Required: **Yes**

Since version: **6.2.0**

Number of item segments to be recommended

---

##### Responses

200

Successful operation.

```
{
  "recommId": "768448ea-10b3-4028-bb76-4b2f95121d19",
  "recomms": [
    {
      "id": "Comedy"
    },
    {
      "id": "Drama"
    },
    {
      "id": "Action"
    }
  ],
  "numberNextRecommsCalls": 4
}
```

---

400

Parameter `count` is not given or is not a positive integer. Parameter `recommId` is not an UUID.

---

404

Base request with the given `recommId` does not exist or has expired.

---

### Recommending Users

Recommendation endpoints that return the Users.

post

#### Recommend Users to User

Gets users similar to the given user, based on the user's past interactions (purchases, ratings, etc.) and values of properties.

It is also possible to use GET HTTP method - body parameters then become query parameters.

The returned users are sorted by similarity (the first user being the most similar).

```js
const result = await client.send(new requests.RecommendUsersToUser(userId, count, {
  // optional parameters:
  scenario: 'homepage',                                                // string
  cascadeCreate: true,                                                 // boolean
  returnProperties: true,                                              // boolean
  includedProperties: ['username', 'country'],                         // array
  filter: '\'country\' == "US"',                                       // string
  booster: 'if \'country\' == context_user["country"] then 2 else 1',  // string
  logic: 'recombee:default',                                           // string / Object
  reqlExpressions: {
    isInUsersCity: 'context_user["city"] in \'cities\'',
  },                                                                   // Object
  rotationRate: 0.1,                                                   // number
  rotationTime: 7200.0,                                                // number
}));
```

---

Since version

2.0.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **2.0.0**

ID of your database.

---

userId

String

Located in: **path**

Required: **Yes**

Since version: **2.0.0**

User to whom we find similar users

---

count

Integer

Located in: **body**

Required: **Yes**

Since version: **2.0.0**

Number of users to be recommended (N for the top-N recommendation).

---

scenario

String

Located in: **body**

Required: **No**

Since version: **2.0.0**

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

Located in: **body**

Required: **No**

Since version: **2.0.0**

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.

---

returnProperties

Boolean

Located in: **body**

Required: **No**

Since version: **2.0.0**

With `returnProperties=true`, property values of the recommended users are returned along with their IDs in a JSON dictionary. The acquired property values can be used to easily display the recommended users.

Example response:

```
  {
    "recommId": "9cb9c55d-50ba-4478-84fd-ab456136156e",
    "recomms":
      [
        {
          "id": "user-17",
          "values": {
            "country": "US",
            "sex": "F"
          }
        },
        {
          "id": "user-2",
          "values": {
            "country": "CAN",
            "sex": "M"
          }
        }
      ],
    "numberNextRecommsCalls": 0
  }
```

---

includedProperties

Array

Located in: **body**

Required: **No**

Since version: **2.0.0**

Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.

Example response for `includedProperties=country`:

```
  {
    "recommId": "b326d82d-5d57-4b45-b362-c9d6f0895855",
    "recomms":
      [
        {
          "id": "user-17",
          "values": {
            "country": "US"
          }
        },
        {
          "id": "user-2",
          "values": {
            "country": "CAN"
          }
        }
      ],
    "numberNextRecommsCalls": 0
  }
```

---

filter

String

Located in: **body**

Required: **No**

Since version: **2.0.0**

Boolean-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to filter recommended users based on the values of their attributes.

Filters can also be assigned to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

booster

String

Located in: **body**

Required: **No**

Since version: **2.0.0**

Number-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to boost the recommendation rate of some users based on the values of their attributes.

Boosters can also be assigned to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

logic

String

Object

Located in: **body**

Required: **No**

Since version: **2.4.0**

Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case. See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.

The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.

Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

reqlExpressions

Object

Located in: **body**

Required: **No**

Since version: **6.0.0**

A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended user. This can be used to compute additional properties of the recommended users that are not stored in the database.

The keys are the names of the expressions, and the values are the actual ReQL expressions.

Example request:

```
{
  "reqlExpressions": {
    "isInUsersCity": "context_user[\"city\"] in 'cities'",
    "distanceToUser": "earth_distance('location', context_user[\"location\"])"
  }
}
```

Example response:

```
{
  "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
  "recomms": 
    [
      {
        "id": "restaurant-178",
        "reqlEvaluations": {
          "isInUsersCity": true,
          "distanceToUser": 5200.2
        }
      },
      {
        "id": "bar-42",
        "reqlEvaluations": {
          "isInUsersCity": false,
          "distanceToUser": 2516.0
        }
      }
    ],
   "numberNextRecommsCalls": 0
}
```

---

rotationRate

Number

Located in: **body**

Required: **No**

Since version: **5.0.0**

**Expert option:** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per request in a backward fashion. You may penalize a user for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example, `rotationRate=0.2` for only slight rotation of recommended users.

---

rotationTime

Number

Located in: **body**

Required: **No**

Since version: **5.0.0**

**Expert option:** Taking _rotationRate_ into account, specifies how long it takes for a user to recover from the penalization. For example, `rotationTime=7200.0` means that users recommended less than 2 hours ago are penalized.

---

##### Responses

200

Successful operation.

```
{
  "recommId": "f88d970d-561c-460f-b4d4-faf0478244ca",
  "recomms": [
    {
      "id": "user-64"
    },
    {
      "id": "user-42"
    },
    {
      "id": "user-23"
    }
  ],
  "numberNextRecommsCalls": 0
}
```

---

400

userId does not match ^\[a-zA-Z0-9\_-:@.\]+$, count is not a positive integer, filter or booster is not valid [ReQL](https://docs.recombee.com/reql) expressions, filter expression does not return boolean, booster does not return double or integer.

---

404

userId not found in the database and cascadeCreate is false. If there is no additional info in the JSON response, you probably have an error in your URL.

---

post

#### Recommend Users to Item

Recommends users that are likely to be interested in the given item.

It is also possible to use GET HTTP method - body parameters then become query parameters.

The returned users are sorted by predicted interest in the item (the first user being the most interested).

```js
const result = await client.send(new requests.RecommendUsersToItem(itemId, count, {
  // optional parameters:
  scenario: 'homepage',                                                // string
  cascadeCreate: true,                                                 // boolean
  returnProperties: true,                                              // boolean
  includedProperties: ['username', 'country'],                         // array
  filter: '\'country\' == "US"',                                       // string
  booster: 'if \'country\' == context_user["country"] then 2 else 1',  // string
  logic: 'recombee:default',                                           // string / Object
  reqlExpressions: {
    isInUsersCity: 'context_user["city"] in \'cities\'',
  },                                                                   // Object
}));
```

---

Since version

2.0.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **2.0.0**

ID of your database.

---

itemId

String

Located in: **path**

Required: **Yes**

Since version: **2.0.0**

ID of the item for which the recommendations are to be generated.

---

count

Integer

Located in: **body**

Required: **Yes**

Since version: **2.0.0**

Number of users to be recommended (N for the top-N recommendation).

---

scenario

String

Located in: **body**

Required: **No**

Since version: **2.0.0**

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

Located in: **body**

Required: **No**

Since version: **2.0.0**

If an item of the given _itemId_ doesn't exist in the database, it creates the missing item.

---

returnProperties

Boolean

Located in: **body**

Required: **No**

Since version: **2.0.0**

With `returnProperties=true`, property values of the recommended users are returned along with their IDs in a JSON dictionary. The acquired property values can be used to easily display the recommended users.

Example response:

```
  {
    "recommId": "039b71dc-b9cc-4645-a84f-62b841eecfce",
    "recomms":
      [
        {
          "id": "user-17",
          "values": {
            "country": "US",
            "sex": "F"
          }
        },
        {
          "id": "user-2",
          "values": {
            "country": "CAN",
            "sex": "M"
          }
        }
      ],
    "numberNextRecommsCalls": 0
  }
```

---

includedProperties

Array

Located in: **body**

Required: **No**

Since version: **2.0.0**

Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.

Example response for `includedProperties=country`:

```
  {
    "recommId": "b2b355dd-972a-4728-9c6b-2dc229db0678",
    "recomms":
      [
        {
          "id": "user-17",
          "values": {
            "country": "US"
          }
        },
        {
          "id": "user-2",
          "values": {
            "country": "CAN"
          }
        }
      ],
    "numberNextRecommsCalls": 0
  }
```

---

filter

String

Located in: **body**

Required: **No**

Since version: **2.0.0**

Boolean-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to filter recommended users based on the values of their attributes.

Filters can also be assigned to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

booster

String

Located in: **body**

Required: **No**

Since version: **2.0.0**

Number-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to boost the recommendation rate of some users based on the values of their attributes.

Boosters can also be assigned to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

logic

String

Object

Located in: **body**

Required: **No**

Since version: **2.4.0**

Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case. See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.

The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.

Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

reqlExpressions

Object

Located in: **body**

Required: **No**

Since version: **6.0.0**

A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended user. This can be used to compute additional properties of the recommended users that are not stored in the database.

The keys are the names of the expressions, and the values are the actual ReQL expressions.

Example request:

```
{
  "reqlExpressions": {
    "isInUsersCity": "context_user[\"city\"] in 'cities'",
    "distanceToUser": "earth_distance('location', context_user[\"location\"])",
    "isFromSameCompany": "'company' == context_item[\"company\"]"
  }
}
```

Example response:

```
{
  "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
  "recomms": 
    [
      {
        "id": "restaurant-178",
        "reqlEvaluations": {
          "isInUsersCity": true,
          "distanceToUser": 5200.2,
          "isFromSameCompany": false
        }
      },
      {
        "id": "bar-42",
        "reqlEvaluations": {
          "isInUsersCity": false,
          "distanceToUser": 2516.0,
          "isFromSameCompany": true
        }
      }
    ],
   "numberNextRecommsCalls": 0
}
```

---

##### Responses

200

Successful operation.

```
{
  "recommId": "ee94fa8b-efe7-4b35-abc6-2bc3456d66ed",
  "recomms": [
    {
      "id": "user-64"
    },
    {
      "id": "user-42"
    },
    {
      "id": "user-23"
    }
  ],
  "numberNextRecommsCalls": 0
}
```

---

400

itemId does not match ^\[a-zA-Z0-9\_-:@.\]+$, count is not a positive integer, filter or booster is not valid [ReQL](https://docs.recombee.com/reql) expressions, filter expression does not return boolean, booster does not return double or integer.

---

404

itemId not found in the database and cascadeCreate is false. If there is no additional info in the JSON response, you probably have an error in your URL.

---

### Composite Recommendations

Composite Recommendations return a source entity (e.g., an Item, or [Item Segment](https://docs.recombee.com/segmentations)) and a list of related recommendations in a single response, enabling multi-layered, highly personalized suggestions, such as _Because You Watched …_ in streaming services or _Top Products from Your Favorite Brand …_ in e-commerce.

post

#### Composite Recommendation

Allowed on Client-Side

Composite Recommendation returns both a _source entity_ (e.g., an Item or [Item Segment](https://docs.recombee.com/segmentations)) and a list of related recommendations in a single response.

It is ideal for use cases such as personalized homepage sections (_Articles from <category>_), _Because You Watched <movie>_, or _Artists Related to Your Favorite Artist <artist>_.

See detailed **examples and configuration guidance** in the [Composite Scenarios documentation](https://docs.recombee.com/scenarios#composite-recommendations).

**Structure**

The endpoint operates in two stages:

1. Recommends the _source_ (e.g., an Item Segment or item) to the user.
2. Recommends _results_ (items or Item Segments) related to that _source_.

For example, _Articles from <category>_ can be decomposed into:

* [Recommend Item Segments To User](https://docs.recombee.com/api#recommend-item-segments-to-user) to find the category.
* [Recommend Items To Item Segment](https://docs.recombee.com/api#recommend-items-to-item-segment) to recommend articles from that category.

Since the first step uses [Recommend Item Segments To User](https://docs.recombee.com/api#recommend-items-to-user), you must include the `userId` parameter in the _Composite Recommendation_ request.

Each _Composite Recommendation_ counts as a single recommendation API request for billing.

**Stage-specific Parameters**

Additional parameters can be supplied via [sourceSettings](https://docs.recombee.com/api#composite-recommendation-param-sourceSettings) and [resultSettings](https://docs.recombee.com/api#composite-recommendation-param-resultSettings). In the example above:

* `sourceSettings` may include any parameter valid for [Recommend Item Segments To User](https://docs.recombee.com/api#recommend-items-to-user) (e.g., `filter`, `booster`).
* `resultSettings` may include any parameter valid for [Recommend Items To Item Segment](https://docs.recombee.com/api#recommend-items-to-item-segment).

See [this example](https://docs.recombee.com/api#composite-recommendation-example-setting-parameters-for-individual-stages) for more details.

```js
const result = await client.send(new recombee.CompositeRecommendation(scenario, count, {
  // optional parameters:
  itemId: 'item-1',                                                        // string
  userId: 'user-1',                                                        // string
  logic: 'recombee:items-from-top-segment-for-you',                        // string / Object
  segmentId: 'segment-1',                                                  // string
  searchQuery: 'shoes',                                                    // string
  cascadeCreate: true,                                                     // boolean
  sourceSettings: {
    returnProperties: true,                                                // boolean
    includedProperties: ['title', 'price', 'publishedAt'],                 // array
    filter: 'price > 50',                                                  // string
    booster: 'if now() - \'publishedAt\' <= 7 * 24 * 3600 then 2 else 1',  // string
    logic: 'recombee:default',                                             // string / Object
    reqlExpressions: {
      isInUsersCity: 'context_user["city"] in \'cities\'',
    },                                                                     // Object
    minRelevance: 'low',                                                   // string
    rotationRate: 0.1,                                                     // number
    rotationTime: 7200.0,                                                  // number
  },
  resultSettings: {
    returnProperties: true,                                                // boolean
    includedProperties: ['title', 'price', 'publishedAt'],                 // array
    filter: 'price > 50',                                                  // string
    booster: 'if now() - \'publishedAt\' <= 7 * 24 * 3600 then 2 else 1',  // string
    logic: 'recombee:default',                                             // string / Object
    reqlExpressions: {
      isInUsersCity: 'context_user["city"] in \'cities\'',
    },                                                                     // Object
    minRelevance: 'low',                                                   // string
    rotationRate: 0.1,                                                     // number
    rotationTime: 7200.0,                                                  // number
  },
}));
```

---

Since version

6.0.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **6.0.0**

ID of your database.

---

scenario

String

Located in: **body**

Required: **Yes**

Since version: **6.0.0**

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.

---

count

Integer

Located in: **body**

Required: **Yes**

Since version: **6.0.0**

Number of items to be recommended (N for the top-N recommendation).

---

itemId

String

Located in: **body**

Required: **No**

Since version: **6.0.0**

ID of the item for which the recommendations are to be generated.

---

userId

String

Located in: **body**

Required: **No**

Since version: **6.0.0**

ID of the user for which the recommendations are to be generated.

---

logic

String

Object

Located in: **body**

Required: **No**

Since version: **6.0.0**

Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case. See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.

The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.

Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

segmentId

String

Located in: **body**

Required: **No**

Since version: **6.0.0**

ID of the segment from `contextSegmentationId` for which the recommendations are to be generated.

---

searchQuery

String

Located in: **body**

Required: **No**

Since version: **6.2.0**

Search query provided by the user. It is used for the full-text search. Only applicable if the _scenario_ corresponds to a search scenario.

---

cascadeCreate

Boolean

Located in: **body**

Required: **No**

Since version: **6.0.0**

If the entity for the source recommendation 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 entity, as the entity will be already known to the system.

---

sourceSettings

Object

Located in: **body**

Required: **No**

Since version: **6.0.0**

Parameters applied for recommending the _Source_ stage. The accepted parameters correspond with the recommendation sub-endpoint used to recommend the _Source_.

---

resultSettings

Object

Located in: **body**

Required: **No**

Since version: **6.0.0**

Parameters applied for recommending the _Result_ stage. The accepted parameters correspond with the recommendation sub-endpoint used to recommend the _Result_.

---

##### Responses

200

Successful operation.

```
{
  "recommId": "ee94fa8b-efe7-4b35-abc6-2bc3456d66ed",
  "source": {
    "id": "category-4"
  },
  "recomms": [
    {
      "id": "item-64"
    },
    {
      "id": "item-42"
    },
    {
      "id": "item-23"
    }
  ],
  "numberNextRecommsCalls": 0
}
```

---

400

Count is not a positive integer, provided scenario not found.

---

404

contextSegmentId not found in the context segmentation, userId not found in the database and cascadeCreate is false, itemId not found in the database and cascadeCreate is false.

---

##### Examples

###### Example Category Sections With Reordering

Suppose you want to recommend three category sections on the homepage, but in a personalized order for each user.  
For example, in a news domain, one user might see _Politics–Culture–Technology_, while another might get _Sport–Technology–Politics_.

You can achieve this by calling three Composite Recommendations within a single [Batch](https://docs.recombee.com/api#batch) request — retrieving both the personalized categories and the recommended items within each.

The Batch ensures that three distinct categories are returned in the results.

Example response:

```
[
  {
    "code": 200,
    "json": {
      "recommId": "c8f25d2a-5c39-4c45-b42b-6a7d4e6b1c52",
      "source": { "id": "category-sport" },
      "recomms": [
        { "id": "article-1024" },
        { "id": "article-2031" },
        { "id": "article-3042" }
      ],
      "numberNextRecommsCalls": 0
    }
  },
  {
    "code": 200,
    "json": {
      "recommId": "b31f16e2-f4e9-43e8-b22f-9da78a5e8e33",
      "source": { "id": "category-technology" },
      "recomms": [
        { "id": "article-501" },
        { "id": "article-507" },
        { "id": "article-519" }
      ],
      "numberNextRecommsCalls": 0
    }
  },
  {
    "code": 200,
    "json": {
      "recommId": "3f6ad2f2-a3f1-4ba1-a690-f4f01f76d4eb",
      "source": { "id": "category-politics" },
      "recomms": [
        { "id": "article-146" },
        { "id": "article-462" },
        { "id": "article-463" }
      ],
      "numberNextRecommsCalls": 0
    }
  }
]
```

Requesting recommendations:

```js
const batchRequest = new recombee.Batch([
  new recombee.CompositeRecommendation('homepage-category-section', 6, { userId: userId }),
  new recombee.CompositeRecommendation('homepage-category-section', 6, { userId: userId }),
  new recombee.CompositeRecommendation('homepage-category-section', 6, { userId: userId })
], {
  distinctRecomms: true
});

const responses = await client.send(batchRequest);
```

---

###### Example Setting Parameters For Individual Stages

This example shows how to use parameters on both stages:

* In `sourceSettings`, we enable rotation so the _source_ changes over time for the same user.
* In `resultSettings`, we filter out promotions and return basic properties for rendering.

Example response (truncated) with `returnProperties=true` on results:

```
{
  "recommId": "7b8d0f5e-42a4-4a71-b2b7-25f9c0cc0e9a",
  "source": { "id": "article-389" },
  "recomms": [
    {
      "id": "article-1024",
      "values": { "title": "5 Books That Will Change How You Think", "url": "newsportal.com/a/1024" }
    },
    {
      "id": "article-2031",
      "values": { "title": "The Psychology of Habit Formation", "url": "newsportal.com/a/2031" }
    }
  ],
  "numberNextRecommsCalls": 0
}
```

Requesting recommendations:

```js
const req = new recombee.CompositeRecommendation(
  'because-you-read',
  10,
  {
    userId: userId,
    sourceSettings: {
      rotationRate: 0.5,
      rotationTime: 7200
    },
    resultSettings: {
      filter: "'type' != \"promotion\"",
      returnProperties: true,
      includedProperties: ['title', 'url']
    }
  }
);

const response = await client.send(req);
```

## Search

Full-text personalized search. The results are based on the full-text matching of a search query and the preferences of a particular user.

post

#### Search Items

Allowed on Client-Side

Full-text personalized search. The results are based on the provided `searchQuery` and also on the user's past interactions (purchases, ratings, etc.) with the items (items more suitable for the user are preferred in the results).

All the string and set item properties are indexed by the search engine.

This endpoint should be used in a search box on your website/app. It can be called multiple times as the user is typing the query in order to get the most viable suggestions based on the current state of the query, or once after submitting the whole query.

The returned items are sorted by relevance (the first item being the most relevant).

Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to:

* Let Recombee know that this search was successful (e.g., user clicked one of the recommended items). See [Reported metrics](https://docs.recombee.com/admin_ui#reported-metrics).
* Get subsequent search results when the user scrolls down or goes to the next page. See [Recommend Next Items](https://docs.recombee.com/api#recommend-next-items).

It is also possible to use GET HTTP method - body parameters then become query parameters.

```js
const result = await client.send(new recombee.SearchItems(userId, searchQuery, count, {
  // optional parameters:
  scenario: 'search-bar',                                                // string
  cascadeCreate: true,                                                   // boolean
  returnProperties: true,                                                // boolean
  includedProperties: ['title', 'price', 'publishedAt'],                 // array
  filter: 'price > 50',                                                  // string
  booster: 'if now() - \'publishedAt\' <= 7 * 24 * 3600 then 2 else 1',  // string
  logic: 'search:personalized',                                          // string / Object
  reqlExpressions: {
    isInUsersCity: 'context_user["city"] in \'cities\'',
  },                                                                     // Object
}));
```

---

Since version

3.0.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **3.0.0**

ID of your database.

---

userId

String

Located in: **path**

Required: **Yes**

Since version: **3.0.0**

ID of the user for whom personalized search will be performed.

---

searchQuery

String

Located in: **body**

Required: **Yes**

Since version: **3.0.0**

Search query provided by the user. It is used for the full-text search.

---

count

Integer

Located in: **body**

Required: **Yes**

Since version: **3.0.0**

Number of items to be returned (N for the top-N results).

---

scenario

String

Located in: **body**

Required: **No**

Since version: **3.0.0**

Scenario defines a particular search field in your user interface.

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 field 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

Located in: **body**

Required: **No**

Since version: **3.0.0**

If the user does not exist in the database, returns a list of non-personalized search results 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.

---

returnProperties

Boolean

Located in: **body**

Required: **No**

Since version: **3.0.0**

With `returnProperties=true`, property values of the recommended items are returned along with their IDs in a JSON dictionary. The acquired property values can be used to easily display the recommended items to the user.

Example response:

```
  {
    "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
    "recomms":
      [
        {
          "id": "tv-178",
          "values": {
            "description": "4K TV with 3D feature",
            "categories":   ["Electronics", "Televisions"],
            "price": 342,
            "url": "myshop.com/tv-178"
          }
        },
        {
          "id": "mixer-42",
          "values": {
            "description": "Stainless Steel Mixer",
            "categories":   ["Home & Kitchen"],
            "price": 39,
            "url": "myshop.com/mixer-42"
          }
        }
      ],
    "numberNextRecommsCalls": 0
  }
```

---

includedProperties

Array

Located in: **body**

Required: **No**

Since version: **3.0.0**

Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.

Example response for `includedProperties=description,price`:

```
  {
    "recommId": "a86ee8d5-cd8e-46d1-886c-8b3771d0520b",
    "recomms":
      [
        {
          "id": "tv-178",
          "values": {
            "description": "4K TV with 3D feature",
            "price": 342
          }
        },
        {
          "id": "mixer-42",
          "values": {
            "description": "Stainless Steel Mixer",
            "price": 39
          }
        }
      ],
    "numberNextRecommsCalls": 0
  }
```

---

filter

String

Located in: **body**

Required: **No**

Since version: **2.0.0**

Boolean-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to filter recommended items based on the values of their attributes.

Filters can also be assigned to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

booster

String

Located in: **body**

Required: **No**

Since version: **2.0.0**

Number-returning [ReQL](https://docs.recombee.com/reql) expression, which allows you to boost the recommendation rate of some items based on the values of their attributes.

Boosters can also be assigned to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

logic

String

Object

Located in: **body**

Required: **No**

Since version: **2.4.0**

Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case. See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.

The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.

Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

reqlExpressions

Object

Located in: **body**

Required: **No**

Since version: **6.0.0**

A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended item. This can be used to compute additional properties of the recommended items that are not stored in the database.

The keys are the names of the expressions, and the values are the actual ReQL expressions.

Example request:

```
{
  "reqlExpressions": {
    "isInUsersCity": "context_user[\"city\"] in 'cities'",
    "distanceToUser": "earth_distance('location', context_user[\"location\"])"
  }
}
```

Example response:

```
{
  "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
  "recomms": 
    [
      {
        "id": "restaurant-178",
        "reqlEvaluations": {
          "isInUsersCity": true,
          "distanceToUser": 5200.2
        }
      },
      {
        "id": "bar-42",
        "reqlEvaluations": {
          "isInUsersCity": false,
          "distanceToUser": 2516.0
        }
      }
    ],
   "numberNextRecommsCalls": 0
}
```

---

##### Responses

200

Successful operation.

```
{
  "recommId": "4fd901fe-4ba1-a3f1-a690-f4f01f76d4eb",
  "recomms": [
    {
      "id": "item-476"
    },
    {
      "id": "item-412"
    },
    {
      "id": "item-773"
    }
  ],
  "numberNextRecommsCalls": 0
}
```

---

400

userId does not match ^\[a-zA-Z0-9\_-:@.\]+$, count is not a positive integer, searchQuery is not provided, filter or booster are not valid [ReQL](https://docs.recombee.com/reql) expressions, filter expression does not return boolean, booster does not return double or integer.

---

404

userId not found in the database and cascadeCreate is false. If there is no additional info in the JSON response, you probably have an error in you URL.

---

post

#### Search Item Segments

Allowed on Client-Side

Full-text personalized search that returns Segments from a Segmentation. The results are based on the provided `searchQuery` and also on the user's past interactions (purchases, ratings, etc.).

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

* Searching within categories or brands
* Searching within genres or artists

For example if the user is searching for "iPhone" this endpoint can return "cell phones" category.

You need to set the used Segmentation the Admin UI in the Scenario settings prior to using this endpoint.

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

It is also possible to use GET HTTP method - body parameters then become query parameters.

```js
const result = await client.send(new recombee.SearchItemSegments(userId, searchQuery, count, {
  // optional parameters:
  scenario: 'homepage',                                              // string
  cascadeCreate: true,                                               // boolean
  filter: '\'segmentId\' != "coupons"',                              // string
  booster: 'if \'segmentId\' == "Editors Pick" then 2 else 1',       // string
  logic: 'search:personalized',                                      // string / Object
  reqlExpressions: {
    countItems: 'size(segment_items("categories", \'segmentId\'))',
  },                                                                 // Object
}));
```

---

Since version

4.1.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of your database.

---

userId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of the user for whom personalized search will be performed.

---

searchQuery

String

Located in: **body**

Required: **Yes**

Since version: **4.1.0**

Search query provided by the user. It is used for the full-text search.

---

count

Integer

Located in: **body**

Required: **Yes**

Since version: **4.1.0**

Number of segments to be returned (N for the top-N results).

---

scenario

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

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

Located in: **body**

Required: **No**

Since version: **4.1.0**

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

Located in: **body**

Required: **No**

Since version: **4.1.0**

Boolean-returning [ReQL](https://docs.recombee.com/reql) expression which allows you to filter recommended segments based on the `segmentationId`.

---

booster

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

Number-returning [ReQL](https://docs.recombee.com/reql) expression which allows you to boost recommendation rate of some segments based on the `segmentationId`.

---

logic

String

Object

Located in: **body**

Required: **No**

Since version: **4.1.0**

Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case. See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.

The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.

Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).

---

reqlExpressions

Object

Located in: **body**

Required: **No**

Since version: **6.1.0**

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:

```
{
  "reqlExpressions": {
    "countItems": "size(segment_items(\"categories\", 'segmentId'))"
  }
}
```

Example response:

```
{
  "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
  "recomms": 
    [
      {
        "id": "category-fantasy-books",
        "reqlEvaluations": {
          "countItems": 486
        }
      },
      {
        "id": "category-sci-fi-costumes",
        "reqlEvaluations": {
          "countItems": 19
        }
      }
    ],
   "numberNextRecommsCalls": 0
}
```

---

##### Responses

200

successful operation

```
{
  "recommId": "7acdc8b5-f731-44f8-b522-72625044666f",
  "recomms": [
    {
      "id": "cell phones"
    },
    {
      "id": "cell phone accessories"
    }
  ],
  "numberNextRecommsCalls": 0
}
```

---

400

userId does not match ^\[a-zA-Z0-9\_-:@.\]+$, count is not a positive integer, searchQuery is not provided, filter or booster is not valid [ReQL](https://docs.recombee.com/reql) expressions, filter expression does not return boolean, booster does not return double or integer.

---

404

userId not found in the database and cascadeCreate is false. If there is no additional info in the JSON response, you probably have an error in your URL.

---

### Synonyms

Define that some words or phrases should be considered equal by the full-text search engine.

post

#### Add Search Synonym

Adds a new synonym for the [Search items](https://docs.recombee.com/api#search-items).

When the `term` is used in the search query, the `synonym` is also used for the full-text search. Unless `oneWay=true`, it works also in the opposite way (`synonym` \-> `term`).

An example of a synonym can be `science fiction` for the term `sci-fi`.

```js
const result = await client.send(new requests.AddSearchSynonym(term, synonym, {
  // optional parameters:
  oneWay: false,  // boolean
}));
```

---

Since version

3.2.0

---

Calls Limit Per Minute

1000

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **3.2.0**

ID of your database.

---

term

String

Located in: **body**

Required: **Yes**

Since version: **3.2.0**

A word to which the `synonym` is specified.

---

synonym

String

Located in: **body**

Required: **Yes**

Since version: **3.2.0**

A word that should be considered equal to the `term` by the full-text search engine.

---

oneWay

Boolean

Located in: **body**

Required: **No**

Since version: **3.2.0**

If set to `true`, only `term` \-> `synonym` is considered. If set to `false`, also `synonym` \-> `term` works.

Default: `false`.

---

##### Responses

201

Successful operation. Returns data about the added synonym (including `id`).

```
{
  "id": "cc198c86-e015-bb74-b5f4-8f996fd26736",
  "term": "sci-fi",
  "synonym": "science fiction",
  "oneWay": false
}
```

---

400

Missing a field, or a field has a wrong type.

---

409

`synonym` and `term` pair already exists in the database. In many cases, you may consider this code a success – it only tells you that nothing has been written to the database.

---

get

#### List Search Synonyms

Gives the list of synonyms defined in the database.

```js
const result = await client.send(new requests.ListSearchSynonyms({
  // optional parameters:
  count: 10,  // integer
  offset: 0,  // integer
}));
```

---

Calls Limit Per Minute

60

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

count

Integer

Located in: **query**

Required: **No**

The number of synonyms to be listed.

---

offset

Integer

Located in: **query**

Required: **No**

Specifies the number of synonyms to skip (ordered by `term`).

---

##### Responses

200

Successful operation.

```
{
  "synonyms": [
    {
      "id": "cc198c86-e015-bb74-b5f4-8f996fd26736",
      "term": "sci-fi",
      "synonym": "science fiction",
      "oneWay": false
    },
    {
      "id": "33bef0e5-f6ee-ac04-8b80-7ba8ece1fe63",
      "term": "sitcom",
      "synonym": "situation comedy",
      "oneWay": false
    }
  ]
}
```

---

delete

#### Delete All Search Synonyms

Deletes all synonyms defined in the database.

```js
client.send(new requests.DeleteAllSearchSynonyms());
```

---

Calls Limit Per Minute

60

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

##### Responses

200

Successful operation.

---

delete

#### Delete Search Synonym

Deletes synonym of the given `id`. This synonym is no longer taken into account in the [Search items](https://docs.recombee.com/api#search-items).

```js
client.send(new requests.DeleteSearchSynonym(id));
```

---

Calls Limit Per Minute

1000

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

id

String

Located in: **path**

Required: **Yes**

ID of the synonym that should be deleted.

---

##### Responses

200

Successful operation.

---

404

Synonym with the given `id` does not exist.

---

## Series

Items in the catalog may be organized into series, expressing an explicit, known ordering of items, if there is any. Typical examples of series may be consecutive TV show episodes, book titles, etc.

Each item may be added to zero or more series, and a series may also be added into another series, resulting in a "meta-series". This may be useful for modeling ordered seasons of a TV show that has the episodes in each season themselves ordered.

### Series definition

Methods for managing series - creating, listing, and deleting them.

put

#### Add Series

Creates a new series in the database.

```js
client.send(new requests.AddSeries(seriesId, {
  // optional parameters:
  cascadeCreate: true,  // boolean
}));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

seriesId

String

Located in: **path**

Required: **Yes**

ID of the series to be created.

---

cascadeCreate

Boolean

Located in: **body**

Required: **No**

If set to `true`, the item will be created with the same ID as the series. Default is `true`.

---

##### Responses

201

Successful operation.

---

400

The `seriesId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

409

Series of the given `seriesId` is already present in the database. In many cases, you may consider this code a success – it only tells you that nothing has been written to the database.

---

delete

#### Delete Series

Deletes the series of the given `seriesId` from the database.

Deleting a series will only delete assignment of items to it, not the items themselves!

```js
client.send(new requests.DeleteSeries(seriesId, {
  // optional parameters:
  cascadeDelete: false,  // boolean
}));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

seriesId

String

Located in: **path**

Required: **Yes**

ID of the series to be deleted.

---

cascadeDelete

Boolean

Located in: **body**

Required: **No**

If set to `true`, item with the same ID as seriesId will be also deleted. Default is `false`.

---

##### Responses

200

Successful operation.

---

400

The `seriesId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

404

Series of the given `seriesId` is not present in the database. In many cases, you may consider this code a success – it only tells you that nothing has been deleted from the database since the series was already not present. If there is no additional info in the JSON response, you probably have an error in your URL.

---

get

#### List Series

Gets the list of all the series currently present in the database.

```js
const result = await client.send(new requests.ListSeries());
```

---

Calls Limit Per Minute

100

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

##### Responses

200

Successful operation.

```
[
  "series-1",
  "series-2",
  "series-3"
]
```

---

404

Invalid URL.

---

### Series items

Methods for adding items (or even series themselves) to series.

get

#### List Series Items

Lists all the items present in the given series, sorted according to their time index values.

```js
const result = await client.send(new requests.ListSeriesItems(seriesId));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

seriesId

String

Located in: **path**

Required: **Yes**

ID of the series whose items are to be listed.

---

##### Responses

200

Successful operation.

```
[
  {
    "itemType": "item",
    "itemId": "item-x",
    "time": 1
  },
  {
    "itemType": "item",
    "itemId": "item-y",
    "time": 2
  },
  {
    "itemType": "item",
    "itemId": "item-z",
    "time": 3
  }
]
```

---

400

The `seriesId` does not match ^\[a-zA-Z0-9\_-:@.\]+$.

---

404

Series of the given `seriesId` is not present in the database. If there is no additional info in the JSON response, you probably have an error in your URL.

---

post

#### Insert to Series

Inserts an existing item/series into a series of the given seriesId at a position determined by time.

```js
client.send(new requests.InsertToSeries(seriesId, itemType, itemId, time, {
  // optional parameters:
  cascadeCreate: true,  // boolean
}));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

seriesId

String

Located in: **path**

Required: **Yes**

ID of the series to be inserted into.

---

itemType

String

Located in: **body**

Required: **Yes**

`item` iff the regular item from the catalog is to be inserted, `series` iff series is inserted as the item.

---

itemId

String

Located in: **body**

Required: **Yes**

ID of the item iff `itemType` is `item`. ID of the series iff `itemType` is `series`.

---

time

Number

Located in: **body**

Required: **Yes**

Time index used for sorting items in the series. According to time, items are sorted within series in ascending order. In the example of TV show episodes, the episode number is a natural choice to be passed as time.

---

cascadeCreate

Boolean

Located in: **body**

Required: **No**

Indicates that any non-existing entity specified within the request should be created (as if corresponding PUT requests were invoked). This concerns both the `seriesId` and the `itemId`. If `cascadeCreate` is set to true, the behavior also depends on the `itemType`. In case of `item`, an item is created, in case of `series` a series + corresponding item with the same ID is created.

---

##### Responses

200

Successful operation.

---

400

`seriesId` or `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$, or `itemType`∉{item,series}, or `time` is not a real number.

---

404

Series of the given `seriesId` is not present in the database. Item of the given `itemId` is not present in the database if `itemType` is item. Series of the given `itemId` is not present in the database if `itemType` is series. If there is no additional info in the JSON response, you probably have an error in your URL.

---

409

A series item of the exact same (`itemType`, `itemId`, `time`) is already present in the series of `seriesId`. In many cases, you may consider this code a success – it only tells you that nothing has been written to the database.

---

delete

#### Remove from Series

Removes an existing series item from the series.

```js
client.send(new requests.RemoveFromSeries(seriesId, itemType, itemId));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

seriesId

String

Located in: **path**

Required: **Yes**

ID of the series from which a series item is to be removed.

---

itemType

String

Located in: **body**

Required: **Yes**

Type of the item to be removed.

---

itemId

String

Located in: **body**

Required: **Yes**

ID of the item iff `itemType` is `item`. ID of the series iff `itemType` is `series`.

---

##### Responses

200

Successful operation.

---

400

The `seriesId` or `itemId` does not match ^\[a-zA-Z0-9\_-:@.\]+$ or `itemType`∉{`item`, `series`}.

---

404

Series of the given `seriesId` is not present in the database. Series item given by pair (`itemType`, `itemId`) is not present in series of `seriesId`. If there is no additional info in the JSON response, you probably have an error in your URL.

---

## 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](https://docs.recombee.com/segmentations) for more info.

### Property Based Segmentation

Property-based Segmentation groups the Items by the value of a particular property. See [this section](https://docs.recombee.com/segmentations#property-based-segmentation) for more info.

put

#### Create Property Based Segmentation

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.

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

---

Since version

4.1.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of your database.

---

segmentationId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of the newly created Segmentation

---

sourceType

String

Located in: **body**

Required: **Yes**

Since version: **4.1.0**

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

---

propertyName

String

Located in: **body**

Required: **Yes**

Since version: **4.1.0**

Name of the property on which the Segmentation should be based

---

title

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

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

---

description

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

Description that is shown in the Recombee Admin UI.

---

##### Responses

201

successful operation

---

400

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

---

404

Property does not exist.

---

post

#### Update Property Based Segmentation

Updates a Property Based Segmentation

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

---

Since version

4.1.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of your database.

---

segmentationId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of the updated Segmentation

---

propertyName

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

Name of the property on which the Segmentation should be based

---

title

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

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

---

description

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

Description that is shown in the Recombee Admin UI.

---

##### Responses

201

successful operation

---

400

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

---

404

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

---

### Manual ReQL Segmentation

Segmentation whose Segments are defined by ReQL filters. See [this section](https://docs.recombee.com/segmentations#manual-reql-segmentation) for more info.

put

#### Create Manual ReQL Segmentation

Segment the items using multiple [ReQL](https://docs.recombee.com/reql) filters.

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

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

---

Since version

4.1.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of your database.

---

segmentationId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of the newly created Segmentation

---

sourceType

String

Located in: **body**

Required: **Yes**

Since version: **4.1.0**

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

---

title

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

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

---

description

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

Description that is shown in the Recombee Admin UI.

---

##### Responses

201

successful operation

---

400

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

---

##### Examples

###### Example Create a Manual ReQL Segmentation and set up its Segments

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](https://docs.recombee.com/segmentations#manual-reql-based-segmentation) for more info.

```python
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 Manual ReQL Segmentation

Update an existing Segmentation.

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

---

Since version

4.1.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of your database.

---

segmentationId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of the updated Segmentation

---

title

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

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

---

description

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

Description that is shown in the Recombee Admin UI.

---

##### Responses

201

successful operation

---

400

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

---

404

Segmentation with given ID does not exist.

---

put

#### Add Manual ReQL Segment

Adds a new Segment into a Manual ReQL Segmentation.

The new Segment is defined by a [ReQL](https://docs.recombee.com/reql) filter that returns `true` for an item in case that this item belongs to the segment.

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

---

Since version

4.1.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of your database.

---

segmentationId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

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

---

segmentId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of the newly created Segment

---

filter

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`.

---

title

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.

---

##### Responses

201

successful operation

---

400

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

---

404

Segmentation with given ID does not exist.

---

post

#### Update Manual ReQL Segment

Update definition of the Segment.

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

---

Since version

4.1.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of your database.

---

segmentationId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of the Segmentation to which the updated Segment belongs

---

segmentId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of the Segment that will be updated

---

filter

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`.

---

title

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.

---

##### Responses

201

successful operation

---

400

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

---

404

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

---

delete

#### Delete Manual ReQL Segment

Delete a Segment from a Manual ReQL Segmentation.

```js
client.send(new requests.DeleteManualReqlSegment(segmentationId, segmentId));
```

---

Since version

4.1.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of your database.

---

segmentationId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of the Segmentation from which the Segment should be deleted

---

segmentId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of the Segment that should be deleted

---

##### Responses

201

successful operation

---

400

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

---

404

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

---

### Auto ReQL 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](https://docs.recombee.com/segmentations#auto-reql-segmentation) for more info.

put

#### Create Auto ReQL Segmentation

Segment the items using a [ReQL](https://docs.recombee.com/reql) expression.

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

```js
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
}));
```

---

Since version

4.1.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of your database.

---

segmentationId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of the newly created Segmentation

---

sourceType

String

Located in: **body**

Required: **Yes**

Since version: **4.1.0**

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

---

expression

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

---

title

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

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

---

description

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

Description that is shown in the Recombee Admin UI.

---

##### Responses

201

successful operation

---

400

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

---

##### Examples

###### Example Create an Auto ReQL Segmentation

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

See [this section](https://docs.recombee.com/segmentations#auto-reql-based-segmentation) for more info.

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

response = client.send(req)
```

post

#### Update Auto ReQL Segmentation

Update an existing Segmentation.

```js
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
}));
```

---

Since version

4.1.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of your database.

---

segmentationId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of the updated Segmentation

---

expression

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

---

title

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

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

---

description

String

Located in: **body**

Required: **No**

Since version: **4.1.0**

Description that is shown in the Recombee Admin UI.

---

##### Responses

201

successful operation

---

400

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

---

404

Segmentation with given ID does not exist.

---

### General

get

#### List Segmentations

Return all existing items Segmentations.

```js
const result = await client.send(new requests.ListSegmentations(sourceType));
```

---

Since version

4.1.0

---

Calls Limit Per Minute

60

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of your database.

---

sourceType

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.

---

##### Responses

200

```
{
  "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 Segmentation

Get existing Segmentation.

```js
const result = await client.send(new requests.GetSegmentation(segmentationId));
```

---

Since version

4.1.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of your database.

---

segmentationId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of the Segmentation that should be returned

---

##### Responses

200

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

---

404

Segmentation with given ID does not exist.

---

delete

#### Delete Segmentation

Delete existing Segmentation.

```js
client.send(new requests.DeleteSegmentation(segmentationId));
```

---

Since version

4.1.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of your database.

---

segmentationId

String

Located in: **path**

Required: **Yes**

Since version: **4.1.0**

ID of the Segmentation that should be deleted

---

##### Responses

200

successful operation

---

404

Segmentation with given ID does not exist.

---

## Miscellaneous

post

#### Batch

Allowed on Client-Side

Batch processing allows you to submit arbitrary sequence of requests within a single HTTPS request.

Any type of request from the above documentation may be used in the Batch, and the Batch may combine different types of requests arbitrarily as well.

Using Batch requests is beneficial for example, when synchronizing the catalog of items or uploading historical interaction data, as sending the data in Batch is considerably faster than sending the individual requests (thanks to optimizations and reducing network and HTTPS overhead).

```js
const result = await client.send(new recombee.Batch(requests, {
  // optional parameters:
  distinctRecomms: true,  // boolean
}));
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

requests

Array

Located in: **body**

Required: **Yes**

JSON array containing the requests.

---

distinctRecomms

Boolean

Located in: **body**

Required: **No**

Since version: **1.2.4**

Makes all the recommended items for a certain user distinct among multiple recommendation requests in the batch.

---

##### Responses

200

Successful operation. There is an array with responses. The order of the responses in the array follows the order of the sent requests.

```
[
  {
    "code": 200,
    "json": "ok"
  },
  {
    "code": 200,
    "json": "ok"
  },
  {
    "code": 200,
    "json": {
      "recommId": "3f6ad2f2-a3f1-4ba1-a690-f4f01f76d4eb",
      "recomms": [
        {
          "id": "item-146"
        },
        {
          "id": "item-462"
        },
        {
          "id": "item-463"
        }
      ],
      "numberNextRecommsCalls": 0
    }
  }
]
```

---

400

Many possibilities, see the error description in the result JSON. Examples: invalid or missing Content-type (not `application/json`), request body is not a valid JSON, request JSON does not have the prescribed structure.

---

404

There is at least one request in the batch with an invalid (non-existing) URL. In such a case, the batch as a whole **is not executed** and you'll get HTTP 404, because the batch is apriori erroneous.

---

413

Too large batch (containing more than 10,000 requests in case of a server side request).

---

##### Examples

###### Example Sending multiple requests in a single Batch request

Batch can encapsulate requests of various types.

```js
let reqs = [new recombee.AddDetailView(userId, itemId),
            new recombee.RecommendItemsToUser(userId, 5, {scenario: 'just_for_you'}),
            new recombee.RecommendItemsToItem(itemId, userId, 5, {scenario: 'similar_products'})
           ];

const responses = await client.send(new recombee.Batch(reqs));
```

---

###### Example Checking the result of the individual requests

You should check that the requests in the Batch succeeded. A request can fail for example due to invalid parameters - the returned error mesage gives you a hint what went wrong.

```js
try {
  const responses = await client.send(new recombee.Batch(reqs));
  for (const response of responses) {
    if (response.code < 200 || response.code > 299) {
      // A request in the Batch did not succeed
      console.log(response);
    }
  }
} catch (error) {
    // The whole Batch request failed
}
```

---

###### Example Using distinctRecomms parameter to deduplicate results in multiple boxes

If you show multiple boxes with recommendations on a single page, you may want to ensure that the same item is not recommended in multiple boxes. You can achieve that by specifying `distinctRecomms=true`.

```js
const batchRequest = new rqs.Batch([
  new RecommendItemsToUser('user-id', 5, {scenario:'new_releases', cascadeCreate: true}),
  new RecommendItemsToUser('user-id', 5, {scenario:'just_for_you', cascadeCreate: true})
], {
  distinctRecomms: true
});

const responses = await client.send(batchRequest);
```

##### Notes

Executing the requests in a Batch is equivalent as if they were executed one-by-one individually; there are, however, many optimizations to make batch execution as fast as possible.

The status code of the Batch request itself is 200 even if the individual requests result in error – you have to inspect the code values in the resulting array.

If the status code of the whole batch is not 200, then there is an error in the Batch request itself; in such a case, the error message returned should help you to resolve the problem.

The batch size is limited to 10,000 requests when sent from the server side; if you wish to execute even larger number of requests, please split the Batch into multiple parts. Client libraries do the splitting automatically.

In case of the client side integration, the limit is 30 requests and only the requests that can be called from the client side are allowed.

get

#### List Scenarios

Get all [Scenarios](https://docs.recombee.com/scenarios) of the given database.

```js
const result = await client.send(new requests.ListScenarios());
```

---

Since version

5.1.0

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

##### Responses

200

Successful operation.

```
[
  {
    "id": "relatedArticles",
    "endpoint": "recommendItemsToItem"
  },
  {
    "id": "justForYou",
    "endpoint": "recommendItemsToUser"
  },
  {
    "id": "homepageSectionsOrdering",
    "endpoint": "recommendItemSegmentsToUser"
  },
  {
    "id": "homepageSectionContent",
    "endpoint": "recommendItemsToItemSegment"
  }
]
```

---

delete

#### Reset Database

Completely erases all your data, including items, item properties, series, user database, purchases, ratings, detail views, and bookmarks. Make sure the request is never executed in the production environment! Resetting your database is irreversible.

```js
client.send(new requests.ResetDatabase());
```

---

##### Parameters

databaseId

String

Located in: **path**

Required: **Yes**

ID of your database.

---

##### Responses

200

Successful operation.

---

**Table of contents**

* [Items](#items)  
   * [Add Item](#add-item)  
   * [Delete Item](#delete-item)  
   * [List Items](#list-items)  
   * [Delete More Items](#delete-more-items)
* [Item Properties](#item-properties)  
   * [Item properties definition](#item-properties-definition)  
         * [Add Item Property](#add-item-property)  
         * [Delete Item Property](#delete-item-property)  
         * [Get Item Property Info](#get-item-property-info)  
         * [List Item Properties](#list-item-properties)  
   * [Values of item properties](#values-of-item-properties)  
         * [Set Item Values](#set-item-values)  
         * [Get Item Values](#get-item-values)  
         * [Update More Items](#update-more-items)
* [Users](#users)  
   * [Add User](#add-user)  
   * [Delete User](#delete-user)  
   * [Merge Users](#merge-users)  
   * [List Users](#list-users)
* [User Properties](#user-properties)  
   * [User properties definition](#user-properties-definition)  
         * [Add User Property](#add-user-property)  
         * [Delete User Property](#delete-user-property)  
         * [Get User Property Info](#get-user-property-info)  
         * [List User Properties](#list-user-properties)  
   * [Values of user properties](#values-of-user-properties)  
         * [Set User Values](#set-user-values)  
         * [Get User Values](#get-user-values)
* [User-Item Interactions](#user-item-interactions)  
   * [Detail Views](#detail-views)  
         * [Add Detail View](#add-detail-view)  
         * [Delete Detail View](#delete-detail-view)  
         * [List Item Detail Views](#list-item-detail-views)  
         * [List User Detail Views](#list-user-detail-views)  
   * [Purchases](#purchases)  
         * [Add Purchase](#add-purchase)  
         * [Delete Purchase](#delete-purchase)  
         * [List Item Purchases](#list-item-purchases)  
         * [List User Purchases](#list-user-purchases)  
   * [Ratings](#ratings)  
         * [Add Rating](#add-rating)  
         * [Delete Rating](#delete-rating)  
         * [List Item Ratings](#list-item-ratings)  
         * [List User Ratings](#list-user-ratings)  
   * [Cart Additions](#cart-additions)  
         * [Add Cart Addition](#add-cart-addition)  
         * [Delete Cart Addition](#delete-cart-addition)  
         * [List Item Cart Additions](#list-item-cart-additions)  
         * [List User Cart Additions](#list-user-cart-additions)  
   * [Bookmarks](#bookmarks)  
         * [Add Bookmark](#add-bookmark)  
         * [Delete Bookmark](#delete-bookmark)  
         * [List Item Bookmarks](#list-item-bookmarks)  
         * [List User Bookmarks](#list-user-bookmarks)  
   * [View Portions](#view-portions)  
         * [Set View Portion](#set-view-portion)  
         * [Delete View Portion](#delete-view-portion)  
         * [List Item View Portions](#list-item-view-portions)  
         * [List User View Portions](#list-user-view-portions)
* [Recommendations](#recommendations)  
   * [Recommending Items](#recommending-items)  
         * [Recommend Items to User](#recommend-items-to-user)  
         * [Recommend Items to Item](#recommend-items-to-item)  
         * [Recommend Items to Item Segment](#recommend-items-to-item-segment)  
         * [Recommend Next Items](#recommend-next-items)  
   * [Recommending Item Segments](#recommending-item-segments)  
         * [Recommend Item Segments to User](#recommend-item-segments-to-user)  
         * [Recommend Item Segments to Item](#recommend-item-segments-to-item)  
         * [Recommend Item Segments to Item Segment](#recommend-item-segments-to-item-segment)  
         * [Recommend Next Item Segments](#recommend-next-item-segments)  
   * [Recommending Users](#recommending-users)  
         * [Recommend Users to User](#recommend-users-to-user)  
         * [Recommend Users to Item](#recommend-users-to-item)  
   * [Composite Recommendations](#composite-recommendations)  
         * [Composite Recommendation](#composite-recommendation)
* [Search](#search)  
   * [Search Items](#search-items)  
   * [Search Item Segments](#search-item-segments)  
   * [Synonyms](#synonyms)  
         * [Add Search Synonym](#add-search-synonym)  
         * [List Search Synonyms](#list-search-synonyms)  
         * [Delete All Search Synonyms](#delete-all-search-synonyms)  
         * [Delete Search Synonym](#delete-search-synonym)
* [Series](#series)  
   * [Series definition](#series-definition)  
         * [Add Series](#add-series)  
         * [Delete Series](#delete-series)  
         * [List Series](#list-series)  
   * [Series items](#series-items)  
         * [List Series Items](#list-series-items)  
         * [Insert to Series](#insert-to-series)  
         * [Remove from Series](#remove-from-series)
* [Segmentations Definition](#segmentations-definition)  
   * [Property Based Segmentation](#property-based-segmentation)  
         * [Create Property Based Segmentation](#create-property-based-segmentation)  
         * [Update Property Based Segmentation](#update-property-based-segmentation)  
   * [Manual ReQL Segmentation](#manual-reql-segmentation)  
         * [Create Manual ReQL Segmentation](#create-manual-reql-segmentation)  
         * [Update Manual ReQL Segmentation](#update-manual-reql-segmentation)  
         * [Add Manual ReQL Segment](#add-manual-reql-segment)  
         * [Update Manual ReQL Segment](#update-manual-reql-segment)  
         * [Delete Manual ReQL Segment](#delete-manual-reql-segment)  
   * [Auto ReQL Segmentation](#auto-reql-segmentation)  
         * [Create Auto ReQL Segmentation](#create-auto-reql-segmentation)  
         * [Update Auto ReQL Segmentation](#update-auto-reql-segmentation)  
   * [General](#general)  
         * [List Segmentations](#list-segmentations)  
         * [Get Segmentation](#get-segmentation)  
         * [Delete Segmentation](#delete-segmentation)
* [Miscellaneous](#miscellaneous)  
   * [Batch](#batch)  
   * [List Scenarios](#list-scenarios)  
   * [Reset Database](#reset-database)