DNS Analytics

This API is currently in Public Beta. During the Public Beta period, changes may occur at any time.

Query DNS Analytics data

Queries and returns DNS Analytics data available for the provided query parameters:

GET /:account/dns_analytics

Parameters

Name Type Description
:account integer The account ID

Groupings

Name Description
:zone_name Group rows by zone name
:date Group rows by date

No groupings will be applied by default unless specified. Multiple groupings can be provided, separated by a comma.

Applying groupings to the query will add columns to the response payload.

Filters

Name Default value Description
:start_date 31 days before the current date Only include results starting from the provided date
:end_date The day before the current date Only include results up to the provided date

Both dates are inclusive, and must be provided in ISO 8601 format (e.g. 2024-08-01).

The maximum allowed date range is 31 days.

Sorting

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

Name Description
zone_name Sort rows by zone name
date Sort rows by date
volume Sort rows by query volume

The default sorting policy is by ascending date, then ascending zone_name.

Pagination

Pagination is supported in this endpoint:

  • The default page size (per_page query parameter) is 1,000.
  • The maximum supported page size (per_page query parameter) is 10,000.
  • Please refer to the main guide.

Example: get total query volume data for the entire account

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

Example: get the top ten zones by volume in December, 2023

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      https://api.dnsimple.com/v2/dns_analytics?groupings=zone_name&sort=volume:desc&per_page=10&start_date=2023-12-01&end_date=2023-12-31

Example: get daily query volume for all zones in the account for the last 31 days, with custom sorting

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      https://api.dnsimple.com/v2/dns_analytics?groupings=date,zone_name&sort=date:desc,zone_name:asc

Response

Responds with HTTP 200.

Example
{
  "data": {
    "headers": [
      "zone_name",
      "date",
      "volume"
    ],
    "rows": [
      [
        "bar.com",
        "2023-12-08",
        1200
      ],
      [
        "bar.com",
        "2023-12-09",
        1200
      ],
      [
        "bar.com",
        "2024-01-07",
        1200
      ],
      [
        "bar.com",
        "2024-01-08",
        1200
      ],
      [
        "example.com",
        "2023-12-08",
        1200
      ],
      [
        "example.com",
        "2023-12-09",
        1200
      ],
      [
        "example.com",
        "2024-01-07",
        1200
      ],
      [
        "example.com",
        "2024-01-08",
        1200
      ],
      [
        "foo.com",
        "2023-12-08",
        1200
      ],
      [
        "foo.com",
        "2023-12-09",
        1200
      ],
      [
        "foo.com",
        "2024-01-07",
        1200
      ],
      [
        "foo.com",
        "2024-01-08",
        1200
      ]
    ]
  },
  "query": {
    "account_id": 1,
    "start_date": "2023-12-08",
    "end_date": "2024-01-08",
    "sort": "zone_name:asc,date:asc",
    "page": 0,
    "per_page": 100,
    "groupings": "zone_name,date"
  },
  "pagination": {
    "current_page": 0,
    "per_page": 100,
    "total_entries": 93,
    "total_pages": 1
  }
}

Errors

Responds with HTTP 401 if there are authentication issues.