Skip to main content
POST
/
v1
/
sessions
/
{sessionId}
/
terminate
Terminate Session
curl --request POST \
  --url https://api.truthlocks.com/v1/sessions/{sessionId}/terminate \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "reason": "<string>"
}
'
{
  "session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "token": "<string>",
  "scopes": [
    "<string>"
  ],
  "status": "active",
  "metadata": {},
  "expires_at": "2023-11-07T05:31:56Z",
  "created_at": "2023-11-07T05:31:56Z",
  "terminated_at": "2023-11-07T05:31:56Z"
}

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.

Authorizations

X-API-Key
string
header
required

API key for machine-to-machine authentication

Path Parameters

sessionId
string<uuid>
required

Session identifier

Body

application/json
reason
string
required

Reason for termination

Response

Session terminated

session_id
string<uuid>
agent_id
string<uuid>
token
string

Session bearer token (returned once on creation)

scopes
string[]
status
enum<string>
Available options:
active,
terminated,
expired
metadata
object
expires_at
string<date-time>
created_at
string<date-time>
terminated_at
string<date-time>