# Organization API: Customer Portal: Dns

> The 16 Organization API operations for dns.

Source: https://www.coritan.com/docs/api/reference/organizations/customer-portal/dns/

Part of [Customer Portal](/docs/api/reference/organizations/customer-portal/).

## Operations

| Method | Path | Summary |
| --- | --- | --- |
| GET | [`/api/v1/orgs/{org_slug}/portal/dns/nameservers`](#op-get-api-v1-orgs-org-slug-portal-dns-nameservers) | The nameservers a domain is pointed at to use a zone here |
| GET | [`/api/v1/orgs/{org_slug}/portal/dns/zones`](#op-get-api-v1-orgs-org-slug-portal-dns-zones) | The customer's zones, by domain, each with its record count |
| POST | [`/api/v1/orgs/{org_slug}/portal/dns/zones`](#op-post-api-v1-orgs-org-slug-portal-dns-zones) | Add a zone for domain |
| GET | [`/api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}`](#op-get-api-v1-orgs-org-slug-portal-dns-zones-zone-id) | One of the customer's zones |
| PATCH | [`/api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}`](#op-patch-api-v1-orgs-org-slug-portal-dns-zones-zone-id) | Switch DNSSEC on or off for the zone |
| DELETE | [`/api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}`](#op-delete-api-v1-orgs-org-slug-portal-dns-zones-zone-id) | Delete the zone and every record in it |
| GET | [`/api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/delegation`](#op-get-api-v1-orgs-org-slug-portal-dns-zones-zone-id-delegation) | Get zone delegation |
| GET | [`/api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/dnssec`](#op-get-api-v1-orgs-org-slug-portal-dns-zones-zone-id-dnssec) | Get DNSSEC info |
| GET | [`/api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/export`](#op-get-api-v1-orgs-org-slug-portal-dns-zones-zone-id-export) | The zone as a BIND zone file, in zonefile |
| POST | [`/api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/import`](#op-post-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 |
| GET | [`/api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/records`](#op-get-api-v1-orgs-org-slug-portal-dns-zones-zone-id-records) | The zone's records, by name and then type |
| POST | [`/api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/records`](#op-post-api-v1-orgs-org-slug-portal-dns-zones-zone-id-records) | Add a record to the zone |
| POST | [`/api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/records/bulk-delete`](#op-post-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 |
| GET | [`/api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/records/{record_id}`](#op-get-api-v1-orgs-org-slug-portal-dns-zones-zone-id-records-record-id) | One record of the zone |
| PUT | [`/api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/records/{record_id}`](#op-put-api-v1-orgs-org-slug-portal-dns-zones-zone-id-records-record-id) | Change a record: send only the fields to change |
| DELETE | [`/api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}/records/{record_id}`](#op-delete-api-v1-orgs-org-slug-portal-dns-zones-zone-id-records-record-id) | Delete one record |

### The nameservers a domain is pointed at to use a zone here {#op-get-api-v1-orgs-org-slug-portal-dns-nameservers}

`GET /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

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `org_slug` | path | string | yes |

#### 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 {#op-get-api-v1-orgs-org-slug-portal-dns-zones}

`GET /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

| 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

| 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 {#op-post-api-v1-orgs-org-slug-portal-dns-zones}

`POST /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

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `org_slug` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required |
| --- | --- | --- |
| `domain` | string | yes |

#### 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 {#op-get-api-v1-orgs-org-slug-portal-dns-zones-zone-id}

`GET /api/v1/orgs/{org_slug}/portal/dns/zones/{zone_id}`

One of the customer's zones. 404 for any other zone id.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `zone_id` | path | integer | yes |
| `org_slug` | path | string | yes |

#### 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 {#op-patch-api-v1-orgs-org-slug-portal-dns-zones-zone-id}

`PATCH /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

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `zone_id` | path | integer | yes |
| `org_slug` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required |
| --- | --- | --- |
| `dnssec_enabled` | boolean | yes |

#### 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 {#op-delete-api-v1-orgs-org-slug-portal-dns-zones-zone-id}

`DELETE /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

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `zone_id` | path | integer | yes |
| `org_slug` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `204` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Get zone delegation {#op-get-api-v1-orgs-org-slug-portal-dns-zones-zone-id-delegation}

`GET /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

| 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

| 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 {#op-get-api-v1-orgs-org-slug-portal-dns-zones-zone-id-dnssec}

`GET /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

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `zone_id` | path | integer | yes |
| `org_slug` | path | string | yes |

#### 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 {#op-get-api-v1-orgs-org-slug-portal-dns-zones-zone-id-export}

`GET /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

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `zone_id` | path | integer | yes |
| `org_slug` | path | string | yes |

#### 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 {#op-post-api-v1-orgs-org-slug-portal-dns-zones-zone-id-import}

`POST /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

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `zone_id` | path | integer | yes |
| `org_slug` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required |
| --- | --- | --- |
| `zone_file` | string | yes |

#### 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 {#op-get-api-v1-orgs-org-slug-portal-dns-zones-zone-id-records}

`GET /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

| 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

| 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 {#op-post-api-v1-orgs-org-slug-portal-dns-zones-zone-id-records}

`POST /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

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `zone_id` | path | integer | yes |
| `org_slug` | path | string | yes |

#### Request body

`application/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

| 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 {#op-post-api-v1-orgs-org-slug-portal-dns-zones-zone-id-records-bulk-delete}

`POST /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

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `zone_id` | path | integer | yes |
| `org_slug` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required |
| --- | --- | --- |
| `record_ids` | array of integer | yes |

#### 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 {#op-get-api-v1-orgs-org-slug-portal-dns-zones-zone-id-records-record-id}

`GET /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

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `zone_id` | path | integer | yes |
| `record_id` | path | integer | yes |
| `org_slug` | path | string | yes |

#### 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 {#op-put-api-v1-orgs-org-slug-portal-dns-zones-zone-id-records-record-id}

`PUT /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

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `zone_id` | path | integer | yes |
| `record_id` | path | integer | yes |
| `org_slug` | path | string | yes |

#### Request body

`application/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

| 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 {#op-delete-api-v1-orgs-org-slug-portal-dns-zones-zone-id-records-record-id}

`DELETE /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

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `zone_id` | path | integer | yes |
| `record_id` | path | integer | yes |
| `org_slug` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `204` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |
