Skip to Content
Referência da APIAPI de Logs de Auditoria

Audit Logs API

Auris automatically records every administrative action, authentication event, and security-relevant operation in an immutable audit trail. The Audit Logs API provides read access to these logs and management of log streaming configurations that forward events to external observability platforms.

Audit logs are retained according to your plan’s retention policy. All log entries are immutable — they cannot be edited or deleted through the API.

All endpoints require the x-tenant header and a valid Bearer token.

Querying Logs

GET/api/audit-logsRequires: view:audit_logs

List audit log entries with filtering and pagination. Results are returned in reverse chronological order (newest first). Supports filtering by action, user, resource type, severity level, date range, and free-text search.

Query parameters

ParameterTypeDescription
pageintegerPage number (default: 1)
limitintegerItems per page (default: 20, max: 100)
actionstringFilter by action name (e.g., user.login, role.update, sso.connection.create)
userIdstringFilter by the user ID who performed the action
resourceTypestringFilter by resource type (e.g., user, role, application, organization, sso_connection)
levelinfo | warn | errorFilter by log severity level
dateFromISO 8601Start of date range (inclusive)
dateToISO 8601End of date range (inclusive)
searchstringFree-text search across action, resource type, and details

Example request

GET /api/audit-logs?action=user.login&level=error&dateFrom=2025-02-01T00:00:00Z&limit=50

Success response

{ "ok": true, "data": { "data": [ { "id": "log_abc123", "action": "user.login", "userId": "usr_def456", "resourceType": "session", "resourceId": "sess_ghi789", "details": { "method": "password", "success": false, "reason": "invalid_credentials" }, "level": "error", "ipAddress": "203.0.113.42", "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36", "createdAt": "2025-02-18T14:30:00Z" }, { "id": "log_jkl012", "action": "role.update", "userId": "usr_admin001", "resourceType": "role", "resourceId": "role_mno345", "details": { "before": { "name": "editor", "permissionsChanged": 3 }, "after": { "name": "editor", "permissionsChanged": 3, "permissions": ["view:invoices", "create:invoices", "edit:invoices"] } }, "level": "info", "ipAddress": "10.0.1.50", "userAgent": "AurisConsole/1.0", "createdAt": "2025-02-18T13:15:00Z" } ], "pagination": { "page": 1, "limit": 50, "total": 1284, "totalPages": 26 } } }

Log Entry Shape

Every audit log entry has the following structure:

FieldTypeDescription
idstringUnique identifier for the log entry
actionstringThe action that was performed (dot-notation, e.g., user.create, role.permission.update)
userIdstring | nullThe user who performed the action. Null for system-generated events (cron jobs, webhooks).
resourceTypestringThe type of resource affected (e.g., user, role, application, organization, session, sso_connection, log_stream)
resourceIdstring | nullThe ID of the specific resource affected
detailsobjectAction-specific data. For mutations, typically includes before and after snapshots.
levelinfo | warn | errorSeverity level of the event
ipAddressstring | nullIP address of the client that triggered the action
userAgentstring | nullUser-Agent header from the request
createdAtISO 8601Timestamp of when the event occurred

Common Action Types

ActionLevelDescription
user.logininfo/errorUser login attempt (success or failure)
user.login.2fainfoTwo-factor authentication completed
user.signupinfoNew user registration
user.createinfoAdmin created a user
user.updateinfoUser profile updated
user.deletewarnUser account deleted
user.disablewarnUser account disabled
user.password.changeinfoPassword changed
user.password.resetinfoPassword reset initiated
role.createinfoRole created
role.updateinfoRole metadata updated
role.deletewarnRole deleted
role.permission.updateinfoRole permissions changed
role.assigninfoRole assigned to a user
role.unassigninfoRole removed from a user
application.createinfoApplication created
application.updateinfoApplication settings updated
application.secret.rotatewarnApplication client secret rotated
organization.createinfoOrganization created
organization.member.addinfoMember added to organization
organization.member.removewarnMember removed from organization
sso.connection.createinfoSSO connection configured
sso.connection.activateinfoSSO connection activated
sso.connection.deactivatewarnSSO connection deactivated
session.revokewarnAdmin revoked a user session
token.exchangewarnToken exchange (impersonation or delegation)
log_stream.createinfoLog stream configured
security.brute_force.lockouterrorAccount locked due to brute force
security.suspicious_loginwarnSuspicious login detected

