Export audit logs
const url = 'http://localhost:3000/api/v1/audit/export?userId=550e8400-e29b-41d4-a716-446655440000&apiKeyId=550e8400-e29b-41d4-a716-446655440001&action=CREATE&action=UPDATE&entityType=Device&entityType=User&entityId=550e8400-e29b-41d4-a716-446655440002&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&maxRecords=10000';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/export?userId=550e8400-e29b-41d4-a716-446655440000&apiKeyId=550e8400-e29b-41d4-a716-446655440001&action=CREATE&action=UPDATE&entityType=Device&entityType=User&entityId=550e8400-e29b-41d4-a716-446655440002&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&maxRecords=10000' \ --header 'X-API-Key: <X-API-Key>'Exports audit logs to CSV format. The last two columns are Reason (the free-text reason an actor gave, for example for a tenant switch) and Metadata (the entry metadata as JSON).
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”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
[ "Device", "User"]Filter by entity type(s)
Example
550e8400-e29b-41d4-a716-446655440002Filter by specific entity ID
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
Example
10000Maximum records to export
Header Parameters
Section titled “Header Parameters”UUID of the organization (tenant) the request acts in. It selects the tenant and grants nothing: the server checks membership or an open tenant switch. Not needed for global operations. A malformed value returns 400. API keys are fixed to their own organization; another organization returns 403. The x-organization-source header grants nothing.
Responses
Section titled “Responses”CSV file with audit logs
Unauthorized
Forbidden — caller lacks required permission