Get user audit logs
client.user.auditLogs.list(AuditLogListParams { id, action, actor, 8 more } query?, RequestOptionsoptions?): V4PagePaginationArray<AuditLog { id, action, actor, 7 more } >
GET/user/audit_logs
Gets a list of audit logs for a user account. Can be filtered by who made the change, on which zone, and the timeframe of the change.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Accepted Permissions (at least one required)
Get user audit logs
import Cloudflare from 'cloudflare';
const client = new Cloudflare({
apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const auditLog of client.user.auditLogs.list()) {
console.log(auditLog.id);
}{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": [
{
"id": "d5b0f326-1232-4452-8858-1089bd7168ef",
"action": {
"result": true,
"type": "change_setting"
},
"actor": {
"id": "f6b5de0326bb5182b8a4840ee01ec774",
"email": "michelle@example.com",
"ip": "198.41.129.166",
"type": "user"
},
"interface": "API",
"metadata": {
"name": "security_level",
"type": "firewall",
"value": "high",
"zone_name": "example.com"
},
"newValue": "low",
"oldValue": "high",
"owner": {
"id": "023e105f4ecef8ad9ca31a8372d0c353"
},
"resource": {
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"type": "zone"
},
"when": "2017-04-26T17:31:07Z"
}
],
"success": true
}Returns Examples
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": [
{
"id": "d5b0f326-1232-4452-8858-1089bd7168ef",
"action": {
"result": true,
"type": "change_setting"
},
"actor": {
"id": "f6b5de0326bb5182b8a4840ee01ec774",
"email": "michelle@example.com",
"ip": "198.41.129.166",
"type": "user"
},
"interface": "API",
"metadata": {
"name": "security_level",
"type": "firewall",
"value": "high",
"zone_name": "example.com"
},
"newValue": "low",
"oldValue": "high",
"owner": {
"id": "023e105f4ecef8ad9ca31a8372d0c353"
},
"resource": {
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"type": "zone"
},
"when": "2017-04-26T17:31:07Z"
}
],
"success": true
}