Cloudflare allows you to apply several changes to your zone records in just one action. You can use the dashboard to delete DNS records or update their proxy status in bulk, or use the API to perform further batched operations.
Availability and limits
Batch DNS record changes is available on all plans.
The number of records that you can operate with in one action depends on your zone plan:
Select the DNS records you want to set the proxy status for. Note that only A, AAAA, and CNAME records can be proxied.
Select Edit records.
Choose the proxy status you want to apply to the selected records.
Select Save to confirm.
You can only set records to either Proxied or DNS only in bulk. This means that if your selection includes both proxied and DNS-only records, some of them will have the proxy status updated while others will keep their original value:
For example, if you select the following records and then edit their proxy status in bulk, choosing Proxied in step 4 above, the outcome will be:
The operations you specify within the /batch request body are always executed in the following order:
Deletes
Patches
Puts
Posts
Within each of these four lists, each individual action is executed following the DNS records order you provide. If any of the individual action fails, no changes are applied and the API returns the first error it encountered.
Aspects to consider
For each operation that you list in the /batch request body, consider the required information and how unspecified fields will behave:
deletes: only the id is required for each record object. You can keep additional parameters such as name for readability, but any other fields aside from id will be ignored in this case.
patches: aside from each record id, you should specify the fields you want to update. All unspecified fields will remain as they are.
puts: you must specify each record id, content, name, and type. You should also specify any other fields you want to set to a value that is not the default. Any unspecified fields will assume their default value for each record type. This operation works as an overwrite, so all fields in a given record are always affected.
posts: since you are creating a new record, id is not required. For field definitions, refer to the Create DNS Record endpoint and select the desired record type under the request body specification.
Example request
In this example, the proxied field for the first record listed under "puts" will assume the default value (false).