Get an API key
Domain

records.set()

domain.records.set({ type, name, content, priority?, ttl?, replace? }) → Promise<Record>

Writes a record: it replaces the one with the same type and name, or creates it. The types that legitimately repeat are handled differently.

PUTreplace or createNS refused
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

await domain.records.set({ type: "CNAME", name: "docs", content: "example.pages.dev" });
await domain.records.set({ type: "MX", name: "@", content: "mx.example.net", priority: 10 });
domain.records.set({"type": "CNAME", "name": "docs", "content": "example.pages.dev"})
domain.records.set({"type": "MX", "name": "@", "content": "mx.example.net", "priority": 10})
typestringrequired

A, AAAA, CNAME, TXT, MX, SRV, CAA. NS is refused.

namestringrequired

Relative to the zone. @ for the apex.

contentstringrequired

The value.

prioritynumber

MX and SRV.

ttlnumber

Seconds. Automatic by default.

replaceboolean

Replace every record of that type and name, not only the matching one.

Some types legitimately repeat

MX, TXT and CAA can coexist on one name

So only the one with the same content is replaced — otherwise writing a second mail server would delete the first. Pass replace: true when you genuinely mean « this name now has exactly this ».

NS is refused

A record delegating a name away is exactly what a subdomain takeover looks like. The type is not accepted, with no option to force it.

A record cannot leave the zone

Names are relative, so there is no way to write into a zone that is not this one.

A record does not make a name serve

For a hostname that must actually answer, serve() writes the record and registers the name. A record alone gives an address that resolves and refuses.