DNS APIv2beta1

Download OpenAPI

Introduction

The DNS API allows you to manage your DNS zones and records.

Features

  • Manage your domain with one or more zones
  • Use Dynamic Records to optimize and ease your Infra As Code

A domain name is an identification string that defines a realm of administrative autonomy, authority or control within the Internet. Domain names are formed by the rules and procedures of the Domain Name System (DNS). Any name registered in the DNS is a domain name.

Domains are further divided into sub-domains, each becoming a DNS zone itself with its own set of administrators and DNS servers.

The term domain is used in the business functions of the entity assigned to it and the term zone is usually used for configuration of DNS services.

example.com is the domain and has only one owner who can manage it.

By default, the domain only has a root zone (no sub domain).

example.com zone allows the configuration of records such as:

If we add a DNS zone to the sub domain dev.example.com, we get:

  • Only the owner of the domain can use the domain services
  • Each zone supports the creation of sub-zones, which inherit the parent's projectID

In the simplest case you will only need the root zone.

But multiple zones (i.e. sub-domains) allow:

  • access delegation to zone(s) (preventing access to the root zone)
  • (future) features based on templates
  • performance tuning (for example if you have 10k records, it will be better to divide them into x zones / sub-domains)

Remark: to be RFC compliant, each zone will automatically have NS records added.

An internationalized domain name (IDN) is an Internet domain name that contains at least one label that is displayed in software applications, which is in whole or in part in a language-specific script or alphabet, such as Arabic, Chinese, Cyrillic, Tamil, Hebrew or the Latin alphabet-based characters with diacritics or ligatures, such as French. These writing systems are encoded by computers in multi-byte Unicode. Internationalized domain names are stored in the Domain Name System as ASCII strings using Punycode transcription.

Example: allélua.com converted in IDN is xn--alllua-dva.com.

To simplify its use, the DNS API uses unicode (UTF-8) for name and data fields.

Login to your Scaleway account and create a token from the credentials page. A secret_key and an access_key will be displayed on your screen, the secret_key will be used as X-Auth-Token.

Reference: https://www.scaleway.com/docs/generate-an-api-token/

The organization id is required to get the permissions. You will need to query:

To get your organization id:

Reference: https://www.scaleway.com/docs/retrieve-my-organization-id-throught-the-api/

Get the service info

To use Scaleway DNS to manage your Domain, you need to register your Domain with:

You will then have 48h to set up a TXT record to confirm the ownership of the Domain:

  • name: _scaleway-challenge
  • content: the validation token

Upon validation you will receive a confirmation email and the Domain will be available on the API. You will then have to update your DNS nameservers to Scaleway DNS servers: ns0.dom.scw.cloud and ns1.dom.scw.cloud.

  • for a Domain: at your registrar to point your Domain to Scaleway DNS servers
  • for a sub Domain: at your parent DNS server to point your sub Domain to Scaleway DNS servers

DNSSEC

Your domain's DNSSEC needs to be set up on the registry by your registrar and on the DNS server with the same information. If need: remove your DNSSEC settings on your registrar before migrating to our service. You will be able to re-setup if after.

To set up the DNSSEC:

  • use the Registrar API EnableDomainDNSSEC to generate the setup on the DNS servers
  • if your domain is not registered on Scaleway but on another Registrar, use the DS or public key information to configure the DNSSEC on your registrar
  • record name format is always in "short" format not FQDN.
  • for zone example.com, name test.example.com. will be converted to test
  • for data value, if not in RFC format, it will be corrected if possible:
    • for TXT, quotes will be added
    • for CNAME, if not in FQDN, the zone will be added
    • etc.

Remarks:

  • The clear operation clears all the records (thus allows to restart from scratch)
  • The operation works the same as PowerDns patch
  • If the zone does not exist but is included in a managed zone, the API will create the new (sub) zone

For external domain:

You have not DNSSEC set at your registrar

You will have to set in your registrar the DS returned in the result:

You have DNSSEC already set at your registrar

Call the API with the right settings:

We provide the classic record types (A, AAAA, CNAME...) along with some dynamic records. At the moment the following dynamic records are supported: http(s) health checks and views.

Service up

This will test if a (http/https) service is up on a provided list of IPs.

An IP is considered healthy if the query response contains the text specified in must_contain.

The Record Type can be one of:

  • A
  • AAAA

View

View will give responses depending on the requester (or resolver) IP.

Record Type can be:

  • A
  • AAAA
  • CNAME
  • TXT

Delete the zone AND all the records, NS included:

List DNS zones

Returns a list of manageable DNS zones. You can filter the DNS zones by domain name.

GET
/domain/v2beta1/dns-zones
Query Parameters

organization_id
string
The organization ID on which to filter the returned DNS zones.

project_id
string
The project ID on which to filter the returned DNS zones.

order_by
string
The sort order of the returned DNS zones. Possible values are domain_asc, domain_desc, subdomain_asc and subdomain_desc. The default value is domain_asc.

page
integer
The page number for the returned DNS zones. The default value is 1.

page_size
integer
The maximum number of DNS zones per page. The default value is 20.

