---
title: "Add Rating"
method: POST
path: "/{databaseId}/ratings/"
tags: ["User-Item Interactions"]
---

# Add Rating

`POST /{databaseId}/ratings/`

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

## Path parameters

- `databaseId` string, required

## Request body

- Rating
  - `userId` string, required — User who submitted the rating
  - `itemId` string, required — Rated item
  - `timestamp` union — UTC timestamp of the rating as ISO8601-1 pattern or UTC epoch time. The default value is the current time.
    - string, double
    - number, double
  - `rating` number, double, required — 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 — Sets whether the given user/item should be created if not present in the database.
  - `recommId` string — If this rating is based on a recommendation request, `recommId` is the id of the clicked recommendation.
  - `additionalData` object — A dictionary of additional data for the interaction.

## Response `200`

Successful operation.

## Other responses

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

---

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