Skip to content

DNS Hosting API

A DNS hosting product sells one DNS zone at Cloudflare, PowerDNS, Hetzner DNS, ClouDNS, DigitalOcean or deSEC. These calls read and change the zone of a DNS hosting order, find it by its order (order_id) and work on the DNS provider directly. A call that reaches the provider can fail with its answer, such as The DNS provider could not be reached. or The DNS provider refused the request (HTTP 403). (code 502). See Sell DNS hosting for a domain.

Admin calls need Module access on the Servicednshosting card of the staff group’s Permissions tab, plus each call’s own permission below (Super Administrators have all). See Authentication.

POST /api/admin/servicednshosting/zone

Reads a DNS hosting order’s zone from the DNS provider: its records and nameservers.

Permission: View orders (order.view) and View DNS records (servicednshosting.view)

Parameter Type Description
order_id integer, required The DNS hosting order’s id.

Returns: An object: id, domain_name, nameservers (the zone’s nameservers; read from its NS records when the provider gave none), types (the record types this provider takes) and records (each: id, name (relative to the zone, empty for the zone itself), type, value, ttl and priority). When the DNS provider cannot be reached or refuses, only error (its message).

Errors:

  • Order ID is required. (code 9999)
  • DNS order not found. (code 404) when the order has no DNS zone record
  • DNS order is not active. (code 9999) when the zone record has no zone at the provider (not created yet); a zone removed at the provider gives a result with error

Staff can read the zone of an order in any status while the zone exists at the provider.

POST /api/client/servicednshosting/zone

Reads the zone of one of the client’s DNS hosting orders: its records, nameservers and the record types the client can add.

Parameter Type Description
order_id integer, required The client’s active DNS hosting order.

Returns: An object: id, domain_name, nameservers (the zone’s nameservers; read from its NS records when the provider gave none), types (the record types this provider takes) and records (each: id, name (relative to the zone, empty for the zone itself), type, value, ttl and priority). When the DNS provider cannot be reached or refuses, only error (its message).

Errors:

  • Order ID is required. (code 9999)
  • DNS order not found. (code 404) for another client’s order
  • DNS order is not active. (code 9999)

An authorized user needs View services (products).

POST /api/client/servicednshosting/add

Adds a record to the zone.

Parameter Type Description
order_id integer, required The client’s active DNS hosting order.
record_type string, required The record type: A, AAAA, CNAME, MX and TXT at every provider; DS too except at DigitalOcean; SPF too at PowerDNS, ClouDNS and deSEC.
record_name string Relative to the zone, such as www or *.dev; @ or empty for the zone itself. The full name is taken too.
record_value string, required One line. A and AAAA: an IP address of that kind. CNAME and MX: a domain name (a final dot is kept); . with priority 0 is a null MX. TXT and SPF: up to 2048 bytes, SPF starting with v=spf1. DS (for a subdomain only): key tag, algorithm, digest type and the hexadecimal digest.
record_ttl integer Seconds. Default 3600. At least 60 at Hetzner DNS, 30 at DigitalOcean and 1 elsewhere; ClouDNS takes only 60, 300, 900, 1800, 3600, 21600, 43200, 86400, 172800, 259200, 604800, 1209600 or 2592000.
record_priority integer For MX: 0 to 65535. Default 0.

Returns: true.

Errors:

  • Order ID is required. (code 9999)
  • DNS order not found. (code 404)
  • DNS order is not active. (code 9999)
  • Unsupported DNS record type. (code 9999)
  • Enter a relative record name such as www, or @ for the zone apex. (code 9999)
  • Enter a TTL between 60 and 2147483647 seconds. (code 9999), with the lowest TTL of the provider
  • ClouDNS does not support this TTL. (code 9999)
  • Enter a single-line DNS record value. (code 9999)
  • Enter an MX priority between 0 and 65535. (code 9999)
  • Enter a valid IP address for the A record. (code 9999)
  • Enter a valid domain name. (code 9999)
  • Enter a valid TXT value of up to 2048 bytes. (code 9999)
  • Enter a DS record for a subdomain with key tag, algorithm, digest type, and hexadecimal digest. (code 9999)
  • This DNS record value already exists. (code 9999) at PowerDNS, Hetzner DNS and deSEC

An authorized user needs Manage services (manageproducts).

Example

Request parameters:

{
"order_id": 512,
"record_type": "MX",
"record_name": "@",
"record_value": "mail.example.com",
"record_ttl": 3600,
"record_priority": 10
}

result:

true

POST /api/client/servicednshosting/update

Changes a record’s value, TTL and, for MX, priority. Its name and type stay: to change them, delete the record and add a new one.

