Set DNS records
PUT /v1/domain-purchases/:id/dns — replace the entire DNS record set (declarative).
PUT /v1/domain-purchases/:id/dns
Replaces all DNS records at the registrar with the array you send. Declarative — what you POST is the complete state. Anything not in the payload gets removed.
If you want to add a record without touching the others, first
GET /:id/dns and send the
merged array back.
Request
curl -X PUT https://api.domainee.dev/v1/domain-purchases/f8a0c1b9-…/dns \
-H "Authorization: Bearer $DOMAINEE_API_KEY" \
-H "content-type: application/json" \
-d '{
"records": [
{ "type": "CNAME", "name": "@", "value": "edge.domainee.dev", "ttl": 300 },
{ "type": "CNAME", "name": "www", "value": "edge.domainee.dev", "ttl": 300 },
{ "type": "TXT", "name": "@", "value": "v=spf1 include:_spf.acme.com ~all" },
{ "type": "MX", "name": "@", "value": "inbox.acme.com", "priority": 10 }
]
}'
Body parameters
| Field | Required | Notes |
|---|---|---|
records | ✅ | Array of record objects. Maximum 100 per call. |
Record object
| Field | Required | Notes |
|---|---|---|
type | ✅ | A · AAAA · CNAME · MX · TXT · NS · SRV · URL · URL301 · FRAME. |
name | ✅ | @ for apex, www for www.<domain>, etc. |
value | ✅ | Target/value. Max 2048 chars (enough for TXT/DKIM). |
ttl | Seconds. 60–86400. Default 1800. | |
priority | Required for MX. 0–65535. Lower = higher priority. |
Response — 200 OK
{
"hostname": "janesbakery.com",
"records": [ /* exactly what you sent */ ]
}
Errors
| Code | Status | When |
|---|---|---|
not_found | 404 | Purchase doesn't exist in this workspace. |
bad_request | 400 | Validation failure — missing required field, invalid type, too many records. |
| Registrar error | 502 | The registrar refused (e.g. invalid CNAME at apex for TLDs that don't support it). The error message contains the registrar's reason. |
Notes
- DNS propagation is fast at modern registrars but not instant — give a minute or two before testing.
- Apex CNAME (
name: "@", type: "CNAME") works on Namecheap (they flatten it server-side). Some TLDs reject it — surface the error in your UI and suggest the user try an A record instead. - For a fully managed "connect this domain to my app" flow, prefer
POST /:id/connectwhich sets the right CNAME for you in one call.