cURL
curl -X POST 'https://api.gumloop.com/api/v1/sessions/sess_xYz789AbCd/cancel' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'from gumloop import Gumloop
client = Gumloop(access_token="YOUR_ACCESS_TOKEN")
response = client.sessions.cancel("sess_xYz789AbCd")
print(response.session.state)
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.gumloop.com/api/v1/sessions/{session_id}/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://api.gumloop.com/api/v1/sessions/{session_id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.gumloop.com/api/v1/sessions/{session_id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.gumloop.com/api/v1/sessions/{session_id}/cancel")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gumloop.com/api/v1/sessions/{session_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"session": {
"id": "sess_xYz789AbCd",
"agent_id": "abc123DEFghiJKL",
"messages": [],
"created_at": null,
"state": "failed",
"agent_name": null,
"agent_team_id": null,
"agent_creator_user_id": null,
"agent_icon_url": null,
"agent_tools": [],
"participants": {},
"creator": null
},
"queue_position": null
}Cancel session
Cancel an in-progress session. If the session is currently processing or queued, any running stream is aborted and the session is transitioned to failed. If the session is already completed or failed, its current state is returned unchanged.
The response carries a session envelope but only id, agent_id, and state are populated.
POST
/
sessions
/
{session_id}
/
cancel
cURL
curl -X POST 'https://api.gumloop.com/api/v1/sessions/sess_xYz789AbCd/cancel' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'from gumloop import Gumloop
client = Gumloop(access_token="YOUR_ACCESS_TOKEN")
response = client.sessions.cancel("sess_xYz789AbCd")
print(response.session.state)
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.gumloop.com/api/v1/sessions/{session_id}/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://api.gumloop.com/api/v1/sessions/{session_id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.gumloop.com/api/v1/sessions/{session_id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.gumloop.com/api/v1/sessions/{session_id}/cancel")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gumloop.com/api/v1/sessions/{session_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"session": {
"id": "sess_xYz789AbCd",
"agent_id": "abc123DEFghiJKL",
"messages": [],
"created_at": null,
"state": "failed",
"agent_name": null,
"agent_team_id": null,
"agent_creator_user_id": null,
"agent_icon_url": null,
"agent_tools": [],
"participants": {},
"creator": null
},
"queue_position": null
}Authorizations
Path Parameters
ID of the session to cancel.
Was this page helpful?
⌘I