domain
string
The domain on which to filter the returned DNS zones.

dns_zone
string
The DNS zone on which to filter the returned DNS zones.
200 Response

total_count
integer
The total number of DNS zones.

dns_zones
array
The paginated returned DNS zones.
Response Example

Create a new DNS zone.

POST
/domain/v2beta1/dns-zones
Body

domain
required string
The domain of the DNS zone to create.

subdomain
required string
The subdomain of the DNS zone to create.

project_id
required string
The project ID where the DNS zone will be created.
Request Example
200 Response

domain
string

subdomain
string

ns
array

ns_default
array

ns_master
array

status
string
Possible values are unknown, active, pending, error and locked. The default value is unknown.

message
nullable string

updated_at
nullable string
(RFC 3339 format).

project_id
string
Response Example

Update the name and/or the organizations for a DNS zone.

PATCH
/domain/v2beta1/dns-zones/{dns_zone}
Path Parameters

dns_zone
required string
The DNS zone to update.
Body

new_dns_zone
required string
The new DNS zone.

project_id
required string
The project ID of the new DNS zone.
Request Example
200 Response

domain
string

subdomain
string

ns
array

ns_default
array

ns_master
array

status
string
Possible values are unknown, active, pending, error and locked. The default value is unknown.

message
nullable string

updated_at
nullable string
(RFC 3339 format).

project_id
string
Response Example

Delete a DNS zone and all it's records.

DELETE
/domain/v2beta1/dns-zones/{dns_zone}
Path Parameters

dns_zone
required string
The DNS zone to delete.
Query Parameters

project_id
required string
The project ID of the DNS zone to delete.
200 Response

Response Example

Clone an existed DNS zone with all its records into a new one.

POST
/domain/v2beta1/dns-zones/{dns_zone}/clone
Path Parameters

dns_zone
required string
The DNS zone to clone.
Body

dest_dns_zone
required string
The destinaton DNS zone.

overwrite
boolean
Whether or not the destination DNS zone will be overwritten.

project_id
nullable string
The project ID of the destination DNS zone.
Request Example
200 Response

domain
string

subdomain
string

ns
array

ns_default
array

ns_master
array

status
string
Possible values are unknown, active, pending, error and locked. The default value is unknown.

message
nullable string

updated_at
nullable string
(RFC 3339 format).

project_id
string
Response Example

Refresh SOA DNS zone. You can recreate the given DNS zone and its sub DNS zone if needed.

POST
/domain/v2beta1/dns-zones/{dns_zone}/refresh
Path Parameters

dns_zone
required string
The DNS zone to refresh.
Body

recreate_dns_zone
boolean
Whether or not to recreate the DNS zone.

recreate_sub_dns_zone
boolean
Whether or not to recreate the sub DNS zone.
Request Example
200 Response

dns_zones
array
The returned DNS zones.
Response Example

Get the DNS zone TSIG Key to allow AXFR request.

GET
/domain/v2beta1/dns-zones/{dns_zone}/tsig-key
Path Parameters

dns_zone
required string
200 Response

name
string

key
string

algorithm
string
Response Example
DELETE
/domain/v2beta1/dns-zones/{dns_zone}/tsig-key
Path Parameters

dns_zone
required string
204 Response

Empty response
GET
/domain/v2beta1/ssl-certificates
Query Parameters

dns_zone
string

page
integer
Page number. The default value is 1.

page_size
integer
Page size. The default value is 20.

project_id
nullable string
200 Response

total_count
integer

certificates
array
Response Example
POST
/domain/v2beta1/ssl-certificates
Body

dns_zone
string

alternative_dns_zones
array
Request Example
200 Response

dns_zone
string

alternative_dns_zones
array

status
string
Possible values are unknown, new, pending, success and error. The default value is unknown.

private_key
string

certificate_chain
string

created_at
nullable string
(RFC 3339 format).

expired_at
nullable string
(RFC 3339 format).
Response Example
GET
/domain/v2beta1/ssl-certificates/{dns_zone}
Path Parameters

dns_zone
required string
200 Response

dns_zone
string

alternative_dns_zones
array

status
string
Possible values are unknown, new, pending, success and error. The default value is unknown.

private_key
string

certificate_chain
string

created_at
nullable string
(RFC 3339 format).

expired_at
nullable string
(RFC 3339 format).
Response Example
DELETE
/domain/v2beta1/ssl-certificates/{dns_zone}
Path Parameters

dns_zone
required string
200 Response

Response Example

Returns a list of Nameservers and their optional glue records for a DNS zone.

GET
/domain/v2beta1/dns-zones/{dns_zone}/nameservers
Path Parameters

dns_zone
required string
The DNS zone on which to filter the returned DNS zone nameservers.
Query Parameters

project_id
string
The project ID on which to filter the returned DNS zone nameservers.
200 Response

ns
array
The returned DNS zone nameservers.
Response Example

Update DNS zone nameservers and set optional glue records.

PUT
/domain/v2beta1/dns-zones/{dns_zone}/nameservers
Path Parameters

dns_zone
required string
The DNS zone where the DNS zone nameservers will be updated.
Body

