API
Message Rating
Rate Message
This endpoint allows you to rate whether an AI generated message was good or bad through the API.
POST /api.mendable.ai/v1/rateMessage
Here is an example request using cURL:
curl -X POST https://api.mendable.ai/v1/rateMessage \
-H "Content-Type: application/json" \
-d '{
"api_key": "YOUR_API_KEY",
"message_id": 123,
"rating_value": 1
}'
or using Javascript:
const url = "https://api.mendable.ai/v1/rateMessage";
const data = {
api_key: "YOUR_API_KEY",
message_id: 123,
rating_value: 1
};
fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
Body Parameters
Parameter | Type | Description |
---|---|---|
api_key | string | The API key associated with your project. |
message_id | int | The ID of the message to be rated. |
rating_value | int | 1 for good, -1 for bad. The rating value for the message. |
Response
HTTP/1.1 200 OK
Content-Type: text/plain
Message rating updated
Success
- Status code:
200
- Response body:
"Message rating updated"
Errors
Status code:
400
- Missing
api_key
parameter - Invalid API key or project not found
- Missing
Status code:
500
- Error updating message rating
- Permission denied to rate the message