Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.truthlocks.com/llms.txt

Use this file to discover all available pages before exploring further.

Terminate Session

DELETE /v1/agent-sessions/{sessionID} Immediately terminates an active agent session. The session’s access token and refresh token are invalidated, and the session status transitions to "terminated". Any subsequent API calls using this session’s tokens will be rejected.
Session termination is recorded in the audit log with a AGENT_SESSION_TERMINATED event. A termination receipt is not automatically generated — use the receipts API to create one if your compliance workflow requires it.

Authentication

Requires X-API-Key header or Bearer JWT token. Tenant-scoped via X-Tenant-ID.

Path Parameters

sessionID
string
required
The MAIP session identifier (e.g., maip-sess:a1b2c3d4:9f8e7d6c5b4a3210).

Request Body

reason
string
Optional explanation for the termination. Recorded in the audit log. Maximum 1024 characters.

Response

status
string
Updated status, always "terminated" on success.
session_id
string
The MAIP session identifier that was terminated.

Example

curl -X DELETE https://api.truthlocks.com/v1/agent-sessions/maip-sess:a1b2c3d4:9f8e7d6c5b4a3210 \
  -H "X-API-Key: tl_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "Task completed. Cleaning up session resources."
  }'

Bulk Session Cleanup

To terminate all active sessions for a specific agent (e.g., during incident response), list sessions filtered by agent and status, then terminate each:
# 1. List active sessions for the agent
SESSIONS=$(curl -s -G https://api.truthlocks.com/v1/agent-sessions \
  -H "X-API-Key: tl_live_..." \
  -d "agent_id=maip:t1234567:01HYX3KPZQ7RJGBN0WFMV8SDEH" \
  -d "status=active" \
  | jq -r '.sessions[].session_id')

# 2. Terminate each session
for SID in $SESSIONS; do
  curl -X DELETE "https://api.truthlocks.com/v1/agent-sessions/$SID" \
    -H "X-API-Key: tl_live_..." \
    -H "Content-Type: application/json" \
    -d '{"reason": "Bulk cleanup during incident response SI-2026-0412"}'
done
For faster incident response, suspending the agent immediately blocks all session operations without requiring individual session termination.