End a session
curl --request DELETE \
--url http://localhost:3000/api/messaging/sessions/{sessionId}import requests
url = "http://localhost:3000/api/messaging/sessions/{sessionId}"
response = requests.delete(url)
print(response.text)const options = {method: 'DELETE'};
fetch('http://localhost:3000/api/messaging/sessions/{sessionId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/api/messaging/sessions/{sessionId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$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 := "http://localhost:3000/api/messaging/sessions/{sessionId}"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("http://localhost:3000/api/messaging/sessions/{sessionId}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/messaging/sessions/{sessionId}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body// 404 - Session not found
{
"error": "Session not found",
"code": "SESSION_NOT_FOUND",
"details": {
"sessionId": "abc-123"
}
}
Session Management
End Session
Explicitly end and delete a conversation session
DELETE
/
api
/
messaging
/
sessions
/
{sessionId}
End a session
curl --request DELETE \
--url http://localhost:3000/api/messaging/sessions/{sessionId}import requests
url = "http://localhost:3000/api/messaging/sessions/{sessionId}"
response = requests.delete(url)
print(response.text)const options = {method: 'DELETE'};
fetch('http://localhost:3000/api/messaging/sessions/{sessionId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/api/messaging/sessions/{sessionId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$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 := "http://localhost:3000/api/messaging/sessions/{sessionId}"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("http://localhost:3000/api/messaging/sessions/{sessionId}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/messaging/sessions/{sessionId}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body// 404 - Session not found
{
"error": "Session not found",
"code": "SESSION_NOT_FOUND",
"details": {
"sessionId": "abc-123"
}
}
This endpoint immediately ends a session regardless of its timeout configuration. The session is removed from memory but the underlying channel and messages are preserved for historical reference.
Path Parameters
string
required
The unique identifier of the session to delete
Response
boolean
Whether the session was successfully deleted
string
Confirmation message with the session ID
Example Response
{
"success": true,
"message": "Session abc-123-def-456 deleted successfully"
}
Error Responses
// 404 - Session not found
{
"error": "Session not found",
"code": "SESSION_NOT_FOUND",
"details": {
"sessionId": "abc-123"
}
}
Important Notes
- Deleting a session does not delete the conversation history
- The underlying channel and messages remain in the database
- Active WebSocket connections for the session will be terminated
- Any pending operations on the session will fail after deletion
Was this page helpful?

