Delete a chat session
const url = 'http://localhost:11044/api/v1/chat/sessions/example';const options = {method: 'DELETE', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request DELETE \ --url http://localhost:11044/api/v1/chat/sessions/example \ --header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>'Hard-deletes a session and its messages. Refuses (404) if the session doesn’t exist or isn’t owned by the caller — [ChatSessionService.deleteSession] can’t tell those two cases apart from the outside, and shouldn’t: leaking which is which would tell a caller whether an id belongs to someone else. If the deleted session was the one currently attached to this user’s live chat stream, it’s detached too (wasActive: true in the response), so the SPA knows to navigate back to a blank chat rather than keep talking into a session that no longer exists — mirrors ChatSessionsSidebar.onDelete’s navigate-to-blank-/chat.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Id of the session to delete, as listed in sessionId by GET /api/v1/chat/sessions; 404 when no session of the caller’s has it
Responses
Section titled “Responses”Session deleted
A chat session that has been deleted, with whether it was the one the live stream was attached to
object
The deleted session’s id
Always deleted
Example
deletedTrue when this was the session attached to the caller’s live chat stream, which is detached too — a client should leave it for a blank chat
No such session, or not owned by the caller
A refusal from the chat surface: the word error and the reason, written to be shown
object
What was refused and why, such as no open stream, no active session, or an unknown command
Always error. A client may branch on it rather than on the status code
Example
error
