Recomms AI
  1. Interactions
Recomms AI
  • Documentation
  • Recomms AI SDK
  • Items
    • Create an item
      POST
    • Update an item
      PATCH
    • Get items
      GET
    • Get item by ID
      GET
    • Delete item
      DELETE
    • Get item side info
      GET
    • Create item side info
      POST
    • Delete item side info
      DELETE
    • Reset items
      POST
  • Users
    • Create a user
      POST
    • Update a user
      PATCH
    • Get users
      GET
    • Get user by ID
      GET
    • Delete user
      DELETE
    • Get user side info
      GET
    • Create user side info
      POST
    • Delete user side info
      DELETE
    • Reset users
      POST
  • Interactions
    • Record an interaction
      POST
    • Get interactions
      GET
    • Delete an interaction
      DELETE
    • Record multiple interactions
      POST
    • Reset interactions
      POST
  • Business Rules
    • Create a new business rule
      POST
    • List business rules
      GET
    • Get business rule by ID
      GET
    • Update business rule
      PATCH
    • Delete business rule
      DELETE
  • Recommendations
    • Get item recommendations for a user
    • Get user recommendations for an item
    • Get similar users
    • Predict scores for user-item pairs
    • Predict scores for a batch of user-item combinations
    • Search for items
    • Search for users
    • Get top items
  1. Interactions

Record an interaction

POST
https://api.recomms.ai/{database}/interactions
Interactions
Record a new interaction between a user and an item. Supported interaction types:
detailviews: Record time spent viewing an item
purchases: Record a purchase of an item
ratings: Record a user's rating of an item
cartadditions: Record adding an item to the cart
bookmarks: Record bookmarking an item
viewportions: Record the portion of an item viewed

Request

Path Params
database
string 
required
The ID of the database to operate on
Body Params application/json
user_id
string 
required
item_id
string 
required
action
enum<string> 
required
Allowed values:
detailviewspurchasesratingscartadditionsbookmarksviewportions
timestamp
integer 
optional
Unix timestamp of the interaction
cascadeCreate
boolean 
optional
If true, creates missing users or items
duration
number 
optional
Duration of the interaction (for detailviews)
price
number 
optional
Price of the item (for purchases and cartadditions)
amount
integer 
optional
Amount of items (for purchases and cartadditions)
rating
number 
optional
Rating value (for ratings)
>= -1<= 1
portion
number 
optional
Portion of the item viewed (for viewportions)
>= 0<= 1
Example
{
    "user_id": "string",
    "item_id": "string",
    "action": "detailviews",
    "timestamp": 0,
    "cascadeCreate": true,
    "duration": 0,
    "price": 0,
    "amount": 0,
    "rating": -1,
    "portion": 0
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.recomms.ai//interactions' \
--header 'Content-Type: application/json' \
--data-raw '{
    "user_id": "string",
    "item_id": "string",
    "action": "detailviews",
    "timestamp": 0,
    "cascadeCreate": true,
    "duration": 0,
    "price": 0,
    "amount": 0,
    "rating": -1,
    "portion": 0
}'

Responses

🟢200OK
application/json
Successful operation
Body
status
enum<string> 
optional
Allowed value:
success
timestamp
integer 
optional
Example
{
    "status": "success",
    "timestamp": 0
}
🟠400Bad Request
🟠401Unauthorized
Modified at 2025-03-13 16:59:32
Previous
Reset users
Next
Get interactions
Built with