Portal / Nodes / Cloudflare / dns/batchCreate
dns/batchCreate
Create multiple DNS records in a single API call. Partial success is possible — always check the errors array.
Partial success: dns/batchCreate may succeed for some records and fail for others. Even when the success port fires, inspect the errors array in the output. Records that failed will appear there with the reason.
When to Use
- Full zone provisioning: Create all DNS records for a new customer domain in one operation — A, CNAME, MX, TXT (SPF/DKIM), and NS records together.
- Zone-to-zone migration: After exporting records from one zone, batch-create them in a new zone during a domain migration.
- Split-horizon setup: Create multiple A records with different values for a split-horizon DNS setup in a single call.
- Multi-subdomain deployment: Provision all required subdomains (api, www, admin, cdn, mail) at once during an initial application deployment.
Configuration
Connection
| Field | Type | Required | Description |
ApiToken | string | required | Scoped Cloudflare API Token with DNS.Edit permission. Store in BizFirst Credentials Manager. |
Operation Fields
| Field | Type | Required | Description |
ZoneId | string | required | 32-character hexadecimal Zone ID. |
Records | array | required | Array of record objects. Each must have Type, Name, and Content. Optional: Ttl, Proxied, Priority. |
Sample Configuration
{
"resource": "dns",
"operation": "batchCreate",
"connection": {
"ApiToken": "{{ $credentials.cloudflare_dns_edit }}"
},
"ZoneId": "023e105f4ecef8ad9ca31a8372d0c353",
"Records": [
{ "Type": "A", "Name": "example.com", "Content": "198.51.100.4", "Proxied": true },
{ "Type": "CNAME", "Name": "www.example.com", "Content": "example.com", "Proxied": true },
{ "Type": "MX", "Name": "example.com", "Content": "mail.example.com", "Priority": 10, "Proxied": false },
{ "Type": "TXT", "Name": "example.com", "Content": "v=spf1 include:_spf.example.com ~all", "Proxied": false }
]
}
Validation Errors
| Code | Condition | Resolution |
MISSING_API_TOKEN | ApiToken is empty | Set the ApiToken credential with DNS.Edit permission |
MISSING_ZONE_ID | ZoneId is empty | Provide the Zone ID |
UNKNOWN_ERROR | All records failed or API error | Check per-record errors array in output for specifics |
Output
Success Port
| Field | Type | Description |
records | array | Array of successfully created record objects (same schema as dns/create output) |
errors | array | Array of per-record errors. Non-empty even on partial success. Each entry has index, code, and message. |
successCount | integer | Number of records successfully created |
errorCount | integer | Number of records that failed to create |
Error Port
Only fires if the entire batch request fails (e.g., auth error). Partial failures are reported in the errors array on the success port.
Sample Output
{
"records": [
{ "id": "372e67954025e0ba6aaa6d586b9e0b59", "type": "A", "name": "example.com", "content": "198.51.100.4", "proxied": true },
{ "id": "9a7806061c88ada191ed06f989cc3dac", "type": "CNAME", "name": "www.example.com", "content": "example.com", "proxied": true },
{ "id": "f117d94edc2a3d86c4efe6daacbf47f7", "type": "TXT", "name": "example.com", "content": "v=spf1 include:_spf.example.com ~all", "proxied": false }
],
"errors": [
{ "index": 2, "code": "81053", "message": "Record already exists." }
],
"successCount": 3,
"errorCount": 1
}
Expression Reference
| Expression | Returns |
{{ $node.BatchCreate.output.records }} | Array of successfully created records |
{{ $node.BatchCreate.output.successCount }} | Number of records created |
{{ $node.BatchCreate.output.errorCount }} | Number of records that failed |
{{ $node.BatchCreate.output.errors }} | Per-record error details |
Node Policies & GuardRails
| Policy | Detail |
| Always check the errors array | Even on success port, inspect errorCount — a non-zero value means some records were not created |
| Require DNS.Edit token | Batch creation requires write permission |
| Store ApiToken in Credentials Manager | Never hardcode the token in configuration JSON |
| Store returned record IDs | Persist each returned id in a database or workflow variable for future update/delete operations |
| Rate limit awareness | Each batchCreate call counts as one API request — be aware of the 1,200 req/5 min limit for very frequent batch operations |
Examples
Example 1: New Customer DNS Zone Provisioning
When a new customer is onboarded: Build the Records array dynamically from customer configuration (subdomain, IP, mail server). Call dns/batchCreate. Check errorCount > 0 and alert the provisioning team if any records failed. Store all returned IDs in the customer's infrastructure record.
Example 2: Cross-Zone Record Replication
Use dns/export on the source zone to get a BIND file. Parse the BIND file in a Function node to build the Records array. Call dns/batchCreate on the target zone. Compare successCount against expected count and send a report.
Example 3: Deployment-Time Subdomain Provisioning
At deployment time, read a dns-records.json file from S3 that defines all required subdomains for the release. Pass the array to dns/batchCreate. On completion, feed the records output into a cache/purgeByUrl call for any URLs that changed.