Delete Session
Call Create session first and replace the example session ID with its returned ID.
DELETE
/agent/v1/sessions/{session_id}● SupportedOfficial Claude documentation ↗
Request parameters
session_idstringrequiredpath: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
Returns
200
Permanently remove an idle or terminated session and its events after saving a deletion snapshot. Running sessions return 409 INVALID_STATE; interrupt first or wait until idle or terminated. Deleted sessions are unavailable to retrieval and event listing and disappear from lists.
Errors follow the Anthropic error format (type / message / request_id) — see error codes
Request
curl
# Call Create session first and replace the example session ID with its returned ID.
curl -X DELETE https://api.deepraxis.com/agent/v1/sessions/sesn_123 \
-H "Authorization: Bearer $PRAXIS_API_KEY"Python
# Call Create session first and replace the example session ID with its returned ID.
import requests
opts = dict(
base_url="https://api.deepraxis.com/agent",
api_key="$PRAXIS_API_KEY",
)
# /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
resp = requests.delete(
f"{opts['base_url']}/v1/sessions/sesn_123",
headers={"Authorization": f"Bearer {opts['api_key']}"},
)
print(resp.status_code, resp.json())TypeScript
// Call Create session first and replace the example session ID with its returned ID.
const opts = {
baseURL: "https://api.deepraxis.com/agent",
apiKey: "$PRAXIS_API_KEY",
};
// /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
const resp = await fetch(`${opts.baseURL}/v1/sessions/sesn_123`, {
method: "DELETE",
headers: { Authorization: `Bearer ${opts.apiKey}`, "Content-Type": "application/json" },
});
console.log(resp.status, await resp.json());Response 200
{
"id": "sesn_771c3fcb4a8c41229f35f9fcf6f3cd7d",
"type": "session_deleted"
}Response
HTTP 200
Successful response
application/json
| Name | Type | Description |
|---|---|---|
| id | string | Identifier of the object, as returned by the API; pass it in the path of follow-up calls on the same resource. |
| type | string | session_deleted confirms that the session and its events have been deleted. |