Skip to content
Visit Logs on GitHub
Set theme to dark (⇧+D)

Enabling log retention

By default, your HTTP request logs are not retained. When using the Logpull API for the first time, you will need to enable retention. You can also turn off retention at any time. Note that after retention is turned off, previously saved logs will be available until the retention period expires (see Data retention period).


There are two endpoints for managing log retention:

  • GET /logs/control/retention/flag - returns whether retention is on
  • POST /logs/control/retention/flag - turns retention on or off

Example API requests using cURL

Check whether log retention is turned on:

curl -s -H "X-Auth-Email: <REDACTED>" -H "X-Auth-Key: <REDACTED>" GET "<ZONE_ID>/logs/control/retention/flag" | jq .


{  "errors": [],  "messages": [],  "result": {    "flag": false  },  "success": true}

Turn on log retention:

curl -s -H "X-Auth-Email: <REDACTED>" -H "X-Auth-Key: <REDACTED>" POST "<ZONE_ID>/logs/control/retention/flag" -d'{"flag":true}' | jq .


  • flag - can be either true or false


{  "errors": [],  "messages": [],  "result": {    "flag": true  },  "success": true}


Turning log retention on or off is recorded in Cloudflare Audit Logs.