Rate an answer
Records whether an answer helped. Ratings show with your docs site's in Analytics.
curl -X POST "https://api.documentation.ai/api/v1/assistant/feedback" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"answer_id": "ans_7f3c2a9e41b84d0e9a1c6b5d2e8f0a13",
"rating": "up"
}'
import requests
import json
url = "https://api.documentation.ai/api/v1/assistant/feedback"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"answer_id": "ans_7f3c2a9e41b84d0e9a1c6b5d2e8f0a13",
"rating": "up"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.documentation.ai/api/v1/assistant/feedback", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"answer_id": "ans_7f3c2a9e41b84d0e9a1c6b5d2e8f0a13",
"rating": "up"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"answer_id": "ans_7f3c2a9e41b84d0e9a1c6b5d2e8f0a13",
"rating": "up"
}`)
req, err := http.NewRequest("POST", "https://api.documentation.ai/api/v1/assistant/feedback", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.documentation.ai/api/v1/assistant/feedback')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
request.body = '{
"answer_id": "ans_7f3c2a9e41b84d0e9a1c6b5d2e8f0a13",
"rating": "up"
}'
response = http.request(request)
puts response.body
{
"recorded": true
}
{
"error": "invalid_request",
"message": "message must not be empty."
}
{
"error": "key_invalid",
"message": "This key is not valid. Check it was copied in full."
}
{
"error": "plan_not_included",
"message": "The Assistant API needs a Standard plan or higher."
}
{
"error": "answer_not_found",
"message": "No answer with this id was given to this key in the last 30 days."
}
{
"error": "request_too_large",
"message": "Requests are limited to 64 KB."
}
{
"error": "rate_limited",
"message": "This key allows 60 requests a minute. Retry after 12 seconds.",
"retry_after_seconds": 12
}
{
"error": "internal_error",
"message": "Something went wrong on our side. Retry shortly."
}
{
"error": "temporarily_unavailable",
"message": "The assistant could not answer right now. Retry shortly.",
"retry_after_seconds": 5
}
/feedback
Target server for requests. Edit to use your own host.
An Assistant API key from Settings > Assistant API: the secret key (asst_sk_...) from servers and tools, or the publishable key (asst_pk_...) or a reader credential (asst_rc_...) from pages on the key's allowed origins. See Authentication.
asst_sk_...) from servers and tools, or the publishable key (asst_pk_...) or a reader credential (asst_rc_...) from pages on the key's allowed origins. See Authentication.The media type of the request body
The id of an answer given to the same key in the last 30 days.
Whether the answer helped.
Request Preview
Response
Response will appear here after sending the request
Authentication
Bearer token. An Assistant API key from Settings > Assistant API: the secret key (asst_sk_...) from servers and tools, or the publishable key (asst_pk_...) or a reader credential (asst_rc_...) from pages on the key's allowed origins. See Authentication.
Body
The id of an answer given to the same key in the last 30 days.
ans_7f3c2a9e41b84d0e9a1c6b5d2e8f0a13Responses
Always true.