Skip to content
Software capabilities
Cloudflare

Apply DNS record changes in a batch

Send multiple record changes in one batch request. Cloudflare applies database changes in one transaction, then propagates each record change separately.

Documentation reviewed · 2 methods with sources

Ways to do it

  1. API: POST /zones/{zone_id}/dns_records/batch
  2. SDK: client.dns.records.batch()
API

POST /zones/{zone_id}/dns_records/batch

Send multiple changes to the records in one zone.

Read source: Cloudflare API: Batch DNS Records
Requirements
A zone ID, an API token with DNS Write when using token auth, and a JSON body. Include an id on each delete, patch, or replace entry.
Limitations
Cloudflare applies deletes, patches, replacements, and creates in that order. The database transaction is atomic. Changes propagate to distributed storage separately.
SDK

client.dns.records.batch()

Call client.dns.records.batch with the zone and the changes to apply.

Read source: Generated Cloudflare TypeScript DNS method: POST /zones/{zone_id}/dns_records/batch
Requirements
An authenticated Cloudflare TypeScript client, zone_id, and the applicable deletes, patches, puts, or posts arrays. Delete, patch, and put entries require an id.
Limitations
The SDK uses the same operation order and separate propagation as the API.