Skip to content

Delete Session

DELETE/v1/sessions/{session_id}

Permanently delete a session and all its event history. This action is irreversible.

A running session cannot be deleted — interrupt it first, wait for idle status, then delete.

Path Parameters

ParameterTypeRequiredDescription
session_idstringyesThe session ID (sess_...)

Request Examples

python
from anthropic import Anthropic

client = Anthropic(
    api_key="sk-sb-YOUR_KEY",
    base_url="https://api.sandbase.ai"
)

result = client.beta.sessions.delete(
    session_id="sess_01abc..."
)
print(result.id)    # "sess_01abc..."
print(result.type)  # "session_deleted"
bash
curl -X DELETE https://api.sandbase.ai/v1/sessions/sess_01abc... \
  -H "Authorization: Bearer sk-sb-YOUR_KEY"

Response

json
{
  "id": "sess_01abc...",
  "type": "session_deleted"
}
FieldTypeDescription
idstringThe deleted session ID
typestringAlways "session_deleted"

Errors

StatusTypeDescription
401authentication_errorInvalid or missing API key
404not_foundSession not found
409conflictSession is running. Send user.interrupt first, wait for idle, then delete.