Skip to main content
POST
/
context-documents
/
reviews
/
{review_id}
/
suggestions
/
{suggestion_id}
/
decide
Accept or dismiss a suggestion
curl --request POST \
  --url https://api.hyperspell.com/context-documents/reviews/{review_id}/suggestions/{suggestion_id}/decide \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "action": "<string>",
  "replacement_excerpt": "<string>"
}
'
import requests

url = "https://api.hyperspell.com/context-documents/reviews/{review_id}/suggestions/{suggestion_id}/decide"

payload = {
"action": "<string>",
"replacement_excerpt": "<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({action: '<string>', replacement_excerpt: '<string>'})
};

fetch('https://api.hyperspell.com/context-documents/reviews/{review_id}/suggestions/{suggestion_id}/decide', 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.hyperspell.com/context-documents/reviews/{review_id}/suggestions/{suggestion_id}/decide",
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([
'action' => '<string>',
'replacement_excerpt' => '<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.hyperspell.com/context-documents/reviews/{review_id}/suggestions/{suggestion_id}/decide"

payload := strings.NewReader("{\n \"action\": \"<string>\",\n \"replacement_excerpt\": \"<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.hyperspell.com/context-documents/reviews/{review_id}/suggestions/{suggestion_id}/decide")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"<string>\",\n \"replacement_excerpt\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.hyperspell.com/context-documents/reviews/{review_id}/suggestions/{suggestion_id}/decide")

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 \"action\": \"<string>\",\n \"replacement_excerpt\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": 123,
  "review_id": 123,
  "kind": "<string>",
  "original_excerpt": "<string>",
  "replacement_excerpt": "<string>",
  "proposed_change": "<string>",
  "rationale": "<string>",
  "sources": [
    {
      "type": "<string>",
      "title": "<string>",
      "url": "<string>",
      "chunk_id": "<string>",
      "excerpt": ""
    }
  ],
  "confidence": "<string>",
  "status": "<string>",
  "applied": true,
  "decided_by": "<string>",
  "decided_at": "2023-11-07T05:31:56Z",
  "created_at": "2023-11-07T05:31:56Z",
  "ai_replacement_excerpt": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

Authorization
string
header
required

API Key or JWT User Token. If using an API Key, set the X-As-User header to act as a specific user. A JWT User Token is always scoped to a specific user.

Path Parameters

review_id
integer
required
suggestion_id
integer
required

Body

application/json
action
string
required

'accept' or 'dismiss'

replacement_excerpt
string | null

Optional edited replacement text. When accepting, this is applied and persisted instead of the AI's original replacement_excerpt.

Response

Successful Response

id
integer
required
review_id
integer
required
kind
string
required
original_excerpt
string
required
replacement_excerpt
string
required
proposed_change
string
required
rationale
string
required
sources
SuggestionSource · object[]
required
confidence
string
required
status
string
required
applied
boolean
required
decided_by
string | null
required
decided_at
string<date-time> | null
required
created_at
string<date-time>
required
ai_replacement_excerpt
string | null