Get audit logs for entity
const url = 'http://localhost:3000/api/v1/audit/entity/Device/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0?userId=550e8400-e29b-41d4-a716-446655440000&apiKeyId=550e8400-e29b-41d4-a716-446655440001&action=CREATE&action=UPDATE&success=true&startDate=2024-01-01T00%3A00%3A00Z&endDate=2024-12-31T23%3A59%3A59Z&ipAddress=192.168.1.100&search=device-001&page=1&limit=50&cursor=eyJpZCI6IjEyMzQifQ%3D%3D';const options = {method: 'GET', headers: {'X-API-Key': '<X-API-Key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'http://localhost:3000/api/v1/audit/entity/Device/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0?userId=550e8400-e29b-41d4-a716-446655440000&apiKeyId=550e8400-e29b-41d4-a716-446655440001&action=CREATE&action=UPDATE&success=true&startDate=2024-01-01T00%3A00%3A00Z&endDate=2024-12-31T23%3A59%3A59Z&ipAddress=192.168.1.100&search=device-001&page=1&limit=50&cursor=eyJpZCI6IjEyMzQifQ%3D%3D' \ --header 'X-API-Key: <X-API-Key>'Retrieves audit logs for a specific entity.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Example
DeviceEntity type (e.g., Device, User)
Entity UUID
Query Parameters
Section titled “Query Parameters ”Example
550e8400-e29b-41d4-a716-446655440000Filter by user ID
Example
550e8400-e29b-41d4-a716-446655440001Filter by API key ID
Example
[ "CREATE", "UPDATE"]Filter by audit action type(s)
Example
trueFilter by success status
Example
2024-01-01T00:00:00ZFilter logs from this date
Example
2024-12-31T23:59:59ZFilter logs until this date
Example
192.168.1.100Filter by IP address
Example
device-001Full-text search in entity name and error message
Example
1Page number
Example
50Number of results per page
Example
eyJpZCI6IjEyMzQifQ==Cursor for cursor-based pagination
Responses
Section titled “ Responses ”Audit logs retrieved successfully
object
List of audit log entries
object
Unique audit log identifier
Organization ID
User ID who performed the action
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.
API key ID used for the action
Display name of the API key at the time of the action.
Type of action performed
Entity type that was affected
ID of the affected entity
Human-readable name of the affected entity
State of the entity before the change
object
State of the entity after the change
object
List of fields that were changed
IP address of the client
User agent of the client
Request correlation ID
Session ID
Whether the action was successful
Error message if action failed
Additional metadata
object
When the audit log was created
Pagination metadata
object
Total number of matching records
Current page number
Number of records per page
Whether more records are available
Cursor for next page
Example
{ "data": [ { "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" } ], "meta": { "total": 150, "page": 1, "limit": 50, "hasMore": true, "nextCursor": "eyJpZCI6IjEyMzQifQ==" }}Unauthorized
Forbidden — caller lacks required permission