Skip to content

EndUser Audit Logs

Overview

The EndUser Audit Logs API provides access to audit logs that record end user operations and security events within the tenant. Use this for compliance requirements and security investigations.

Endpoint List

MethodEndpointDescription
GET/api/admin/audit-logsList audit logs
GET/api/admin/audit-logs/:idGet audit log details
POST/api/admin/audit-logs/exportExport audit logs

List Audit Logs

Retrieve a list of audit logs.

Endpoint

GET /api/admin/audit-logs

Query Parameters

ParameterTypeRequiredDescription
limitinteger-Number of items (default: 50, max: 100)
cursorstring-Pagination cursor
actor_idstring-User ID of the actor
target_idstring-Resource ID of the target
actionstring-Action type
resource_typestring-Resource type
start_datestring-Start date (ISO 8601 format)
end_datestring-End date (ISO 8601 format)
ip_addressstring-IP address
resultstring-Result (success, failure)

Request Example

Terminal window
curl -X GET "https://{tenant-domain}/api/admin/audit-logs?action=user.create&start_date=2024-01-01T00:00:00Z" \
-H "Authorization: Bearer {token}"

Response Example

{
"items": [
{
"id": "log_abc123",
"timestamp": "2024-01-22T10:30:00Z",
"actor": {
"id": "usr_admin001",
"email": "[email protected]",
"type": "user"
},
"action": "user.create",
"resource_type": "user",
"resource_id": "usr_new789",
"result": "success",
"ip_address": "203.0.113.1",
"user_agent": "Mozilla/5.0...",
"changes": {
"email": "[email protected]",
"name": "New User"
}
}
],
"total": 1250,
"cursor": "eyJpZCI6ImxvZ19hYmMxMjMifQ=="
}

Get Audit Log Details

Retrieve detailed information for a specified audit log.

Endpoint

GET /api/admin/audit-logs/:id

Path Parameters

ParameterTypeRequiredDescription
idstringAudit log ID

Request Example

Terminal window
curl -X GET "https://{tenant-domain}/api/admin/audit-logs/log_abc123" \
-H "Authorization: Bearer {token}"

Response Example

{
"id": "log_abc123",
"timestamp": "2024-01-22T10:30:00Z",
"actor": {
"id": "usr_admin001",
"email": "[email protected]",
"name": "Administrator",
"type": "user",
"role": "tenant_admin"
},
"action": "user.create",
"action_description": "Created a user",
"resource_type": "user",
"resource_id": "usr_new789",
"result": "success",
"ip_address": "203.0.113.1",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)...",
"location": {
"country": "JP",
"city": "Tokyo"
},
"request": {
"method": "POST",
"path": "/api/admin/users",
"body": {
"email": "[email protected]",
"name": "New User"
}
},
"changes": {
"before": null,
"after": {
"id": "usr_new789",
"email": "[email protected]",
"name": "New User",
"status": "active"
}
},
"metadata": {
"request_id": "req_xyz456",
"session_id": "sess_def789"
}
}

Export Audit Logs

Export audit logs in CSV or JSON format.

Endpoint

POST /api/admin/audit-logs/export

Request Body

FieldTypeRequiredDescription
formatstringExport format (csv, json)
start_datestringStart date (ISO 8601 format)
end_datestringEnd date (ISO 8601 format)
filtersobject-Filter conditions

Request Example

Terminal window
curl -X POST "https://{tenant-domain}/api/admin/audit-logs/export" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"format": "csv",
"start_date": "2024-01-01T00:00:00Z",
"end_date": "2024-01-31T23:59:59Z",
"filters": {
"action": "user.*"
}
}'

Response Example

{
"job_id": "job_export_abc123",
"status": "pending",
"created_at": "2024-01-22T10:30:00Z"
}

Exports are executed as asynchronous jobs. Check job status via the Jobs Management API.


Action Types

User Actions

ActionDescription
user.createUser created
user.updateUser updated
user.deleteUser deleted
user.suspendUser suspended
user.unsuspendUser unsuspended
user.lockUser locked
user.unlockUser unlocked
user.anonymizeUser anonymized

Authentication Actions

ActionDescription
auth.loginLogin
auth.logoutLogout
auth.login_failedLogin failed
auth.mfa_enabledMFA enabled
auth.mfa_disabledMFA disabled
auth.password_changedPassword changed
auth.password_resetPassword reset

Client Actions

ActionDescription
client.createClient created
client.updateClient updated
client.deleteClient deleted
client.secret_rotatedSecret rotated

Session Actions

ActionDescription
session.revokeSession revoked
session.revoke_allAll sessions revoked

Role & Policy Actions

ActionDescription
role.createRole created
role.updateRole updated
role.deleteRole deleted
role.assignRole assigned
role.unassignRole unassigned
policy.createPolicy created
policy.updatePolicy updated
policy.deletePolicy deleted

Settings Actions

ActionDescription
settings.updateSettings updated
webhook.createWebhook created
webhook.updateWebhook updated
webhook.deleteWebhook deleted

Audit Log Retention

Audit logs are retained based on tenant settings. The default retention period is 90 days. You can modify the retention period via the Settings Management API.