The details field for mutation events (create, update, delete) typically includes before and after snapshots where applicable. For sensitive fields like passwords and secrets, only the fact that the field changed is recorded — not the actual values.

Log Streaming

Log streaming forwards audit events in real-time to external observability and SIEM platforms. When a log stream is configured and active, every audit event is sent to the configured destination in addition to being stored in the Auris database.

GET/api/log-streamsRequires: manage:log_streams

List all configured log streams for the tenant. Returns stream metadata, type, status, and last delivery time.

Success response

{ "ok": true, "data": [ { "id": "ls_abc123", "name": "Production Datadog", "type": "DATADOG", "status": "active", "config": { "region": "us1", "apiKey": "dd_api_***...***" }, "lastDeliveryAt": "2025-02-18T14:29:55Z", "createdAt": "2025-01-10T09:00:00Z" }, { "id": "ls_def456", "name": "SIEM Webhook", "type": "WEBHOOK", "status": "active", "config": { "url": "https://siem.internal.acme.com/auris-logs", "headers": { "X-Custom-Header": "value" } }, "lastDeliveryAt": "2025-02-18T14:29:58Z", "createdAt": "2025-02-01T11:30:00Z" } ] }
POST/api/log-streamsRequires: manage:log_streams

Create a new log stream. Each stream type requires a different configuration shape. Auris validates the configuration and optionally performs a test delivery before saving.

Stream Type: WEBHOOK

Sends each audit event as an HTTP POST to the specified URL. Supports custom headers for authentication.

Request body

{ "name": "SIEM Webhook", "type": "WEBHOOK", "config": { "url": "https://siem.internal.acme.com/auris-logs", "headers": { "Authorization": "Bearer your-siem-token", "X-Source": "auris" } } }
Config FieldRequiredDescription
urlYesHTTPS endpoint to receive log events
headersNoCustom HTTP headers sent with each delivery

The webhook payload is the JSON audit log entry, sent with Content-Type: application/json.

Stream Type: S3

Batches audit events and uploads them as JSON files to an S3-compatible bucket.

Request body

