API: DNS records

List, add, change and delete records, and put names behind the proxy.

GET /domains/{domain}/records records.read

List records

Every record of the domain with its id, name, type, TTL and content; MX adds priority, SRV adds weight and port, CAA adds tag and flags.

curl -H "Authorization: Bearer $KEY" \
  https://my.cloud9.ir/api/customer/v1/domains/example.com/records
{"ok":true,"data":[{"id":"9f2c1a7b3d4e5f60","etag":"3b1d0c27","name":"@","type":"A","ttl":14400,"content":"203.0.113.10"}]}
POST /domains/{domain}/records records.write

Add a record

Adds one record and answers 201 with the records of the zone after the change. TTL is 14400 when omitted.

Body fieldValuesMeaning
typeRequired A | AAAA | CNAME | MX | TXT | NS | PTR | CAA | SRV Record type.
nameRequired Text Name inside the zone: @ for the domain itself, or a label such as www.
contentRequired Text The value: an address, a host name or text. For CNAME, NS and PTR you may send target instead.
ttl Text Seconds a resolver may keep the answer. Not lower than the plan's minimum.
priority Text MX and SRV priority.
proxied true | false A, AAAA and CNAME: true puts the name behind the proxy nodes and hides the origin.
region everywhere | rest | IR | AE,TR Who gets the record: everywhere, rest (the other countries) or country codes such as IR or AE,TR. Needs answers by country in the plan.
weight Text SRV weight (0-65535).
port Text SRV port (0-65535).
tag issue | issuewild | iodef CAA tag.
flags Text CAA flags (usually 0).
curl -X POST -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"type":"A","name":"www","ttl":3600,"content":"203.0.113.10","proxied":true}' \
  https://my.cloud9.ir/api/customer/v1/domains/example.com/records
PUT / PATCH /domains/{domain}/records/{id} records.write

Change a record

Replaces the record with the given fields; send the whole record. The id stays the same. With If-Match: <etag> the change is made only if the record is unchanged since you read it; otherwise 412 record_changed.

curl -X PUT -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" -H "If-Match: 3b1d0c27" \
  -d '{"type":"A","name":"www","ttl":600,"content":"203.0.113.20"}' \
  https://my.cloud9.ir/api/customer/v1/domains/example.com/records/9f2c1a7b3d4e5f60
DELETE /domains/{domain}/records/{id} records.write

Delete a record

Deletes one record by its id; If-Match: <etag> works here too.

curl -X DELETE -H "Authorization: Bearer $KEY" \
  https://my.cloud9.ir/api/customer/v1/domains/example.com/records/9f2c1a7b3d4e5f60
{"ok":true,"data":{"deleted":true}}

No answer here? Sign in to the portal and open a ticket. Open a ticket