A Cloudflare backup configuration is a copy of a zone’s DNS records, rules and settings that you can write back after a bad change or a deletion. Cloudflare’s dashboard exports the DNS records as a file, one of the 15 parts a zone’s configuration holds; the rules and settings have to be read through the API, part by part. This article lists the 15 parts and the steps to back them up and restore them by hand. Lelops Guard does both for you: it saves a version of all 15 parts each time a change goes through Lelops, and puts any version back in one action.
What Does a Cloudflare Backup Configuration Need to Cover?
It needs every part of the zone that decides where requests go, which ones are blocked and how responses are served. We recommend these 15 parts as the minimum:
- DNS: DNS records, the zone’s DNS settings and DNSSEC.
- Security: WAF custom rules and WAF managed rules, rate limiting rules, IP Access rules, Zone Lockdown rules, User Agent Blocking rules, bot settings, and the lists these rules refer to.
- Traffic handling: zone settings such as the SSL/TLS mode and Always Use HTTPS, cache rules, URL normalization and Managed Transforms.
Outside the DNS export, each part has its own API endpoint, and zone settings now take one request each: Cloudflare’s API schema marks the call that returned them all as deprecated, with a sunset date of January 1, 2030.
How to Build a Cloudflare Backup Configuration, Step by Step

Use a read-only API token and save each answer as a file named after the part. By our count on Cloudflare’s API schema, the steps below take at least 82 read requests per zone.
- Export the DNS records. In DNS > Records, select Import and Export, then Export, or call
GET /zones/{zone_id}/dns_records/export. The BIND file tags each recordcf-proxied:trueorcf-proxied:false, so a restore brings back the orange and grey clouds as they were. AddGET /zones/{zone_id}/dns_settingsandGET /zones/{zone_id}/dnssec. - Read the rules, one phase at a time.
GET /zones/{zone_id}/rulesets/phases/{phase}/entrypointreturns a phase’s rules in their order:http_request_firewall_customfor WAF custom rules,http_request_firewall_managedfor WAF managed rules,http_ratelimitandhttp_request_cache_settingsfor rate limiting and cache rules. Add the phase of any redirect, rewrite, origin or configuration rules. - Read the zone settings one by one. Loop over
GET /zones/{zone_id}/settings/{setting_id}for the 68 settings the schema lists. - Read IP Access rules, Zone Lockdown and User Agent Blocking. Their endpoints answer page by page: a script that stops at the first page saves a partial list without any error.
- Read the lists.
GET /accounts/{account_id}/rules/lists, then the items of each list. Lists belong to the account, and rules name them in their expressions.
How Do You Restore a Cloudflare Zone from a Backup?

Restore only the parts that changed: writing back the whole zone also undoes every change made since the backup, the good ones included. Cloudflare’s audit logs record who changed what, which tells you which part to restore.
- Lists first.
PUT /accounts/{account_id}/rules/lists/{list_id}/itemsreplaces a list’s items. An account accepts one such operation at a time, so restore lists one after the other, before the rules that name them. - Rules.
PUTon the phase’s entry point with the saved rules replaces the entire list of rules, in the backup’s order. Without a backup, Cloudflare still keeps every version of a ruleset: read the one before the change with.../entrypoint/versions/{version}and send its rules. - Zone settings.
PATCH /zones/{zone_id}/settings/{setting_id}for each setting that differs. - IP Access rules, Zone Lockdown and User Agent Blocking. No request replaces the whole set: create, update or delete each rule that differs.
- DNS records. Import the BIND file under Import DNS records to bring back deleted records, and send edited ones in one batch request.
- Check. Run the backup again and compare the files: a difference that remains is a part the restore missed.
On Enterprise zones, Cloudflare’s Version Management also rolls back deployed changes.
How to Back Up Your Cloudflare Configuration with Lelops Guard

Lelops Guard keeps your Cloudflare zones on a security baseline and saves a version of a zone each time a change goes through Lelops, so the backup and the restore above happen without a script.
- Connect Cloudflare. Paste a scoped Cloudflare API token in Lelops, review the permissions it grants, and choose the zones Lelops can access. You can change the token’s permissions or revoke it at any time.
- Change the zone through Lelops. Use Resolve with Lelops on an alert, Fix on a compliance issue, or a request to Ask Lelops. Each change saves a new version with your name and the time, and each version holds all 15 parts listed at the top of this article, the unchanged ones included.
- Find a version. Open Guard > Versioning. Version history lists every version by its date and time, newest first, with Created by, Provider and Resource. Filter by Resource to see one zone, by Created by to see one person’s changes, or search the history.
- Read what changed. Expand a version to read its Changelog, a summary of what changed since the version before. It is the comparison you would otherwise make between two backup files.
- Keep a copy outside Lelops. Select Export to download the version as a JSON file that holds the same 15 parts, to keep next to your own backups.
- Restore. Pick the last version saved before the change you want to undo, select Rollback, then Restore and deploy. Lelops writes every part of that version back to the same zone, which undoes the changes saved after it, with no lists, phases or settings to restore one by one. Only an Administrator can roll back; a Viewer can open the history and read its changelogs. How far back you can go is on the pricing page.
- Check the result. The restore appears at the top of Version history as a new version, with your name under Created by and a Changelog that names the version it came from. Like any other version, it can be rolled back the same way.
Lelops Guard saves a version of your Cloudflare zone with each change made through Lelops, and puts any of them back in one action: lelops.ai/product/guard
FAQ
Does Cloudflare back up a zone’s configuration automatically?
In part. Cloudflare keeps every version of a ruleset, so earlier WAF, rate limiting and cache rules can be read back through the API. A version of the whole zone that can be rolled back comes with Version Management, on Enterprise zones only. On other plans, teams build the full backup from the DNS export and the API.
Can Cloudflare zone settings be exported in one request?
Not with a current call. Cloudflare’s API schema marks the request that returned all zone settings as deprecated and asks for settings to be managed individually, so a backup reads them one request per setting. The old call carries a sunset date of January 1, 2030 in the schema, so scripts built on it need rewriting before then.
How can a deleted Cloudflare WAF rule be restored?
Through the earlier versions of its ruleset. Engineers list the versions of the custom rules entry point through the API, open the last version that still holds the rule, and send its rules back with a PUT request to the same entry point. The PUT replaces the whole list, so the request carries every rule the phase should keep, in order.
What is the difference between a Cloudflare backup and Cloudflare audit logs?
Audit logs record who changed what and when; a backup holds the configuration itself, ready to be written back. Teams use the audit log to find which part of a zone changed, then restore that part from the backup.
Does a Cloudflare DNS export keep the proxy status of records?
Yes. The BIND file Cloudflare exports tags each record cf-proxied:true or cf-proxied:false, and on import that tag decides whether the record is proxied, whatever the import option says. A zone restored from the file gets back the same orange and grey clouds.
Christophe Pronier


