Get user audit logs
user.audit_logs.list(AuditLogListParams**kwargs) -> SyncV4PagePaginationArray[AuditLog]
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 os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
page = client.user.audit_logs.list()
page = page.result[0]
print(page.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
}