Zones API

List zones

GET /:account/zones

List zones in the account.

Parameters

Name Type Description
:account integer The account id

Example

List all zones in the account 1010:

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

Response

Responds with HTTP 200.

{
  "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
  }
}

Filters

Name Description
:name_like Only include zones containing given string

Example

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

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.

Get 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, renders the zone.

{
  "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"
  }
}

Get 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, renders the zone file.

{
  "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"
  }
}