curl --request POST \
--url https://hiimpria.ai/api/ai/personal/turns/cancel \
--header 'Content-Type: application/json' \
--header 'x-access-token: <api-key>' \
--data '
{
"turnId": 1729350000123
}
'import requests
url = "https://hiimpria.ai/api/ai/personal/turns/cancel"
payload = { "turnId": 1729350000123 }
headers = {
"x-access-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({turnId: 1729350000123})
};
fetch('https://hiimpria.ai/api/ai/personal/turns/cancel', 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://hiimpria.ai/api/ai/personal/turns/cancel",
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([
'turnId' => 1729350000123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-access-token: <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://hiimpria.ai/api/ai/personal/turns/cancel"
payload := strings.NewReader("{\n \"turnId\": 1729350000123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-access-token", "<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://hiimpria.ai/api/ai/personal/turns/cancel")
.header("x-access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"turnId\": 1729350000123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hiimpria.ai/api/ai/personal/turns/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-access-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"turnId\": 1729350000123\n}"
response = http.request(request)
puts response.read_body{
"cancelled": true
}Stop a running chat reply by its turn id
Stops the caller’s own chat turn that is still generating, whether its stream
connection is still open or was already dropped (a dropped connection alone
never stops a turn: the reply keeps running and is saved). Use the same id
that was sent in the body of the streaming request (/api/ai/personal-stream/qanda-stream).
The turn ends promptly and is saved as stopped; the usage up to the Stop is charged as for any stopped reply.
cancelled: true means a running turn of yours was stopped by this request.
cancelled: false means nothing of yours with that id was running here: the
turn is unknown, already finished or already stopped. It is the same answer
in every case. A client may retry a few times, since a turn running on another
server cannot always be reached. Calling it twice is safe.
curl --request POST \
--url https://hiimpria.ai/api/ai/personal/turns/cancel \
--header 'Content-Type: application/json' \
--header 'x-access-token: <api-key>' \
--data '
{
"turnId": 1729350000123
}
'import requests
url = "https://hiimpria.ai/api/ai/personal/turns/cancel"
payload = { "turnId": 1729350000123 }
headers = {
"x-access-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({turnId: 1729350000123})
};
fetch('https://hiimpria.ai/api/ai/personal/turns/cancel', 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://hiimpria.ai/api/ai/personal/turns/cancel",
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([
'turnId' => 1729350000123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-access-token: <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://hiimpria.ai/api/ai/personal/turns/cancel"
payload := strings.NewReader("{\n \"turnId\": 1729350000123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-access-token", "<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://hiimpria.ai/api/ai/personal/turns/cancel")
.header("x-access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"turnId\": 1729350000123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hiimpria.ai/api/ai/personal/turns/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-access-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"turnId\": 1729350000123\n}"
response = http.request(request)
puts response.read_body{
"cancelled": true
}Authorizations
JWT token passed in x-access-token header
Body
The turn's id from the streaming request: a non-negative integer
(for example a millisecond timestamp) or a string of 1-64 letters,
digits, ., _, : or -. Compared as a string, so 1729350000123
and "1729350000123" name the same turn.
x >= 0Response
Whether a running turn of the caller's was stopped by this request.
Was this page helpful?