Adds a DNS record (A, AAAA, CNAME, MX, TXT, NS, CAA or SRV) to one of your Cloudflare zones.
curl -X POST "https://api.primaryapi.com/v1/run/cloudflare.create_dns_record" \
-H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"zone":"example.com","type":"A","name":"api","content":"198.51.100.4","ttl":3600}'{
"output": {
"found": true,
"data": {
"zone": "example.com",
"record": {
"name": "api.example.com",
"ttl": 3600,
"proxied": false,
"proxiable": true, …
},
"zoneId": "023e105f4ecef8ad9ca31a8372d0c353"
}
},
"credits": 1
}Input and output
11 fields
example.com.A.api.data). For example 198.51.100.4.3600.3 fields
Good to know
Changes your account. This call creates, edits or deletes something in the connected account, live. Confirm before running it. With an Idempotency-Key it never runs twice, and monitors can’t schedule it.
Runs as your connected Cloudflare account. Needs the "Manage DNS" permission.
This changes the live configuration of your Cloudflare zone right away. There is no undo, no preview.
A call that times out may still have gone through. So read the current state before trying again.
An Idempotency-Key does not protect it. Results of private APIs are never stored, so a repeated key runs the change again.
Cloudflare refuses an A or AAAA record on a name that has a CNAME (and the reverse). Any record next to an NS record of the same name, and an exact duplicate. Those come back as invalid input.
The same key and credits work for every API.