Add Comment Reaction
curl --request POST \
--url https://api.sublay.io/v8/:projectId/comments/:commentId/reactions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reactionType": "<string>",
"userId": "<string>"
}
'import requests
url = "https://api.sublay.io/v8/:projectId/comments/:commentId/reactions"
payload = {
"reactionType": "<string>",
"userId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({reactionType: '<string>', userId: '<string>'})
};
fetch('https://api.sublay.io/v8/:projectId/comments/:commentId/reactions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sublay.io/v8/:projectId/comments/:commentId/reactions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'reactionType' => '<string>',
'userId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sublay.io/v8/:projectId/comments/:commentId/reactions"
payload := strings.NewReader("{\n \"reactionType\": \"<string>\",\n \"userId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sublay.io/v8/:projectId/comments/:commentId/reactions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reactionType\": \"<string>\",\n \"userId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v8/:projectId/comments/:commentId/reactions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reactionType\": \"<string>\",\n \"userId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyComment Endpoints
Add Comment Reaction
Add or update a reaction on a comment
Add Comment Reaction
curl --request POST \
--url https://api.sublay.io/v8/:projectId/comments/:commentId/reactions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reactionType": "<string>",
"userId": "<string>"
}
'import requests
url = "https://api.sublay.io/v8/:projectId/comments/:commentId/reactions"
payload = {
"reactionType": "<string>",
"userId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({reactionType: '<string>', userId: '<string>'})
};
fetch('https://api.sublay.io/v8/:projectId/comments/:commentId/reactions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sublay.io/v8/:projectId/comments/:commentId/reactions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'reactionType' => '<string>',
'userId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sublay.io/v8/:projectId/comments/:commentId/reactions"
payload := strings.NewReader("{\n \"reactionType\": \"<string>\",\n \"userId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sublay.io/v8/:projectId/comments/:commentId/reactions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reactionType\": \"<string>\",\n \"userId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v8/:projectId/comments/:commentId/reactions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reactionType\": \"<string>\",\n \"userId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyAdds a reaction of the specified type to a comment. If the user already has a reaction on this comment, it is replaced with the new type. The comment’s
reactionCounts map is updated accordingly. Sending the reaction the user already has changes nothing: the response is the same 200 with the comment, counts stay as they are, and no notification is sent.
Authentication required.
Path Parameters
string
required
The UUID of the comment to react to.
Body Parameters
string
required
The type of reaction to add. One of:
upvote, downvote, like, love, wow, sad, angry, funny.string
The user the reaction is attributed to. Service or master key only, and required with one — a key has no user of its own, so leaving it out returns
400 comment/missing-user-id. A user token always reacts as itself: naming a different user returns 403 comment/unauthorized.A userId that doesn’t match a user returns 404 comment/user-not-found.Blocks
When themoderation bundle is installed:
- If the reacting user blocked the comment’s author, the reaction is allowed — the block is their own choice. The author gets no reaction notification for it; if the reaction completes a milestone, the milestone notification is still sent, with the reacting user left out of its
lastThreeUsers. - If the comment’s author blocked the reacting user (or both blocked each other), the request returns
404 comment/not-found. These comments are markedisUnavailablein threads. - If the author of the comment’s entity blocked the reacting user, the request returns
404 comment/not-found— for every comment on that entity, the reacting user’s own included.
Deleted and removed comments
A comment its author deleted can’t be reacted to: the request returns403 comment/deleted and changes nothing. This applies to everyone, including the comment’s author, and covers changing an existing reaction to another type too.
Reacting to a moderator-removed comment returns 404 comment/not-found — for everyone, including the removed comment’s author.
The 403 is only returned for a comment the reacting user can see. A deleted comment that a block hides from them (see Blocks) returns 404 comment/not-found, like any other.
Reactions already on a deleted or removed comment can still be taken off with Remove Comment Reaction.
Response
Returns the updated Comment object with the newreactionCounts map, shaped for the reacting user (with isAuthorBlocked and isUnavailable flags), the same way Fetch Comment returns it.
Error Responses
Invalid Params — 400
Invalid Params — 400
Returned when
commentId isn’t a valid UUID.{ "error": "commentId: Invalid UUID format", "code": "comment/invalid-params" }
Invalid Body — 400
Invalid Body — 400
Returned when
reactionType is missing or isn’t one of the eight types, or when userId isn’t a valid UUID.{
"error": "reactionType: Invalid option: expected one of \"upvote\"|\"downvote\"|\"like\"|\"love\"|\"wow\"|\"sad\"|\"angry\"|\"funny\"",
"code": "comment/invalid-body"
}
Acting as another user — 403
Acting as another user — 403
Returned when a request authenticated with a user token sends a
userId other than that user’s own ID.{ "error": "Unauthorized", "code": "comment/unauthorized" }
Missing User — 400
Missing User — 400
Returned when a service or master key sends no
userId.{ "error": "Missing user ID", "code": "comment/missing-user-id" }
User Not Found — 404
User Not Found — 404
Returned when a service or master key names a
userId that doesn’t exist.{ "error": "User not found", "code": "comment/user-not-found" }
Not Found — 404
Not Found — 404
Returned when the comment doesn’t exist, when a moderator removed it, or when a block refuses the reaction (see Blocks).
{ "error": "Comment not found.", "code": "comment/not-found" }
Comment Deleted — 403
Comment Deleted — 403
Returned when the comment was deleted by its author (see Deleted and removed comments).

