Zones

Create a Zone

Creates a Zone.

A default SOA and three NS resource records with the assigned Hetzner nameservers are created automatically.

post/zones

Request

  • Base URL: https://api.hetzner.cloud/v1
  • URL: https://api.hetzner.cloud/v1/zones
  • Auth: HTTP bearer

Request body

namestring required

Name of the Zone.

All names with well-known public suffixes (e.g. .de, .com, .co.uk) are supported. Subdomains are not supported.

The name must be in lower case and must not end with a dot. Internationalized domain names must be transcribed to Punycode representation with ACE prefix, e.g. xn--mnchen-3ya.de (münchen.de).

mode'primary' | 'secondary' required

Mode of the Zone.

For more information, see Zone Modes.

ttlinteger

Default Time To Live (TTL) of the Zone.

Must be in between 60s and 2147483647s.

This TTL is used for RRSets that do not explicitly define a TTL.

labelsobject

User-defined labels (key/value pairs) for the Resource. For more information, see "Labels".

zonefilestring

Zone file to import.

Only applicable for Zones in primary mode. Ignored for Zones in secondary mode.

If provided, rrsets must be empty.

See Zone file import for more details.

Example request

{
  "name": "example.com",
  "mode": "primary",
  "ttl": 10800,
  "labels": {
    "environment": "prod",
    "example.com/my": "label",
    "just-a-key": ""
  },
  "primary_nameservers": [
    {
      "address": "198.51.100.1",
      "port": 53
    },
    {
      "address": "203.0.113.1",
      "port": 53
    }
  ],
  "rrsets": [
    {
      "name": "www",
      "type": "A",
      "ttl": 3600,
      "records": [
        {
          "value": "198.51.100.1",
          "comment": "My web server at Hetzner Cloud."
        }
      ],
      "labels": {
        "environment": "prod",
        "example.com/my": "label",
        "just-a-key": ""
      }
    }
  ],
  "zonefile": "$ORIGIN\texample.com.\n$TTL\t3600\n\n@\tIN\tSOA\thydrogen.ns.hetzner.com. dns.hetzner.com. 2024010100 86400 10800 3600000 3600\n\n@\tIN\t10800\tNS\thydrogen.ns.hetzner.com. ; Some comment.\n@\tIN\t10800\tNS\toxygen.ns.hetzner.com.\n@\tIN\t10800\tNS\thelium.ns.hetzner.de.\n"
}

Response

Request succeeded.

Example response

{
  "zone": {
    "id": 42,
    "name": "example.com",
    "created": "2016-01-30T23:55:00Z",
    "primary_nameservers": [
      {
        "address": "198.51.100.1",
        "port": 53
      },
      {
        "address": "203.0.113.1",
        "port": 53
      }
    ],
    "labels": {
      "environment": "prod",
      "example.com/my": "label",
      "just-a-key": ""
    },
    "ttl": 10800,
    "authoritative_nameservers": {
      "assigned": [
        "hydrogen.ns.hetzner.com.",
        "oxygen.ns.hetzner.com.",
        "helium.ns.hetzner.de."
      ],
      "delegated": [
        "hydrogen.ns.hetzner.com.",
        "oxygen.ns.hetzner.com.",
        "helium.ns.hetzner.de."
      ],
      "delegation_last_check": "2016-01-30T23:55:00Z"
    },
    "mode": "primary"
  },
  "action": {
    "id": 42,
    "command": "start_resource",
    "started": "2016-01-30T23:55:00Z",
    "finished": "2016-01-30T23:55:00Z",
    "progress": 100,
    "resources": [
      {
        "id": 42,
        "type": "server"
      }
    ],
    "error": {
      "code": "action_failed",
      "message": "Action failed"
    }
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.