Skip to content

Delete a chat session

DELETE
/api/v1/chat/sessions/{sessionId}
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.

sessionId
required
string

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

Session deleted

Media type*/*

A chat session that has been deleted, with whether it was the one the live stream was attached to

object
sessionId
required

The deleted session’s id

string
status
required

Always deleted

string

Example

deleted
wasActive
required

True 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

boolean

No such session, or not owned by the caller

Media type*/*

A refusal from the chat surface: the word error and the reason, written to be shown

object
message
required

What was refused and why, such as no open stream, no active session, or an unknown command

string
status
required

Always error. A client may branch on it rather than on the status code

string

Example

error