Skip to content

API reference batch 6 — DLP events, DLP stats, session management

This batch documents three endpoint groups used by the admin portal’s DLP incident workflow and session management panel.


Prefix: /api/dlp/events Auth: Admin JWT (Authorization: Bearer <token>) Tags: dlp-events

DLP events are structured incident records created when the DLP pipeline detects a policy violation. Unlike audit log entries (append-only), DLP events support lifecycle workflow: open → acknowledged → resolved / false_positive.

FieldTypeDescription
idstring (UUID)Event identifier
user_idstring | nullUUID of the user whose request triggered the event
conversation_idstring | nullUUID of the conversation
detector_namestringName of the detector that fired (e.g. "regex:CREDIT_CARD")
entity_typestringEntity type label (e.g. "CREDIT_CARD", "SSN", "PII_EMAIL")
matched_textstring | nullThe matched text value (may be null if not stored)
action_takenstringPolicy action applied (ALLOW, BLOCK, REDACT, FLAG)
statusstringLifecycle status: open, acknowledged, resolved, false_positive
severitystringlow, medium, high, critical
directionstringinput (user prompt) or output (model response)
resolution_notesstring | nullFree-text notes added when resolving
resolved_bystring | nullUUID of the admin who resolved the event
resolved_atdatetime | nullWhen the event was resolved
created_atdatetimeWhen the event was created

Create a new DLP event. Used by the DLP pipeline and admin tooling to record detection incidents.

Terminal window
POST /api/dlp/events
Authorization: Bearer <admin-token>
Content-Type: application/json
{
"user_id": "user_01abc123",
"conversation_id": "conv_01def456",
"detector_name": "regex:CREDIT_CARD",
"entity_type": "CREDIT_CARD",
"matched_text": "4111-****-****-1111",
"action_taken": "REDACT",
"direction": "input",
"severity": "high"
}

Response 201 Created:

{
"id": "evt_01ghi789",
"user_id": "user_01abc123",
"conversation_id": "conv_01def456",
"detector_name": "regex:CREDIT_CARD",
"entity_type": "CREDIT_CARD",
"matched_text": "4111-****-****-1111",
"action_taken": "REDACT",
"status": "open",
"severity": "high",
"direction": "input",
"resolution_notes": null,
"resolved_by": null,
"resolved_at": null,
"created_at": "2026-03-12T14:30:00Z"
}

List DLP events with optional filters. Results are paginated, newest first.

Query parameters:

ParameterTypeDescription
statusstringFilter by lifecycle status (open, acknowledged, resolved, false_positive)
entity_typestringFilter by entity type
severitystringFilter by severity (low, medium, high, critical)
directionstringinput or output
user_idstringFilter by user UUID
date_fromdatetimeEvents created on or after this datetime (ISO-8601)
date_todatetimeEvents created on or before this datetime (ISO-8601)
pageintegerPage number (default: 1)
page_sizeintegerItems per page (default: 50, max: 200)
Terminal window
GET /api/dlp/events?status=open&severity=high&page=1&page_size=25
Authorization: Bearer <admin-token>

Response 200 OK:

{
"items": [ /* DLPEventResponse[] */ ],
"total": 142,
"page": 1,
"page_size": 25
}

Get aggregated summary statistics for DLP events. Useful for dashboard widgets.

Terminal window
GET /api/dlp/events/summary
Authorization: Bearer <admin-token>

Response 200 OK:

{
"total": 1420,
"by_status": {
"open": 38,
"acknowledged": 12,
"resolved": 1340,
"false_positive": 30
},
"by_entity_type": {
"CREDIT_CARD": 210,
"SSN": 85,
"PII_EMAIL": 430
},
"by_severity": {
"low": 600,
"medium": 500,
"high": 280,
"critical": 40
}
}

Get a single DLP event by UUID.

Terminal window
GET /api/dlp/events/evt_01ghi789
Authorization: Bearer <admin-token>

Returns a DLPEventResponse or 404 if not found.

Update a DLP event’s lifecycle status and optionally add resolution notes.

When status transitions to resolved or false_positive, the resolved_by and resolved_at fields are set automatically from the authenticated admin’s identity.

Terminal window
PUT /api/dlp/events/evt_01ghi789
Authorization: Bearer <admin-token>
Content-Type: application/json
{
"status": "resolved",
"resolution_notes": "Confirmed false positive — test credit card data in dev environment"
}
status valueEffect
acknowledgedMoves event from open queue; sets no resolved_* fields
resolvedMarks as resolved; sets resolved_by and resolved_at
false_positiveMarks as a detection error; sets resolved_by and resolved_at