{ "name": "S3 Archive", "type": "S3", "config": { "bucket": "auris-audit-logs", "region": "us-east-1", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", "prefix": "auris/tenant-name/" } }
Config FieldRequiredDescription
bucketYesS3 bucket name
regionYesAWS region (e.g., us-east-1)
accessKeyIdYesAWS access key ID with s3:PutObject permission
secretAccessKeyYesAWS secret access key
prefixNoKey prefix for uploaded files (default: auris-logs/)

Files are uploaded with keys in the format: {prefix}YYYY/MM/DD/HH-mm-ss-{uuid}.json.

Stream Type: DATADOG

Sends audit events to the Datadog Log Management API.

Request body

{ "name": "Datadog Logs", "type": "DATADOG", "config": { "apiKey": "dd_api_key_here", "region": "us1", "service": "auris-iam", "source": "auris" } }
Config FieldRequiredDescription
apiKeyYesDatadog API key
regionYesDatadog region: us1, us3, us5, eu1, ap1
serviceNoService name tag (default: auris)
sourceNoSource tag (default: auris)

Stream Type: SPLUNK

Sends audit events to Splunk via the HTTP Event Collector (HEC).

Request body

{ "name": "Splunk HEC", "type": "SPLUNK", "config": { "hecUrl": "https://splunk.internal.acme.com:8088/services/collector/event", "hecToken": "your-hec-token", "index": "auris_audit", "source": "auris-iam", "sourcetype": "_json" } }
Config FieldRequiredDescription
hecUrlYesSplunk HEC endpoint URL
hecTokenYesHEC authentication token
indexNoSplunk index (default: main)
sourceNoSource value (default: auris)
sourcetypeNoSourcetype value (default: _json)

Success response (all types)

{ "ok": true, "data": { "id": "ls_ghi789", "name": "Datadog Logs", "type": "DATADOG", "status": "active", "config": { "region": "us1", "apiKey": "dd_api_***...***", "service": "auris-iam", "source": "auris" }, "createdAt": "2025-02-18T10:00:00Z" } }

Sensitive fields in the config (API keys, secrets, tokens) are masked in GET responses. The full values are only used internally for delivery and are never exposed through the API after creation.

Error codes

CodeHTTPDescription
VALIDATION_ERROR400Missing required config fields or invalid stream type
STREAM_NAME_TAKEN409A log stream with this name already exists
TEST_DELIVERY_FAILED400Test delivery to the configured endpoint failed (returned when the endpoint is unreachable or rejects the test event)
GET/api/log-streams/[id]Requires: manage:log_streams

Get full details for a specific log stream, including its configuration (with secrets masked), status, and delivery statistics.

Success response

{ "ok": true, "data": { "id": "ls_abc123", "name": "Production Datadog", "type": "DATADOG", "status": "active", "config": { "region": "us1", "apiKey": "dd_api_***...***", "service": "auris-iam", "source": "auris" }, "lastDeliveryAt": "2025-02-18T14:29:55Z", "deliveryCount": 15420, "errorCount": 3, "lastError": null, "createdAt": "2025-01-10T09:00:00Z", "updatedAt": "2025-02-15T08:00:00Z" } }
PATCH/api/log-streams/[id]Requires: manage:log_streams

Update a log stream’s name, configuration, or status. Use this to rotate API keys, change endpoints, or pause/resume streaming.

Request body — update config

{ "name": "Production Datadog (v2)", "config": { "apiKey": "new_dd_api_key_here" } }

Request body — pause streaming

{ "status": "paused" }

Success response

{ "ok": true, "data": { "id": "ls_abc123", "name": "Production Datadog (v2)", "status": "active", "updatedAt": "2025-02-18T11:00:00Z" } }

Stream statuses:

StatusDescription
activeStreaming events to the destination
pausedStream is paused — events are not delivered but are still recorded in Auris
errorDelivery has failed repeatedly — stream is auto-paused until configuration is corrected
DELETE/api/log-streams/[id]Requires: manage:log_streams

Delete a log stream. Delivery stops immediately. Historical audit logs are not affected — they remain in the Auris database regardless of streaming configuration.

Success response

{ "ok": true, "data": { "deleted": true } }

Permissions Reference

PermissionDescription
view:audit_logsQuery and read audit log entries
manage:log_streamsCreate, update, delete, and configure log streaming destinations

Audit logs are append-only and immutable. There is no API endpoint to delete or modify log entries. This ensures the integrity of the audit trail for compliance purposes (SOC 2, ISO 27001, GDPR Article 30).

Webhook Delivery Format

For WEBHOOK-type log streams, each event is delivered as an HTTP POST with the following structure:

{ "event": "audit_log", "timestamp": "2025-02-18T14:30:00Z", "tenant": "acme-corp", "data": { "id": "log_abc123", "action": "user.login", "userId": "usr_def456", "resourceType": "session", "resourceId": "sess_ghi789", "details": { "method": "password", "success": true }, "level": "info", "ipAddress": "203.0.113.42", "userAgent": "Mozilla/5.0...", "createdAt": "2025-02-18T14:30:00Z" } }

The webhook includes the headers configured in the log stream plus Content-Type: application/json and User-Agent: Auris-LogStream/1.0. Deliveries are retried up to 3 times with exponential backoff (5s, 30s, 120s) on non-2xx responses.