Delete a session
DELETE/api/sessions/:sessionId
Delete a session
Request
Responses
- 204
- 400
- 401
- 403
- 404
- 409
- 503
Session deleted
The session id has characters other than letters, digits and hyphens, or is longer than 128 characters
The API key is missing, unknown, revoked, or expired
The API key's role, session or chat scope, or IP allow-list does not allow this operation
Session not found
A credential teardown for the same session name is still in flight (retryable: the body carries code: 'SESSION_NAME_TEARDOWN_PENDING'; wait for it to settle and retry), OR another node currently holds this session's live engine and deleting it here would strip a session the owner is running, OR ownership changes while deletion runs. The first two refusals remove nothing. Ownership loss stops later deletion units; earlier batches may already be committed.
The session could not be read, checked, claimed or recorded for the delete because the database did not answer (nothing is deleted; a delete whose record the database did not confirm may have been recorded, and repeating it is safe), or, on SQLite, another database transaction stayed open for 10 s before a delete transaction (no further rows are removed). Retry the delete.