Returns the updated DLPEventResponse or 404 if not found.


Prefix: /api/dlp Auth: Admin JWT Tags: dlp

Get aggregated DLP detection statistics over a configurable time window. Provides breakdowns not available via the /summary endpoint — notably per-detector counts and daily trend data.

Query parameters:

ParameterTypeDefaultDescription
daysinteger30Look-back window in days (1–365)
Terminal window
GET /api/dlp/stats?days=7
Authorization: Bearer <admin-token>

Response 200 OK:

{
"total_events": 284,
"by_entity_type": [
{ "entity_type": "CREDIT_CARD", "count": 98 },
{ "entity_type": "PII_EMAIL", "count": 74 }
],
"by_severity": [
{ "severity": "high", "count": 112 },
{ "severity": "medium", "count": 102 }
],
"by_status": [
{ "status": "resolved", "count": 241 },
{ "status": "open", "count": 43 }
],
"by_detector": [
{ "detector_name": "regex:CREDIT_CARD", "count": 98 },
{ "detector_name": "ner:PERSON", "count": 66 }
],
"daily_trend": [
{ "date": "2026-03-06", "count": 32 },
{ "date": "2026-03-07", "count": 41 },
{ "date": "2026-03-08", "count": 38 }
]
}
FieldDescription
total_eventsTotal detection events in the window
by_entity_typeCounts per entity type label, sorted descending
by_severityCounts per severity level, sorted descending
by_statusCounts per lifecycle status, sorted descending
by_detectorCounts per detector name (regex/ner/ml), sorted descending
daily_trendOne entry per day in the window, count of events on that date

Prefix: /api/admin Auth: Admin JWT Tags: admin

Session management endpoints let admins list active user sessions and force-revoke them. Sessions are JWT-based and tracked in the database. When a session is force-revoked, its JTI (JWT ID) is added to the token blacklist so the corresponding token is immediately invalidated — even before its natural expiry.

FieldTypeDescription
idstring (UUID)Session identifier
user_idstringUUID of the session owner
token_jtistringJWT ID claim (unique per issued token)
ip_addressstring | nullClient IP at login
user_agentstring | nullClient User-Agent at login
is_activebooleanWhether the session is currently active
created_atdatetimeWhen the session was created (login time)
expires_atdatetimeWhen the JWT token expires

List all active sessions. Optionally filter to a specific user.

Query parameters:

ParameterTypeDescription
user_idUUIDFilter to sessions for a specific user
Terminal window
# All active sessions
GET /api/admin/sessions
Authorization: Bearer <admin-token>
# Sessions for a specific user
GET /api/admin/sessions?user_id=user_01abc123
Authorization: Bearer <admin-token>

Response 200 OK:

{
"items": [
{
"id": "sess_01abc",
"user_id": "user_01abc123",
"token_jti": "jti_xyz",
"ip_address": "203.0.113.50",
"user_agent": "Mozilla/5.0 ...",
"is_active": true,
"created_at": "2026-03-12T08:00:00Z",
"expires_at": "2026-03-13T08:00:00Z"
}
],
"total": 1
}

Results are ordered newest first.

Force-logout a specific session. The session is deactivated and its JWT is blacklisted immediately.

Terminal window
DELETE /api/admin/sessions/sess_01abc
Authorization: Bearer <admin-token>

Response 200 OK: Returns the deactivated SessionResponse.

404 if no active session with that ID exists.

DELETE /api/admin/users/{user_id}/sessions

Section titled “DELETE /api/admin/users/{user_id}/sessions”

Force-logout all active sessions for a specific user. Returns the list of revoked sessions with a count.

Terminal window
DELETE /api/admin/users/user_01abc123/sessions
Authorization: Bearer <admin-token>

Response 200 OK:

{
"items": [ /* SessionResponse[] */ ],
"total": 3
}

Use this endpoint when:

  • A user account is suspected compromised and all tokens must be invalidated
  • An admin resets a user’s password and wants to force re-authentication
  • Offboarding: ensure the user cannot continue using existing tokens

The Platform enforces a configurable concurrent session limit per user (default: 5). When a user logs in and would exceed this limit, the oldest active sessions are automatically evicted (FIFO). Evicted sessions are blacklisted immediately.

The limit is configurable system-wide via system_config.max_concurrent_sessions.