ns
required array
The new DNS zone nameservers.
Request Example
200 Response

ns
array
The returned DNS zone nameservers.
Response Example

Returns a list of DNS records of a DNS zone with default NS. You can filter the records by type and name.

GET
/domain/v2beta1/dns-zones/{dns_zone}/records
Path Parameters

dns_zone
required string
The DNS zone on which to filter the returned DNS zone records.
Query Parameters

project_id
string
The project ID on which to filter the returned DNS zone records.

order_by
string
The sort order of the returned DNS zone records. Possible values are name_asc and name_desc. The default value is name_asc.

page
integer
The page number for the returned DNS zone records. The default value is 1.

page_size
integer
The maximum number of DNS zone records per page. The default value is 20.

name
string
The name on which to filter the returned DNS zone records.

type
string
The record type on which to filter the returned DNS zone records. Possible values are unknown, A, AAAA, CNAME, TXT, SRV, TLSA, MX, NS, PTR, CAA, ALIAS, LOC, SSHFP, HINFO, RP, URI, DS, NAPTR and DNAME. The default value is unknown.

id
string
The record ID on which to filter the returned DNS zone records.
200 Response

total_count
integer
The total number of DNS zone records.

records
array
The paginated returned DNS zone records.
Response Example

Only available with default NS.
Send a list of actions and records.

Action can be:

  • add:
  • Add new record
  • Can be more specific and add a new IP to an existing A record for example
  • set:
  • Edit a record
  • Can be more specific and edit an IP from an existing A record for example
  • delete:
  • Delete a record
  • Can be more specific and delete an IP from an existing A record for example
  • clear:
  • Delete all records from a DNS zone

All edits will be versioned.

PATCH
/domain/v2beta1/dns-zones/{dns_zone}/records
Path Parameters

dns_zone
required string
The DNS zone where the DNS zone records will be updated.
Body

changes
required array
The changes made to the records.

return_all_records
nullable boolean
Whether or not to return all the records.

disallow_new_zone_creation
boolean
Forbid the creation of the target zone if not existing (default action is yes).

serial
nullable integer
Don't use the autoincremenent serial but the provided one (0 to keep the same).
Request Example
200 Response

records
array
The returned DNS zone records.
Response Example

Only available with default NS.
Delete all the records from a DNS zone. All edits will be versioned.

DELETE
/domain/v2beta1/dns-zones/{dns_zone}/records
Path Parameters

dns_zone
required string
The DNS zone to clear.
200 Response

Response Example

Get a list of DNS zone versions.
The maximum version count is 100.
If the count reaches this limit, the oldest version will be deleted after each new modification.

GET
/domain/v2beta1/dns-zones/{dns_zone}/versions
Path Parameters

dns_zone
required string
Query Parameters

page
integer
The page number for the returned DNS zones versions. The default value is 1.

page_size
integer
The maximum number of DNS zones versions per page. The default value is 20.
200 Response

total_count
integer
The total number of DNS zones versions.

versions
array
Response Example

Get a list of records from a previous DNS zone version.

GET
/domain/v2beta1/dns-zones/version/{dns_zone_version_id}
Path Parameters

dns_zone_version_id
required string
(UUID format).
Query Parameters

page
integer
The page number for the returned DNS zones versions records. The default value is 1.

page_size
integer
The maximum number of DNS zones versions records per page. The default value is 20.
200 Response

total_count
integer
The total number of DNS zones versions records.

records
array
Response Example

Get all differences from a previous DNS zone version.

GET
/domain/v2beta1/dns-zones/version/{dns_zone_version_id}/diff
Path Parameters

dns_zone_version_id
required string
(UUID format).
200 Response

changes
array
Response Example

Restore and activate a previous DNS zone version.

POST
/domain/v2beta1/dns-zones/version/{dns_zone_version_id}/restore
Path Parameters

dns_zone_version_id
required string
(UUID format).
Body

Request Example
200 Response

Response Example

Import and replace records from a given provider format with default NS.

POST
/domain/v2beta1/dns-zones/{dns_zone}/import-provider
Path Parameters

dns_zone
required string
Body

online_v1
object
Only one of online_v1 may be set.
Request Example
200 Response

records
array
Response Example

Get a DNS zone in a given format with default NS.

GET
/domain/v2beta1/dns-zones/{dns_zone}/raw
Path Parameters

dns_zone
required string
The DNS zone to export.
Query Parameters

format
string
Format for DNS zone. Possible values are unknown_raw_format and bind. The default value is bind.
200 Response

name
string

content_type
string

content
string
Response Example

Import and replace records from a given provider format with default NS.

POST
/domain/v2beta1/dns-zones/{dns_zone}/raw
Path Parameters

dns_zone
required string
The DNS zone to import.
Body

content
deprecated string

project_id
string

format
string
Possible values are unknown_raw_format and bind. The default value is unknown_raw_format.

bind_source
object
Import a bind file format. Only one of bind_source and axfr_source may be set.

axfr_source
object
Import from the nameserver given with tsig use or not. Only one of bind_source and axfr_source may be set.
Request Example
200 Response

records
array
Response Example