Skip to main content
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);
}
account_id
string
required
Account identifier
id
string
Find a specific log by its ID
action
object
Filter by action
actor
object
Filter by actor who performed the action
zone
object
Filter by zone
since
string
Limits results to logs newer than the specified date (RFC3339 format)
before
string
Limits results to logs older than the specified date (RFC3339 format)
direction
string
Changes the direction of chronological sortingOptions: desc | asc
page
number
Page number for pagination
per_page
number
Number of items per page (default: 25, max: 1000)
hide_user_logs
boolean
Indicates whether to hide user level audit logs
export
boolean
Indicates that this request is an export of logs in CSV format

Response fields

id
string
A string that uniquely identifies the audit log
when
string
A UTC RFC3339 timestamp that specifies when the action occurred
action
object
Information about the action performed
actor
object
Information about who performed the action
resource
object
Information about the resource that was affected
owner
object
The owner of the resource
interface
string
The source of the event (e.g., “API”, “Dashboard”)
metadata
unknown
An object providing additional context to the action being logged. This is a flexible value that varies between actions
newValue
string
The new value of the resource that was modified
oldValue
string
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"
  }
}

Build docs developers (and LLMs) love