Skip to content

DNS

OAuth scopes: reads require dns:read, writes require dns:write.

Per-zone permissions

The scope is not the whole check — the credential's user also needs permission on the zone's account:

  • Changing a zone (DNSSEC) and creating, updating or deleting its records requires edit access.
  • Deleting a zone requires delete permission.

Failing either returns 403 with code: "forbidden". Account-bearer API keys that are not tied to a user are not subject to this per-user check.

DNS Zones

List DNS Zones

This is not account scoped and will return ALL dns zones this user has access to.

GET /api/dns_zones

Params (optional)
  • page: Integer | page number (default: 1)
  • per_page: Integer | records per page (default: 50, max: 100)
Returned Params
  • dns_zones: Array
    • id: String
    • name: String
    • dnssec: Boolean
    • dnssec_data: Object (nil if dnssec = false)
    • created_at: DateTime
    • updated_at: DateTime
    • account: Object
      • id: String
      • name: String

View a Zone

GET /api/dns_zones/:id

Returned Params
  • dns_zone: Object
    • id: String
    • name: String
    • dnssec: Boolean
    • dnssec_data: Object (nil if dnssec = false)
      • Enabled: Boolean
      • DsRecord: String
      • Digest: String
      • DigestType: String
      • Algorithm: Integer
      • PublicKey: String
      • KeyTag: Integer
      • Flags: Integer
      • DsConfigured: Boolean
    • created_at: DateTime
    • updated_at: DateTime
    • account: Object
      • id: String
      • name: String
    • records: Array
      • id: String
      • record_type: Integer
      • ttl: Integer
      • value: String
      • name: String
      • priority: Integer
      • port: Integer
      • flags: Integer
      • record_tag: String
      • comment: String
      • site: Object | null | always present; the site reached through the record's linked domain, null when there is none
        • id: String
        • name: String
        • created_at: DateTime
        • updated_at: DateTime
        • primary_domain: String
        • location: String
        • package: String
      • created_at: DateTime
      • updated_at: DateTime
    • nameservers: Array

Enable / Disable DNSSEC

PATCH /api/dns_zones/:id

Params
  • dns_zone: Object
    • dnssec: Boolean

Returns the same as show.


Create a DNS Zone

Account Scope Required, please include X-Auth-Account header with your Account ID — the zone's account comes from the request's account context. Only name is accepted.

POST /api/dns_zones

Params
  • dns_zone: Object
    • name: String
Errors
  • 400 | the X-Auth-Account header is absent. This one carries no code key — the body is just {"errors":["Missing X-Auth-Account"]}, so match on the status, not on an identifier
  • 403 {"errors":["Not Authorized"]} | no edit access to the account
  • 422 | zone invalid (see errors array)

Returns the same as show.


Delete Zone

DELETE /api/dns_zones/:id

Returns 202.

A zone that still has a site or a domain linked to it cannot be deleted — it returns 422 with Unable to delete, has linked sites. in the errors array. Disconnect the domains first.


DNS Query Statistics

Queries-served stats for a Bunny DNS zone, formatted for charting.

GET /api/dns_zones/:id/dns_stats

Params (optional)
  • date_from: String | ISO8601 datetime (default: 14 days ago)
  • date_to: String | ISO8601 datetime (default: now)
Returned Params
  • total: Integer | total queries served in the window
  • series: Array<Object> | [{ name: String, data: [[unix_ms, count], ...] }]
  • date_from: String (ISO8601)
  • date_to: String (ISO8601)
Errors
  • 502 Bad Gateway | zone not yet provisioned, or upstream Bunny request failed

DNS Records

Available record types

The record_type field is an integer. The available types are:

Value Type
0 A (default)
1 AAAA
2 CNAME
3 TXT
4 MX
5 Redirect
6 Flatten
7 PullZone
8 SRV
9 CAA
10 PTR
11 Script
12 NS
13 SVCB
14 HTTPS
15 TLSA (managed by automation)

TLSA records are created and maintained by automation, and the dashboard's record form does not offer them. That restriction belongs to the dashboard — the API does not enforce a list of user-creatable types.

List all records

Also returned when viewing a zone.

GET /api/dns_zones/:dns_zone_id/records

Returned Params
  • dns_records: Array
    • id: String
    • record_type: Integer
    • ttl: Integer
    • value: String
    • name: String
    • priority: Integer
    • weight: Integer
    • port: Integer
    • flags: Integer
    • record_tag: String
    • comment: String
    • site: Object | null | always present; the site reached through the record's linked domain, null when there is none
      • id: String
      • name: String
      • created_at: DateTime
      • updated_at: DateTime
      • primary_domain: String
      • location: String
      • package: String
    • created_at: DateTime
    • updated_at: DateTime

View Record

GET /api/dns_zones/:dns_zone_id/records/:id

Returns a single dns_record object with the same fields as a list entry.

Create Record

POST /api/dns_zones/:dns_zone_id/records

Params
  • dns_record: Object
    • record_type: Integer | not required — omitting it silently creates an A record (the column defaults to 0). Must be 015
    • ttl: Integer | 30604799 (default: 14400)
    • value: String | required for every type except PullZone (7)
    • name: String
    • priority: Integer | required for MX (4) and SRV (8); 065535
    • weight: Integer | required for SRV (8); 0100
    • port: Integer | required for SRV (8); 065535
    • flags: Integer | required for CAA (9); 0 or greater
    • record_tag: String | required for CAA (9)
    • comment: String

On success renders the created record (same shape as show) with HTTP 200 (not 201). Invalid record → 422 (see errors array).

Update Record

PATCH /api/dns_zones/:dns_zone_id/records/:id

name and record_type cannot be changed. Returns 202.

Params
  • dns_record: Object
    • ttl: Integer
    • value: String
    • priority: Integer
    • weight: Integer
    • port: Integer
    • flags: Integer
    • record_tag: String
    • comment: String

Delete Record

DELETE /api/dns_zones/:dns_zone_id/records/:id

Returns 202.