Skip to content

Get audit log by ID

GET
/api/v1/audit/{id}
curl --request GET \
--url http://localhost:3000/api/v1/audit/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \
--header 'X-API-Key: <X-API-Key>'

Retrieves a specific audit log entry.

id
required
string format: uuid

Audit log UUID

Audit log retrieved successfully

Media type application/json
object
id
required

Unique audit log identifier

string format: uuid
organizationId
required

Organization ID

string format: uuid
userId

User ID who performed the action

string format: uuid
userName

Display name of the user at the time of the action. Captured at write time so audit entries remain readable after the user is deleted.

string
apiKeyId

API key ID used for the action

string format: uuid
apiKeyName

Display name of the API key at the time of the action.

string
action
required

Type of action performed

string
Allowed values: CREATE READ UPDATE DELETE LOGIN LOGOUT LOGIN_FAILED PERMISSION_GRANTED PERMISSION_DENIED EXPORT IMPORT BULK_UPDATE BULK_DELETE PASSWORD_CHANGE API_KEY_CREATED API_KEY_REVOKED CERTIFICATE_ISSUED CERTIFICATE_REVOKED DEPLOYMENT_STARTED DEPLOYMENT_COMPLETED DEPLOYMENT_FAILED DEPLOYMENT_ROLLED_BACK DEVICE_ONBOARDING_REJECTED DEVICE_CAPABILITY_REPORT_REJECTED DEVICE_STATUS_REPORT_REJECTED DEVICE_DESIRED_STATE_FETCH_REJECTED DEVICE_ONBOARDING_REJECTED_SUMMARY
entityType
required

Entity type that was affected

string
entityId

ID of the affected entity

string format: uuid
entityName

Human-readable name of the affected entity

string
beforeState

State of the entity before the change

object
key
additional properties
any
afterState

State of the entity after the change

object
key
additional properties
any
changedFields
required

List of fields that were changed

Array<string>
ipAddress

IP address of the client

string
userAgent

User agent of the client

string
requestId

Request correlation ID

string
sessionId

Session ID

string
success
required

Whether the action was successful

boolean
errorMessage

Error message if action failed

string
metadata

Additional metadata

object
key
additional properties
any
createdAt
required

When the audit log was created

string format: date-time
Example
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"organizationId": "550e8400-e29b-41d4-a716-446655440001",
"userId": "550e8400-e29b-41d4-a716-446655440002",
"userName": "Alice Admin",
"apiKeyId": "550e8400-e29b-41d4-a716-446655440003",
"apiKeyName": "ci-publisher",
"action": "CREATE",
"entityType": "Device",
"entityId": "550e8400-e29b-41d4-a716-446655440004",
"entityName": "Production Gateway 1",
"beforeState": {
"status": "OFFLINE",
"name": "Old Name"
},
"afterState": {
"status": "ONLINE",
"name": "New Name"
},
"changedFields": [
"status",
"name"
],
"ipAddress": "192.168.1.100",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
"requestId": "req-123456",
"sessionId": "sess-789012",
"success": true,
"errorMessage": "Permission denied",
"metadata": {
"source": "api",
"version": "1.0"
},
"createdAt": "2024-01-15T10:30:00Z"
}

Unauthorized

Forbidden — caller lacks required permission

Audit log not found