Record Vote
curl --request POST \
--url https://api.gurubase.io/api/v1/{guru_type}/record_vote/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"content_slug": "<string>",
"binge_id": "<string>",
"vote_type": "<string>",
"feedback": "<string>"
}
'import requests
url = "https://api.gurubase.io/api/v1/{guru_type}/record_vote/"
payload = {
"content_slug": "<string>",
"binge_id": "<string>",
"vote_type": "<string>",
"feedback": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
content_slug: '<string>',
binge_id: '<string>',
vote_type: '<string>',
feedback: '<string>'
})
};
fetch('https://api.gurubase.io/api/v1/{guru_type}/record_vote/', 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.gurubase.io/api/v1/{guru_type}/record_vote/",
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([
'content_slug' => '<string>',
'binge_id' => '<string>',
'vote_type' => '<string>',
'feedback' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.gurubase.io/api/v1/{guru_type}/record_vote/"
payload := strings.NewReader("{\n \"content_slug\": \"<string>\",\n \"binge_id\": \"<string>\",\n \"vote_type\": \"<string>\",\n \"feedback\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.gurubase.io/api/v1/{guru_type}/record_vote/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"content_slug\": \"<string>\",\n \"binge_id\": \"<string>\",\n \"vote_type\": \"<string>\",\n \"feedback\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gurubase.io/api/v1/{guru_type}/record_vote/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content_slug\": \"<string>\",\n \"binge_id\": \"<string>\",\n \"vote_type\": \"<string>\",\n \"feedback\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"vote": "upvote",
"feedback": null
}
{
"vote": "downvote",
"feedback": "This answer was not helpful because..."
}
{
"msg": "Invalid parameters"
}
{
"msg": "Feedback must be 200 characters or less"
}
{
"msg": "Feedback can only be given for normal answers"
}
{
"msg": "Question not found"
}
Endpoints
Record Vote
Record a vote (upvote or downvote) on a question
POST
/
{guru_type}
/
record_vote
/
Record Vote
curl --request POST \
--url https://api.gurubase.io/api/v1/{guru_type}/record_vote/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"content_slug": "<string>",
"binge_id": "<string>",
"vote_type": "<string>",
"feedback": "<string>"
}
'import requests
url = "https://api.gurubase.io/api/v1/{guru_type}/record_vote/"
payload = {
"content_slug": "<string>",
"binge_id": "<string>",
"vote_type": "<string>",
"feedback": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
content_slug: '<string>',
binge_id: '<string>',
vote_type: '<string>',
feedback: '<string>'
})
};
fetch('https://api.gurubase.io/api/v1/{guru_type}/record_vote/', 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.gurubase.io/api/v1/{guru_type}/record_vote/",
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([
'content_slug' => '<string>',
'binge_id' => '<string>',
'vote_type' => '<string>',
'feedback' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.gurubase.io/api/v1/{guru_type}/record_vote/"
payload := strings.NewReader("{\n \"content_slug\": \"<string>\",\n \"binge_id\": \"<string>\",\n \"vote_type\": \"<string>\",\n \"feedback\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.gurubase.io/api/v1/{guru_type}/record_vote/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"content_slug\": \"<string>\",\n \"binge_id\": \"<string>\",\n \"vote_type\": \"<string>\",\n \"feedback\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gurubase.io/api/v1/{guru_type}/record_vote/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content_slug\": \"<string>\",\n \"binge_id\": \"<string>\",\n \"vote_type\": \"<string>\",\n \"feedback\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"vote": "upvote",
"feedback": null
}
{
"vote": "downvote",
"feedback": "This answer was not helpful because..."
}
{
"msg": "Invalid parameters"
}
{
"msg": "Feedback must be 200 characters or less"
}
{
"msg": "Feedback can only be given for normal answers"
}
{
"msg": "Question not found"
}
Record a user’s vote on a specific question. Multiple votes can be submitted for the same question, with each new vote overwriting the previous one. Downvotes can include optional feedback.
Important: Feedback (votes) can only be given for normal answers. Simple interactions and clarifications cannot receive votes. Attempting to vote on these question types will return a 400 error. You can check whether a question can receive feedback by checking the
can_receive_feedback field returned by the Ask Question endpoint.Path Parameters
string
required
The type/slug of the Guru
Headers
string
required
Your API key for authentication. You can obtain your API key from the Gurubase dashboard.
Body Parameters
string
required
The slug identifier of the question to vote on
string
Optional binge session identifier. Can be None
string
required
The type of vote to record. Must be either “upvote” or “downvote”
string
Optional feedback text for downvotes. Maximum 200 characters
Response
string
The recorded vote type (“upvote” or “downvote”)
string
The feedback provided with the vote (if any)
string
Error message or status message
{
"vote": "upvote",
"feedback": null
}
{
"vote": "downvote",
"feedback": "This answer was not helpful because..."
}
{
"msg": "Invalid parameters"
}
{
"msg": "Feedback must be 200 characters or less"
}
{
"msg": "Feedback can only be given for normal answers"
}
{
"msg": "Question not found"
}
Notes
- Multiple votes can be submitted for the same question. Each new vote overwrites the previous vote.
- Feedback (votes) can only be given for normal answers. Simple interactions and clarifications cannot receive votes.
- Feedback is optional but limited to 200 characters
- The
binge_idparameter can be null, empty string, or “None” and will be treated as null - Only “upvote” and “downvote” are valid vote types
Was this page helpful?