Export audit logs
GET
/api/v1/audit/export
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.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters ” userId
string format: uuid
Example
550e8400-e29b-41d4-a716-446655440000Filter by user ID
apiKeyId
string format: uuid
Example
550e8400-e29b-41d4-a716-446655440001Filter by API key ID
action
Array<string>
Example
[ "CREATE", "UPDATE"]Filter by audit action type(s)
entityType
Array<string>
Example
[ "Device", "User"]Filter by entity type(s)
entityId
string format: uuid
Example
550e8400-e29b-41d4-a716-446655440002Filter by specific entity ID
success
boolean
Example
trueFilter by success status
startDate
string format: date-time
Example
2024-01-01T00:00:00ZFilter logs from this date
endDate
string format: date-time
Example
2024-12-31T23:59:59ZFilter logs until this date
ipAddress
string
Example
192.168.1.100Filter by IP address
search
string
Example
device-001Full-text search in entity name and error message
page
number
Example
1Page number
limit
number
Example
50Number of results per page
cursor
string
Example
eyJpZCI6IjEyMzQifQ==Cursor for cursor-based pagination
maxRecords
number
Example
10000Maximum records to export
Responses
Section titled “ Responses ”CSV file with audit logs
Media type text/csv
string format: binary
Unauthorized
Forbidden — caller lacks required permission