Skip to content
Start here

Create Secondary Zone Configuration

client.DNS.ZoneTransfers.Incoming.New(ctx, params) (*ZoneTransferIncomingNewResponse, error)
POST/zones/{zone_id}/secondary_dns/incoming

Create secondary zone configuration for incoming zone transfers.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Zone Settings WriteZone WriteDNS Write
ParametersExpand Collapse
params ZoneTransferIncomingNewParams
ZoneID param.Field[string]

Path param

AutoRefreshSeconds param.Field[float64]

Body param: How often should a secondary zone auto refresh regardless of DNS NOTIFY. Not applicable for primary zones.

minimum300
Name param.Field[string]

Body param: Zone name.

Peers param.Field[[]string]

Body param: A list of peer tags.

ReturnsExpand Collapse
type ZoneTransferIncomingNewResponse struct{…}
ID stringoptional
AutoRefreshSeconds float64optional

How often should a secondary zone auto refresh regardless of DNS NOTIFY. Not applicable for primary zones.

minimum300
CheckedTime stringoptional

The time for a specific event.

CreatedTime stringoptional

The time for a specific event.

ModifiedTime stringoptional

The time for a specific event.

Name stringoptional

Zone name.

Peers []stringoptional

A list of peer tags.

SOASerial float64optional

The serial number of the SOA for the given zone.

Create Secondary Zone Configuration

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/dns"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  incoming, err := client.DNS.ZoneTransfers.Incoming.New(context.TODO(), dns.ZoneTransferIncomingNewParams{
    ZoneID: cloudflare.F("269d8f4853475ca241c4e730be286b20"),
    AutoRefreshSeconds: cloudflare.F(86400.000000),
    Name: cloudflare.F("www.example.com."),
    Peers: cloudflare.F([]string{"23ff594956f20c2a721606e94745a8aa", "00920f38ce07c2e2f4df50b1f61d4194"}),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", incoming.ID)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "id": "269d8f4853475ca241c4e730be286b20",
    "auto_refresh_seconds": 86400,
    "checked_time": "2019-10-24T17:09:42.883908+01:00",
    "created_time": "2019-10-24T17:09:42.883908+01:00",
    "modified_time": "2019-10-24T17:09:42.883908+01:00",
    "name": "www.example.com.",
    "peers": [
      "23ff594956f20c2a721606e94745a8aa",
      "00920f38ce07c2e2f4df50b1f61d4194"
    ],
    "soa_serial": 2019102400
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "id": "269d8f4853475ca241c4e730be286b20",
    "auto_refresh_seconds": 86400,
    "checked_time": "2019-10-24T17:09:42.883908+01:00",
    "created_time": "2019-10-24T17:09:42.883908+01:00",
    "modified_time": "2019-10-24T17:09:42.883908+01:00",
    "name": "www.example.com.",
    "peers": [
      "23ff594956f20c2a721606e94745a8aa",
      "00920f38ce07c2e2f4df50b1f61d4194"
    ],
    "soa_serial": 2019102400
  }
}