Users

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

put

Adds a new user to the database.

Copy
Initialization
client.send(new requests.AddUser(userId));

String
Located in: path
Required: Yes

ID of your database.


String
Located in: path
Required: Yes

ID of the user to be added.


Successful operation.


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


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

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.

Copy
Initialization
client.send(new requests.DeleteUser(userId));

String
Located in: path
Required: Yes

ID of your database.


String
Located in: path
Required: Yes

ID of the user to be deleted.


Successful operation.


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


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

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

100

String
Located in: path
Required: Yes

ID of your database.


String
Located in: path
Required: Yes

ID of the target user.


String
Located in: path
Required: Yes

ID of the source user.


Boolean
Located in: query
Required: No

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


Successful operation.


The sourceUserId or targetUserId does not match ^[a-zA-Z0-9_-:@.]+$


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

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

Copy
Initialization
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
}));

100

String
Located in: path
Required: Yes

ID of your database.


String
Located in: query
Required: No

Boolean-returning ReQL expression, which allows you to filter users to be listed. Only the users for which the expression is true will be returned.


Integer
Located in: query
Required: No

The number of users to be listed.


Integer
Located in: query
Required: No

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


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"
    }
  ]

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"
    }
  ]

Successful operation.

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

Invalid URL.


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