Sets the message state to canceled when the message is not already terminal (completed, failed, or canceled). Returns 409 when the message is already terminal. Requires JWT with at least read scope.
POST
/
messages
/
cancel
Cancel a running message
curl --request POST \
--url https://api.svantic.com/messages/cancel \
--header 'Content-Type: application/json' \
--data '
{
"message_id": "<string>"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({message_id: '<string>'})
};
fetch('https://api.svantic.com/messages/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.svantic.com/messages/cancel"
payload = { "message_id": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.svantic.com/messages/cancel"
payload := strings.NewReader("{\n \"message_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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))
}{
"ok": true,
"message_id": "<string>"
}{
"error": "Invalid request body",
"code": "BAD_REQUEST"
}{
"error": "Invalid or expired token",
"code": "unauthorized"
}{
"error": "JWT does not include the required scope for this operation",
"code": "forbidden"
}{
"error": "<string>",
"code": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"code": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}{
"error": "Internal server error",
"code": "INTERNAL_ERROR",
"request_id": "req_01EXAMPLE",
"timestamp": "2026-03-31T12:00:00.000Z"
}⌘I
Cancel a running message
curl --request POST \
--url https://api.svantic.com/messages/cancel \
--header 'Content-Type: application/json' \
--data '
{
"message_id": "<string>"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({message_id: '<string>'})
};
fetch('https://api.svantic.com/messages/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.svantic.com/messages/cancel"
payload = { "message_id": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.svantic.com/messages/cancel"
payload := strings.NewReader("{\n \"message_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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))
}{
"ok": true,
"message_id": "<string>"
}{
"error": "Invalid request body",
"code": "BAD_REQUEST"
}{
"error": "Invalid or expired token",
"code": "unauthorized"
}{
"error": "JWT does not include the required scope for this operation",
"code": "forbidden"
}{
"error": "<string>",
"code": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"code": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}{
"error": "Internal server error",
"code": "INTERNAL_ERROR",
"request_id": "req_01EXAMPLE",
"timestamp": "2026-03-31T12:00:00.000Z"
}