Skip to main content
Record endpoints work with an API token or a signed-in session. Reading needs zones.read; every change needs records.write.

Endpoints

Record format

string
required
Relative to the zone: www, or @ for the apex.
string
required
The record type: A, AAAA, CNAME, MX, TXT, NS, SRV, CAA, HTTPS, SVCB, PTR, TLSA, SSHFP, NAPTR, DS, URI, DNAME, LOC.
string
required
The record’s value. For SRV, value holds "weight port target", e.g. "5 5060 sip.example.com"; for URI "weight target", e.g. "1 https://example.com/". TLSA, SSHFP, NAPTR, DS, DNAME and LOC take their zone-file presentation format and come back in DNZ’s canonical form (see Record types). A DS can’t be at the apex (400); records below a DNAME, a second DNAME at a name, or a DNAME next to a CNAME are refused (409).
integer
Seconds. When left out, the zone’s default_ttl is used (300 unless changed).
integer
Used for MX, SRV and URI.
boolean
default:"true"
Off keeps the record but stops serving it. See Turning records off.
string
A note on the record. A new record has none.
string[]
Tags for finding and changing records in groups. A new record has none.
integer
A split-horizon view to serve the record in. Absent or null: every client.
integer[]
Proxy ids to serve an A, AAAA or CNAME record through. See Proxied records.

Creating a record

Changing a record

PATCH /api/records/{id} replaces the record’s DNS data, so send every DNS field (name, type, value, ttl, priority). enabled, comment, tags and proxies are kept when you leave them out.

Proxied records

proxies puts an A, AAAA or CNAME record behind one or more proxies, like Cloudflare’s orange cloud:
  • DNS answers the name with the addresses of all the listed proxies.
  • Each proxy needs a router for the record’s name; see Routing.
  • [] means DNS only.
  • A new record is DNS only, and an edit that leaves proxies out keeps it as it is.
  • The older "proxy_id": 3 (or null) is still accepted when proxies is absent.
Records come back with "proxies": [1, 3]. The proxy endpoints are described in Proxy. Records also come back with "caddy_id": the Caddy that keeps the record for a site it serves, or null for records made by hand or another way. Changing a record with PATCH clears it, so the Caddy leaves that record alone from then on.

Traffic steering

GeoDNS, weights and health checks of A and AAAA records have their own endpoints. For how an answer is picked, see GeoDNS and health checks. PUT /api/records/{id}/traffic replaces the record’s steering:
string[]
ISO 3166 two-letter country codes the address is for.
string[]
AF, AN, AS, EU, NA, OC or SA. With no countries and no continents, the record is a default for clients from anywhere else.
integer
0 to 1000 among the name’s records, or null for not weighted.
object
The health check, or null for none. kind is https, http or tcp. port defaults to 443 for HTTPS and 80 otherwise; host to the record’s name; expect to 200-399. An address leaves the answers after fall failures in a row and comes back after rise passes.
POST /api/records/{id}/traffic/test takes a check object and answers {"healthy": true, "latency_ms": 41} or {"healthy": false, "error": "…"}. GET /api/zones/{id}/traffic lists the zone’s steered records, each with its record_id, its steering and its health (healthy, latency_ms, error, checked_at, changed_at), plus a geoip object that says whether a database is loaded. Changes are in the audit log as record.traffic. The GeoIP database itself is managed under Settings: GeoIP database.

Turning records off

A disabled record is kept, but not answered, not sent in zone transfers (AXFR/IXFR) and not DNSSEC-signed. CNAME exclusivity and the duplicate check only count enabled records, so a disabled CNAME can wait next to the A record it will replace. Turning a record on runs the checks, and answers 409 on a conflict.

Filtering the list

GET /api/zones/{id}/records takes optional query parameters:
string
Comma-separated tags, e.g. tag=prod,web. Returns records carrying every tag listed.
boolean
true for records that are on, false for records that are off.
string
Case-insensitive text in the name, value or comment.
GET /api/zones/{id}/tags lists the tags in use and how many records carry each:

Bulk changes

POST /api/zones/{id}/records/bulk takes a list of operations and applies them in order, all or nothing:

Operations

Validation

The request is checked as a whole before anything is written:
  • every id must belong to the zone (400);
  • values must be valid (400);
  • records added, turned on or moved to other proxies must not break CNAME exclusivity, duplicate another enabled record, or leave a name’s A, AAAA and CNAME records on different proxies, including each other (409);
  • set_proxies needs a router for the name on every proxy (400). Move a name’s A and AAAA records in one operation.
Then the changes are applied in one transaction, with one serial bump and one record.bulk audit entry holding the records before and after.
A request holds at most 100 operations and 5000 records (ids plus new records).

The answer

The CLI uses this endpoint for every change to several records; see How bulk changes work.

Secondary zones are read-only

Records of secondary zones can be read but not changed. Writes answer 400; change the records on the primary instead.