Skip to main content
/rate

Add an end-user ratings to the log entry of a previously generated prompt.

Promptitude Team avatar
Written by Promptitude Team
Updated over a week ago

Endpoint

Simply send a POST request to the endpoint, including the logId of a previous prompt generation in the url, the Authorization Header, and the Request Object.

Action

POST

Endpoint URL

https://api.promptitude.io/v1/logs/{logId}/rate

Headers

Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Body

The below Request Object (JSON)

Request Object

Here's an example of the request object for adding a 3-star rating to the log entry of a previously generated prompt:

{ 
"rating": {
"rating": 3
}
}

Attributes of the Request Object:


rating object - required
โ€‹
Contains the details about how to rate the log entry.

rating number - required
Set to 1, 2, or 3 to add a star rating. 0 removes a previously stored rating.


Result Object

Here's an example of a Result Object after successfully adding an end-user rating to a log entry. The logId and rating from the Request Object are simply repeated:

{ 
"code": 200,
"message": "OK",
"error": false,
"results": {
"promptsLogs": {
"id": "sdflkj34dlksjd2423",
"rating": 3
}
}
}

Attributes of the Result Object:


code number
Response code. 200 if everything went OK, otherwise the HTTP response code.


message string
"OK" if everything went well. If not, contains the detailed error message.


error boolean
Shows if an error occurred during the request.


results object
Contains the results of the rating.

promptsLogs object
The detailed results of rating an existing log entry.

id string
Unique ID of the log entry that was rated (from the endpoint url).

rating number
The star rating added to the log entry, or 0 if the rating was removed.


Did this answer your question?