Parameter Type Description
order_id integer, required The client’s active DNS hosting order.
record_id string, required The record’s id from zone.
record_value string, required One line. A and AAAA: an IP address of that kind. CNAME and MX: a domain name (a final dot is kept); . with priority 0 is a null MX. TXT and SPF: up to 2048 bytes, SPF starting with v=spf1. DS (for a subdomain only): key tag, algorithm, digest type and the hexadecimal digest.
record_ttl integer As in add. Left out it is 3600, not the record’s old TTL.
record_priority integer For MX: 0 to 65535. Left out keeps the record’s priority.

Returns: true.

Errors:

  • Order ID is required. (code 9999)
  • Record ID is required. (code 9999)
  • DNS order not found. (code 404)
  • DNS order is not active. (code 9999)
  • DNS record not found. Refresh the page and try again. (code 9999), also for a record the client cannot change, such as the NS and SOA records
  • Enter a TTL between 60 and 2147483647 seconds. (code 9999), with the lowest TTL of the provider
  • ClouDNS does not support this TTL. (code 9999)
  • Enter a single-line DNS record value. (code 9999)
  • Enter an MX priority between 0 and 65535. (code 9999)
  • Enter a valid IP address for the A record. (code 9999)
  • Enter a valid domain name. (code 9999)
  • Enter a valid TXT value of up to 2048 bytes. (code 9999)
  • Enter a DS record for a subdomain with key tag, algorithm, digest type, and hexadecimal digest. (code 9999)
  • This DNS record value already exists. (code 9999) at PowerDNS, Hetzner DNS and deSEC

An authorized user needs Manage services (manageproducts).

POST /api/client/servicednshosting/del

Deletes a record from the zone.

Parameter Type Description
order_id integer, required The client’s active DNS hosting order.
record_id string, required The record’s id from zone.

Returns: true.

Errors:

  • Order ID is required. (code 9999)
  • Record ID is required. (code 9999)
  • DNS order not found. (code 404)
  • DNS order is not active. (code 9999)
  • DNS record not found. Refresh the page and try again. (code 9999), also for a record the client cannot change, such as the NS and SOA records

An authorized user needs Manage services (manageproducts).

POST /api/client/servicednshosting/dnssec

Returns the zone’s DNSSEC state and the DS records to publish at the domain’s registrar.

Parameter Type Description
order_id integer, required The client’s active DNS hosting order.

Returns: An object: supported (false when the provider offers no DNSSEC for the zone; Hetzner DNS and DigitalOcean then return only this field, ClouDNS returns all four), enabled, can_toggle (whether dnssec_enable and dnssec_disable work; deSEC keeps it always on) and ds (the DS records). When the DNS provider cannot be reached or refuses, only error (its message).

Errors:

  • Order ID is required. (code 9999)
  • DNS order not found. (code 404)
  • DNS order is not active. (code 9999)

An authorized user needs View services (products).

Example

Request parameters:

{
"order_id": 512
}

result:

{
"supported": true,
"enabled": true,
"can_toggle": true,
"ds": [
"2371 13 2 1f987cc6583e92df0890718c42a4d6e5d6ab6e8aa6b4b1fa3e15f7a6b4d4c3a2"
]
}

POST /api/client/servicednshosting/dnssec_enable

Turns DNSSEC on for the zone. Then publish the DS records from dnssec at the domain’s registrar.

Parameter Type Description
order_id integer, required The client’s active DNS hosting order.

Returns: true.

Errors:

  • Order ID is required. (code 9999)
  • DNS order not found. (code 404)
  • DNS order is not active. (code 9999)
  • This DNS provider does not allow changing DNSSEC. (code 9999) at Hetzner DNS, DigitalOcean and deSEC

An authorized user needs Manage services (manageproducts).

POST /api/client/servicednshosting/dnssec_disable

Turns DNSSEC off for the zone. Remove the DS records at the domain’s registrar first.

Parameter Type Description
order_id integer, required The client’s active DNS hosting order.

Returns: true.

Errors:

  • Order ID is required. (code 9999)
  • DNS order not found. (code 404)
  • DNS order is not active. (code 9999)
  • This DNS provider does not allow changing DNSSEC. (code 9999) at Hetzner DNS, DigitalOcean and deSEC

An authorized user needs Manage services (manageproducts).

POST /api/guest/servicednshosting/nameservers

Returns the nameservers a DNS hosting product shows on its order form.

Parameter Type Description
product_id integer, required An enabled DNS hosting product.

Returns: A list of nameservers, as set on the product; empty when none are set (the provider then gives them when the zone is made).

Errors:

  • Product ID is required. (code 9999)
  • DNS product not found. (code 404)
Example

Request parameters:

{
"product_id": 31
}

result:

[
"ns1.example.net",
"ns2.example.net"
]