Skip to main content

Audit Logging

TrustGate maintains comprehensive audit logs of all actions taken on applicants, cases, and system configurations. These logs are essential for regulatory compliance, security monitoring, and incident investigation.

What's Logged

User Actions

Every action by users and API clients:

Event TypeExamples
Applicant ActionsView, create, update, delete applicants
Document ActionsUpload, view, download documents
Verification ActionsInitiate, review verifications
Case ActionsCreate, assign, resolve cases
Screening ActionsRun screens, resolve hits
Settings ChangesUpdate configurations

System Events

Automated system actions:

Event TypeExamples
Workflow TriggersAuto-approve, escalation rules
Scheduled JobsPeriodic reviews, data retention
IntegrationsWebhook deliveries, third-party calls
Security EventsLogin attempts, permission changes

API Endpoints

The audit log API is mounted at /api/v1/audit-log. All endpoints require the read:settings permission.

MethodPathDescription
GET/api/v1/audit-logList audit logs with filtering and pagination
GET/api/v1/audit-log/{entry_id}Get a single audit log entry by ID
GET/api/v1/audit-log/export/csvExport audit logs as a CSV file
GET/api/v1/audit-log/verify/chainVerify integrity of the audit log hash chain
GET/api/v1/audit-log/stats/summaryGet audit log statistics and breakdowns
GET/api/v1/audit-log/filters/optionsGet distinct values for filter dropdowns

Listing Audit Logs

Request

curl -X GET "https://api.bytrustgate.com/api/v1/audit-log?action=applicant.status_changed&start_date=2026-01-01T00:00:00Z&end_date=2026-01-31T23:59:59Z&actor_id=USER_UUID&limit=50&offset=0&sort_order=desc" \
-H "Authorization: Bearer YOUR_API_KEY"

Query Parameters

ParameterTypeDescription
resource_typestringFilter by resource type (applicant, case, document, screening_hit)
resource_idUUIDFilter by specific resource UUID
actor_idUUIDFilter by the user who performed the action
actionstringFilter by action type (e.g., applicant.created, case.resolved)
start_datedatetimeFilter entries after this date (ISO 8601)
end_datedatetimeFilter entries before this date (ISO 8601)
searchstringSearch in action name or user email
limitintNumber of results to return (1-100, default: 50)
offsetintNumber of results to skip (default: 0)
sort_orderstringasc or desc (default: desc -- newest first)

Response

{
"items": [
{
"id": 1234,
"tenant_id": "550e8400-e29b-41d4-a716-446655440000",
"user_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"user_email": "analyst@company.com",
"ip_address": "192.168.1.1",
"action": "applicant.status_changed",
"resource_type": "applicant",
"resource_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"old_values": { "status": "pending_review" },
"new_values": { "status": "approved" },
"extra_data": { "reason": "All checks passed" },
"checksum": "a3f2b8c1d4e5f67890abcdef1234567890abcdef1234567890abcdef12345678",
"created_at": "2026-01-20T14:35:00Z"
}
],
"total": 45,
"limit": 50,
"offset": 0
}

Filtering by Applicant

To get audit logs for a specific applicant, use the resource_type and resource_id query parameters:

curl -X GET "https://api.bytrustgate.com/api/v1/audit-log?resource_type=applicant&resource_id=APPLICANT_UUID" \
-H "Authorization: Bearer YOUR_API_KEY"

Getting a Single Entry

Request

curl -X GET "https://api.bytrustgate.com/api/v1/audit-log/{entry_id}" \
-H "Authorization: Bearer YOUR_API_KEY"

Response

Returns the same fields as a list item, plus additional detail fields:

{
"id": 1234,
"tenant_id": "550e8400-e29b-41d4-a716-446655440000",
"user_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"user_email": "analyst@company.com",
"ip_address": "192.168.1.1",
"action": "applicant.status_changed",
"resource_type": "applicant",
"resource_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"old_values": { "status": "pending_review" },
"new_values": { "status": "approved" },
"extra_data": {},
"checksum": "a3f2b8c1d4e5f67890abcdef1234567890abcdef1234567890abcdef12345678",
"created_at": "2026-01-20T14:35:00Z",
"user_agent": "Mozilla/5.0...",
"resource_name": null
}

Action Types

Applicant Actions

ActionDescription
applicant.createdNew applicant created
applicant.viewedApplicant record accessed
applicant.updatedApplicant data modified
applicant.deletedApplicant record deleted
applicant.status_changedStatus updated
applicant.exportedData exported

Document Actions

ActionDescription
document.uploadedDocument uploaded
document.viewedDocument image accessed
document.downloadedDocument downloaded
document.deletedDocument removed
document.verifiedVerification completed

Verification Actions

ActionDescription
verification.initiatedCheck started
verification.completedCheck finished
verification.manual_reviewManual override applied

Case Actions

ActionDescription
case.createdCase opened
case.assignedCase assigned to user
case.status_changedCase status updated
case.note_addedNote added to case
case.resolvedCase resolved
case.closedCase closed

Security Actions

ActionDescription
auth.loginUser login
auth.logoutUser logout
auth.login_failedFailed login attempt
auth.password_changedPassword updated
auth.mfa_enabledMFA turned on
api_key.createdNew API key created
api_key.revokedAPI key revoked
permission.grantedPermission added
permission.revokedPermission removed

Log Entry Fields

Each audit log entry contains:

FieldTypeDescription
idintSequential ID (BigInteger) for ordering
tenant_idUUIDTenant the entry belongs to
user_idUUIDID of the user who performed the action (null for system actions)
user_emailstringEmail of the acting user
ip_addressstringIP address of the request (INET format)
actionstringAction type (e.g., applicant.created)
resource_typestringResource type (e.g., applicant, case, document)
resource_idUUIDID of the affected resource
old_valuesJSONPrevious state of changed fields (null if not applicable)
new_valuesJSONNew state of changed fields (null if not applicable)
extra_dataJSONAdditional context (reason, trigger, etc.)
checksumstringSHA-256 chain hash for tamper evidence
created_atdatetimeTimestamp of the action

Exporting Audit Logs

Export audit logs as a CSV file. Supports the same filters as the list endpoint. Limited to 10,000 entries per export.

Request

curl -X GET "https://api.bytrustgate.com/api/v1/audit-log/export/csv?resource_type=applicant&start_date=2026-01-01T00:00:00Z&end_date=2026-01-31T23:59:59Z" \
-H "Authorization: Bearer YOUR_API_KEY" \
-o audit_log_export.csv

Query Parameters

ParameterTypeDescription
resource_typestringFilter by resource type
resource_idUUIDFilter by specific resource UUID
actor_idUUIDFilter by the user who performed the action
actionstringFilter by action type
start_datedatetimeFilter entries after this date
end_datedatetimeFilter entries before this date

Response

Returns a CSV file download with the following columns:

ColumnDescription
IDSequential audit log entry ID
TimestampISO 8601 timestamp
User EmailEmail of the acting user
User IDUUID of the acting user
IP AddressRequest IP address
ActionAction type
Resource TypeType of affected resource
Resource IDUUID of the affected resource
Old ValuesPrevious field values (JSON)
New ValuesUpdated field values (JSON)
ChecksumChain hash for integrity verification

The response includes an X-Total-Count header with the number of exported entries.

Log Integrity

Tamper Protection

  • Logs are append-only and immutable
  • Each entry includes a SHA-256 checksum chained from the previous entry
  • The chain hash covers: tenant ID, user ID, action, resource type, resource ID, old/new values, and timestamp
  • Any modification to a log entry breaks the chain, making tampering detectable

Verify Chain Integrity

Recalculate checksums and compare them against stored values. Any mismatch indicates potential tampering.

curl -X GET "https://api.bytrustgate.com/api/v1/audit-log/verify/chain?limit=1000" \
-H "Authorization: Bearer YOUR_API_KEY"
ParameterTypeDescription
limitintNumber of entries to verify (100-10,000, default: 1,000)

Response

{
"is_valid": true,
"total_entries": 125000,
"entries_verified": 1000,
"invalid_entry_ids": [],
"verified_at": "2026-01-20T00:00:00Z"
}

If is_valid is false, the invalid_entry_ids array lists the IDs of entries whose checksums do not match the expected chain hash.

Audit Statistics

Get summary statistics about audit log activity.

Request

curl -X GET "https://api.bytrustgate.com/api/v1/audit-log/stats/summary" \
-H "Authorization: Bearer YOUR_API_KEY"

Response

{
"total_entries": 125000,
"entries_today": 342,
"entries_this_week": 2150,
"entries_this_month": 8420,
"actions_breakdown": {
"applicant.viewed": 1200,
"applicant.created": 450,
"document.uploaded": 380,
"case.resolved": 120
},
"resource_types_breakdown": {
"applicant": 2800,
"document": 1200,
"case": 500
},
"top_users": [
{
"email": "analyst@company.com",
"user_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"count": 540
}
]
}

Breakdowns cover the last 30 days. Top users are limited to 5 entries.

Filter Options

Get distinct values for building filter dropdowns in the UI.

Request

curl -X GET "https://api.bytrustgate.com/api/v1/audit-log/filters/options" \
-H "Authorization: Bearer YOUR_API_KEY"

Response

{
"actions": [
"applicant.created",
"applicant.viewed",
"case.resolved",
"document.uploaded"
],
"resource_types": [
"applicant",
"case",
"document"
],
"users": [
{
"id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"email": "analyst@company.com"
}
]
}

Log Retention

Log TypeRetention
Security events7 years
Applicant actions5 years
System events2 years
Debug logs90 days

Next Steps