The Audit Logs API provides access to account-level audit logs, allowing you to track changes and actions performed on your Cloudflare account.
List audit logs
Retrieve a list of audit logs for an account. You can filter by who made the change, which zone was affected, and the timeframe.
for await (const log of client.auditLogs.list({
account_id: '023e105f4ecef8ad9ca31a8372d0c353',
since: '2024-01-01T00:00:00Z',
direction: 'desc'
})) {
console.log(log.action?.type, log.actor?.email, log.when);
}
Find a specific log by its ID
Filter by action
Filter by the action type (e.g., “create”, “update”, “delete”)
Filter by actor who performed the action
Filter by the email address of the actor that made the change
Filter by the IP address of the request that made the change (supports CIDR ranges)
Filter by zone
Filter by the name of the zone associated with the change
Limits results to logs newer than the specified date (RFC3339 format)
Limits results to logs older than the specified date (RFC3339 format)
Changes the direction of chronological sortingOptions: desc | asc
Page number for pagination
Number of items per page (default: 25, max: 1000)
Indicates whether to hide user level audit logs
Indicates that this request is an export of logs in CSV format
Response fields
A string that uniquely identifies the audit log
A UTC RFC3339 timestamp that specifies when the action occurred
Information about the action performed
A short string describing the action performed
Indicates if the action was successful
Information about who performed the action
The ID of the actor (e.g., User ID)
The email of the user that performed the action
The IP address of the request
The type of actor: user, admin, or Cloudflare
Information about the resource that was affected
An identifier for the resource
The owner of the resource
The source of the event (e.g., “API”, “Dashboard”)
An object providing additional context to the action being logged. This is a flexible value that varies between actions
The new value of the resource that was modified
The value of the resource before it was modified
Example response
{
"id": "f1234567-89ab-cdef-0123-456789abcdef",
"when": "2024-03-15T14:32:10Z",
"action": {
"type": "zone_setting_update",
"result": true
},
"actor": {
"id": "a1234567890bcdef1234567890abcdef",
"email": "[email protected]",
"ip": "192.0.2.1",
"type": "user"
},
"resource": {
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"type": "zone"
},
"interface": "API",
"metadata": {
"zone_name": "example.com"
}
}