Zones API

Zone attributes

Please refer to the definition of the Zone data type in our OpenAPI documentation.

List zones

Lists the zones in the account.

GET /:account/zones

Parameters

Name Type Description
:account integer The account id

Filters

Name Description
:name_like Only include zones containing given string

Sorting

For general information about sorting, please refer to the main guide.

Name Description
id Sort zones by ID
name Sort zones by name (alphabetical order)

The default sorting policy is by ascending name.

Examples

List all zones in the account 1010:

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      https://api.dnsimple.com/v2/1010/zones

List all zones in the account 1010 that have name matching "example":

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      https://api.dnsimple.com/v2/1010/zones?name_like=example

Response

Responds with HTTP 200 on success.

{
  "data": [
    {
      "id": 1,
      "account_id": 1010,
      "name": "example-alpha.com",
      "reverse": false,
      "created_at": "2015-04-23T07:40:03Z",
      "updated_at": "2015-04-23T07:40:03Z"
    },
    {
      "id": 2,
      "account_id": 1010,
      "name": "example-beta.com",
      "reverse": true,
      "created_at": "2015-04-23T07:40:03Z",
      "updated_at": "2015-04-23T07:40:03Z"
    }
  ],
  "pagination": {
    "current_page": 1,
    "per_page": 30,
    "total_entries": 2,
    "total_pages": 1
  }
}

Errors

Responds with HTTP 401 in case of case of authentication issues.

Retrieve a zone

GET /:account/zones/:zone

Parameters

Name Type Description
:account integer The account id
:zone string The zone name

Example

Get the zone example.com in the account 1010:

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      https://api.dnsimple.com/v2/1010/zones/example.com

Response

Responds with HTTP 200 on success.

{
  "data": {
    "id": 1,
    "account_id": 1010,
    "name": "example-alpha.com",
    "reverse": false,
    "created_at": "2015-04-23T07:40:03Z",
    "updated_at": "2015-04-23T07:40:03Z"
  }
}

Errors

Responds with HTTP 401 in case of case of authentication issues.

Download a zone file

GET /:account/zones/:zone/file

Parameters

Name Type Description
:account integer The account id
:zone string The zone name

Example

Get the zone file example.com in the account 1010:

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      https://api.dnsimple.com/v2/1010/zones/example.com/file

Response

Responds with HTTP 200 on success.

{
  "data": {
    "zone": "$ORIGIN example.com.\n$TTL 1h\nexample.com. 3600 IN SOA ns1.dnsimple.com. admin.dnsimple.com. 1453132552 86400 7200 604800 300\nexample.com. 3600 IN NS ns1.dnsimple.com.\nexample.com. 3600 IN NS ns2.dnsimple.com.\nexample.com. 3600 IN NS ns3.dnsimple.com.\nexample.com. 3600 IN NS ns4.dnsimple.com.\n"
  }
}

Errors

Responds with HTTP 401 in case of case of authentication issues.

Check zone distribution

GET /:account/zones/:zone/distribution

Checks if a zone change is fully distributed to all our nameservers across the globe.

This feature can’t be tested in our Sandbox environment.

Parameters

Name Type Description
:account integer The account id
:zone string The zone name

Example

Check the zone distribution for example.com in the account 1010:

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      https://api.dnsimple.com/v2/1010/zones/example.com/distribution

Response

Responds with HTTP 200 when the zone is fully distributed.

{
  "data": {
    "distributed": true
  }
}

Responds with HTTP 200 when the zone is not distributed.

{
  "data": {
    "distributed": false
  }
}

Errors

Responds with HTTP 401 in case of case of authentication issues.

Responds with HTTP 504 when the server failed to perform the check.

{
  "message": "Could not query zone, connection timed out"
}