Organization API: Customer Portal: Dns
The 16 Organization API operations for dns.
Part of Customer Portal.
Operations
Section titled OperationsThe nameservers a domain is pointed at to use a zone here
Section titled The nameservers a domain is pointed at to use a zone hereGET /api/v1/orgs/{org_slug}/portal/dns/nameservers
The nameservers a domain is pointed at to use a zone here.
They are the names every new zone gets as its NS records at @, and
the ones GET .../zones/{zone_id}/delegation compares the parent zone's
answer with.
Parameters
Section titled Parameters| Name | In | Type | Required |
|---|---|---|---|
org_slug |
path | string | yes |
Responses
Section titled Responses| Status | Meaning |
|---|---|
200 |
Success. |
422 |
The request is not valid. detail lists each problem. |
Fields of a 200 response:
| Field | Type |
|---|---|
nameservers |
array of string |
The customer's zones, by domain, each with its record count
Section titled The customer's zones, by domain, each with its record countGET /api/v1/orgs/{org_slug}/portal/dns/zones
The customer's zones, by domain, each with its record count.
total is how many zones domain matches (all of the customer's
zones without it). max_zones is how many zones the customer may hold
for domains registered elsewhere, and counted how many of the
customer's zones count against it, whatever domain says. A zone with a
registration_id does not count. Zones of other customers, of the
organization and of other organizations are never listed.
Parameters
Section titled Parameters| Name | In | Type | Required | Description |
|---|---|---|---|---|
org_slug |
path | string | yes | |
page |
query | integer | no | The page to read, from 1. Default: 1. |
per_page |
query | integer | no | Zones per page, from 1 to 100. Default: 25. |
domain |
query | string or null | no | Only the zone of exactly this domain. Case and a trailing dot are ignored. A domain the customer has no zone for answers an empty page. |
Responses
Section titled Responses| Status | Meaning |
|---|---|
200 |
Success. |
422 |
The request is not valid. detail lists each problem. |
Fields of a 200 response:
| Field | Type |
|---|---|
zones |
array of OrgCustomerZoneOut |
zones[].id |
integer |
zones[].domain |
string |
zones[].status |
string |
zones[].dnssec_enabled |
boolean |
zones[].serial |
integer |
zones[].soa_email |
string |
zones[].record_count |
integer |
zones[].record_limit |
integer |
zones[].registration_id |
integer or null |
zones[].created_at |
string (date-time) |
zones[].updated_at |
string (date-time) |
total |
integer |
max_zones |
integer |
counted |
integer |
Add a zone for domain
Section titled Add a zone for domainPOST /api/v1/orgs/{org_slug}/portal/dns/zones
Add a zone for domain. It is signed with DNSSEC and starts with our NS records at @.
domain is lowercased and loses a trailing dot. When the customer
registered the domain here, the zone is linked to that registration
(registration_id) and does not count against the cap. Otherwise the
call answers 403 once the customer holds max_zones zones for domains
registered elsewhere. It also answers 403 for a name the platform
reserves, and 409 when a zone of the name exists, the name is above or
below another account's zone, or another account registered the domain
here. 429 after 10 zones in an hour.
Parameters
Section titled Parameters| Name | In | Type | Required |
|---|---|---|---|
org_slug |
path | string | yes |
Request body
Section titled Request bodyapplication/json (required)
| Field | Type | Required |
|---|---|---|
domain |
string | yes |
Responses
Section titled Responses| Status | Meaning |
|---|---|
201 |
Success. |
422 |
The request is not valid. detail lists each problem. |
Fields of a 201 response:
| Field | Type |
|---|---|
id |
integer |
domain |
string |
status |
string |
dnssec_enabled |
boolean |
serial |
integer |
soa_email |
string |
record_count |
integer |
record_limit |
integer |
registration_id |
integer or null |
created_at |
string (date-time) |
updated_at |
string (date-time) |
One of the customer's zones
Section titled One of the customer's zonesGET /api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}
One of the customer's zones. 404 for any other zone id.
Parameters
Section titled Parameters| Name | In | Type | Required |
|---|---|---|---|
zone_id |
path | integer | yes |
org_slug |
path | string | yes |
Responses
Section titled Responses| Status | Meaning |
|---|---|
200 |
Success. |
422 |
The request is not valid. detail lists each problem. |
Fields of a 200 response:
| Field | Type |
|---|---|
id |
integer |
domain |
string |
status |
string |
dnssec_enabled |
boolean |
serial |
integer |
soa_email |
string |
record_count |
integer |
record_limit |
integer |
registration_id |
integer or null |
created_at |
string (date-time) |
updated_at |
string (date-time) |
Switch DNSSEC on or off for the zone
Section titled Switch DNSSEC on or off for the zonePATCH /api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}
Switch DNSSEC on or off for the zone. dnssec_enabled is the only field, and any other answers 422.
Switching it on signs the zone, and creates its keys the first time.
GET .../zones/{zone_id}/dnssec then lists the DS records to add at the
registrar. Switching it off stops signing and keeps the keys, so switching
it back on publishes the same DS records. Remove the DS records at the
registrar first, or resolvers that check signatures stop answering for the
domain. Sending the state the zone already has changes nothing and spends
nothing. 429 after 10 switches in an hour on one zone.
Parameters
Section titled Parameters| Name | In | Type | Required |
|---|---|---|---|
zone_id |
path | integer | yes |
org_slug |
path | string | yes |
Request body
Section titled Request bodyapplication/json (required)
| Field | Type | Required |
|---|---|---|
dnssec_enabled |
boolean | yes |
Responses
Section titled Responses| Status | Meaning |
|---|---|
200 |
Success. |
422 |
The request is not valid. detail lists each problem. |
Fields of a 200 response:
| Field | Type |
|---|---|
id |
integer |
domain |
string |
status |
string |
dnssec_enabled |
boolean |
serial |
integer |
soa_email |
string |
record_count |
integer |
record_limit |
integer |
registration_id |
integer or null |
created_at |
string (date-time) |
updated_at |
string (date-time) |
Delete the zone and every record in it
Section titled Delete the zone and every record in itDELETE /api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}
Delete the zone and every record in it. Our nameservers stop answering for the domain.
The customer's registration of the domain stays, without a zone
(dns_zone_id is cleared). 404 for a zone that is not the customer's.
409 while a server's web address uses a name in the domain. 429 after 10
zones in an hour.
Parameters
Section titled Parameters| Name | In | Type | Required |
|---|---|---|---|
zone_id |
path | integer | yes |
org_slug |
path | string | yes |
Responses
Section titled Responses| Status | Meaning |
|---|---|
204 |
Success. |
422 |
The request is not valid. detail lists each problem. |
Get zone delegation
Section titled Get zone delegationGET /api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/delegation
Whether resolvers reach this zone: the nameservers the zone above the domain lists for it, compared with ours.
expected holds our nameservers, found the ones the parent lists,
and ours those of found that are ours. status is active
when every nameserver it lists is one of ours, mixed when only some
are, pending when none are or it lists none, unregistered when it
says the domain does not exist, and unknown when no nameserver
answered.
An answer is reused for two minutes and reading it spends nothing.
fresh=true asks again, and answers 429 after 20 such checks in 10
minutes on one zone. A zone that is not the customer's answers 404 and is
never looked up.
Parameters
Section titled Parameters| Name | In | Type | Required | Description |
|---|---|---|---|---|
zone_id |
path | integer | yes | |
org_slug |
path | string | yes | |
fresh |
query | boolean | no | Ask the parent zone again instead of reusing an answer from the last two minutes. Answers 429 after 20 such checks in 10 minutes on one zone. Default: False. |
Responses
Section titled Responses| Status | Meaning |
|---|---|
200 |
Success. |
422 |
The request is not valid. detail lists each problem. |
Fields of a 200 response:
| Field | Type |
|---|---|
domain |
string |
status |
string |
expected |
array of string |
found |
array of string |
ours |
array of string |
checked_at |
string (date-time) |
Get DNSSEC info
Section titled Get DNSSEC infoGET /api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/dnssec
The zone's DNSSEC state: whether it is signed, its key tags, and the DS records to add at the domain's registrar (none while signing is off).
Parameters
Section titled Parameters| Name | In | Type | Required |
|---|---|---|---|
zone_id |
path | integer | yes |
org_slug |
path | string | yes |
Responses
Section titled Responses| Status | Meaning |
|---|---|
200 |
Success. |
422 |
The request is not valid. detail lists each problem. |
Fields of a 200 response:
| Field | Type |
|---|---|
enabled |
boolean |
algorithm |
string |
ksk_key_tag |
integer or null |
zsk_key_tag |
integer or null |
ds_records |
array of string |
zsk_rotated_at |
string (date-time) or null |
The zone as a BIND zone file, in zonefile
Section titled The zone as a BIND zone file, in zonefileGET /api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/export
The zone as a BIND zone file, in zone_file. POST .../import reads it back.
Parameters
Section titled Parameters| Name | In | Type | Required |
|---|---|---|---|
zone_id |
path | integer | yes |
org_slug |
path | string | yes |
Responses
Section titled Responses| Status | Meaning |
|---|---|
200 |
Success. |
422 |
The request is not valid. detail lists each problem. |
Fields of a 200 response:
| Field | Type |
|---|---|
zone_file |
string |
Add the records of a BIND zone file, such as another DNS host's export, to the zone
Section titled Add the records of a BIND zone file, such as another DNS host's export, to the zonePOST /api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/import
Add the records of a BIND zone file, such as another DNS host's export, to the zone.
Only the records the zone does not have are added, so a file can be
imported again safely. The file is read as BIND reads it: comments after
;, brackets over several lines, $TTL, $ORIGIN and TTL units. The
SOA record and NS records at @ the zone lacks are left out, so the
zone keeps our nameservers.
Nothing imported is proxied. A line a Cloudflare export tags
cf-proxied:true is stored DNS only, and notes says so for each one.
The answer counts the records imported and the duplicates the zone
already had. notes lists the lines left out or changed on purpose and
errors the lines that could not be read. A file over 2 MB answers 413.
429 after 10 imports in an hour on one zone.
Parameters
Section titled Parameters| Name | In | Type | Required |
|---|---|---|---|
zone_id |
path | integer | yes |
org_slug |
path | string | yes |
Request body
Section titled Request bodyapplication/json (required)
| Field | Type | Required |
|---|---|---|
zone_file |
string | yes |
Responses
Section titled Responses| Status | Meaning |
|---|---|
200 |
Success. |
422 |
The request is not valid. detail lists each problem. |
Fields of a 200 response:
| Field | Type |
|---|---|
imported |
integer |
duplicates |
integer |
notes |
array of string |
errors |
array of string |
The zone's records, by name and then type
Section titled The zone's records, by name and then typeGET /api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/records
The zone's records, by name and then type.
proxied is true only on a record a server's web address wrote for a
name in this domain. That record is changed and removed from the server,
never here.
Parameters
Section titled Parameters| Name | In | Type | Required | Description |
|---|---|---|---|---|
zone_id |
path | integer | yes | |
org_slug |
path | string | yes | |
record_type |
query | string or null | no | Only records of this type, such as A or TXT. Case is ignored. An unknown type answers an empty list. |
name |
query | string or null | no | Only records at this name, relative (www) or in full (www.example.com). A name outside the zone answers an empty list. |
page |
query | integer | no | The page to read, from 1. Default: 1. |
per_page |
query | integer | no | Records per page, from 1 to 1000. Default: 100. |
Responses
Section titled Responses| Status | Meaning |
|---|---|
200 |
Success. |
422 |
The request is not valid. detail lists each problem. |
A 200 response is a list; each item has these fields:
| Field | Type |
|---|---|
[].id |
integer |
[].zone_id |
integer |
[].name |
string |
[].record_type |
string |
[].content |
string |
[].ttl |
integer |
[].priority |
integer or null |
[].weight |
integer or null |
[].port |
integer or null |
[].proxied |
boolean |
[].comment |
string or null |
[].created_at |
string (date-time) |
[].updated_at |
string (date-time) |
Add a record to the zone
Section titled Add a record to the zonePOST /api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/records
Add a record to the zone.
name may be relative to the zone (www, @ for the domain itself)
or in full (www.example.com, with or without the trailing dot). Both
are stored as www, and the answer carries the stored name. A name
outside the zone answers 422. The content is checked against the type
(record_type). A CNAME cannot sit at @ or beside other records
at its name (409), and a zone holds up to 1,000 records (403).
proxied: true answers 422 and writes nothing. 429 after 240 record
changes in 10 minutes on one zone.
Parameters
Section titled Parameters| Name | In | Type | Required |
|---|---|---|---|
zone_id |
path | integer | yes |
org_slug |
path | string | yes |
Request body
Section titled Request bodyapplication/json (required)
| Field | Type | Required |
|---|---|---|
name |
string | yes |
record_type |
string | yes |
content |
string | yes |
ttl |
integer | no |
priority |
integer or null | no |
weight |
integer or null | no |
port |
integer or null | no |
proxied |
boolean | no |
comment |
string or null | no |
Responses
Section titled Responses| Status | Meaning |
|---|---|
201 |
Success. |
422 |
The request is not valid. detail lists each problem. |
Fields of a 201 response:
| Field | Type |
|---|---|
id |
integer |
zone_id |
integer |
name |
string |
record_type |
string |
content |
string |
ttl |
integer |
priority |
integer or null |
weight |
integer or null |
port |
integer or null |
proxied |
boolean |
comment |
string or null |
created_at |
string (date-time) |
updated_at |
string (date-time) |
Delete several of the zone's records as one change: all of them or none
Section titled Delete several of the zone's records as one change: all of them or nonePOST /api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/records/bulk-delete
Delete several of the zone's records as one change: all of them or none.
record_ids lists from 1 to 1,000 record ids, and a repeated id counts
once. When any of them is not a record of this zone, the call answers 404
with the ids it could not find and deletes nothing. When it would leave
fewer than two NS records at @, it answers 422 and deletes
nothing. When one of them belongs to a server's web address, it answers
409 and deletes nothing. The zone's serial goes up once. deleted is how many records
went. 429 after 30 bulk deletes in 10 minutes on one zone.
Parameters
Section titled Parameters| Name | In | Type | Required |
|---|---|---|---|
zone_id |
path | integer | yes |
org_slug |
path | string | yes |
Request body
Section titled Request bodyapplication/json (required)
| Field | Type | Required |
|---|---|---|
record_ids |
array of integer | yes |
Responses
Section titled Responses| Status | Meaning |
|---|---|
200 |
Success. |
422 |
The request is not valid. detail lists each problem. |
Fields of a 200 response:
| Field | Type |
|---|---|
deleted |
integer |
One record of the zone
Section titled One record of the zoneGET /api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/records/{record_id}
One record of the zone. A record of another zone answers 404.
Parameters
Section titled Parameters| Name | In | Type | Required |
|---|---|---|---|
zone_id |
path | integer | yes |
record_id |
path | integer | yes |
org_slug |
path | string | yes |
Responses
Section titled Responses| Status | Meaning |
|---|---|
200 |
Success. |
422 |
The request is not valid. detail lists each problem. |
Fields of a 200 response:
| Field | Type |
|---|---|
id |
integer |
zone_id |
integer |
name |
string |
record_type |
string |
content |
string |
ttl |
integer |
priority |
integer or null |
weight |
integer or null |
port |
integer or null |
proxied |
boolean |
comment |
string or null |
created_at |
string (date-time) |
updated_at |
string (date-time) |
Change a record: send only the fields to change
Section titled Change a record: send only the fields to changePUT /api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/records/{record_id}
Change a record: send only the fields to change.
name and record_type can change too. A new name is read as
POST reads one (relative or in full), and a new name or type passes
the same checks as a new record: a CNAME beside other records (409)
and the two NS records at @ (422). A new type that takes no
priority, weight or port drops them. proxied: true answers 422 and
changes nothing. A record that belongs to a server's web address answers
409. 429 after 240 record changes in 10 minutes on one zone.
Parameters
Section titled Parameters| Name | In | Type | Required |
|---|---|---|---|
zone_id |
path | integer | yes |
record_id |
path | integer | yes |
org_slug |
path | string | yes |
Request body
Section titled Request bodyapplication/json (required)
| Field | Type | Required |
|---|---|---|
name |
string or null | no |
record_type |
string or null | no |
content |
string or null | no |
ttl |
integer or null | no |
priority |
integer or null | no |
weight |
integer or null | no |
port |
integer or null | no |
proxied |
boolean or null | no |
comment |
string or null | no |
Responses
Section titled Responses| Status | Meaning |
|---|---|
200 |
Success. |
422 |
The request is not valid. detail lists each problem. |
Fields of a 200 response:
| Field | Type |
|---|---|
id |
integer |
zone_id |
integer |
name |
string |
record_type |
string |
content |
string |
ttl |
integer |
priority |
integer or null |
weight |
integer or null |
port |
integer or null |
proxied |
boolean |
comment |
string or null |
created_at |
string (date-time) |
updated_at |
string (date-time) |
Delete one record
Section titled Delete one recordDELETE /api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/records/{record_id}
Delete one record.
The zone keeps at least two NS records at @, so deleting one of
the last two answers 422. A record that belongs to a server's web address
answers 409. To delete several, use
POST .../zones/{zone_id}/records/bulk-delete. 429 after 240 record
changes in 10 minutes on one zone.
Parameters
Section titled Parameters| Name | In | Type | Required |
|---|---|---|---|
zone_id |
path | integer | yes |
record_id |
path | integer | yes |
org_slug |
path | string | yes |
Responses
Section titled Responses| Status | Meaning |
|---|---|
204 |
Success. |
422 |
The request is not valid. detail lists each problem. |