> For the complete documentation index, see [llms.txt](https://docs.link11.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.link11.com/using-link11/api/secure-dns.md).

# Secure DNS

{% hint style="info" %}
The information below assumes you have already the [Introduction to the Link11 API](/using-link11/api/introduction.md).
{% endhint %}

## Service Key definition

`apikey=l11securedns`

## Domain Key definition <a href="#id-customerapi-webddos-webddoscommands" id="id-customerapi-webddos-webddoscommands"></a>

For the commands that include a Domain Key (referred to below as $DOMAINKEY), use the [API Key for the instance from WebGUI](/product-guides/secure-dns/interface/api-access.md).

## Zone (Entry) ID definition <a href="#id-customerapi-webddos-webddoscommands" id="id-customerapi-webddos-webddoscommands"></a>

Some commands below include a Zone ID parameter. Its value can be obtained from the output of other API commands, e.g. [List all Primary Zones](#list-all-primary-zones).

Similarly, Zone Entry IDs can be obtained with calls to [List Primary Zone Entries](#list-primary-zone-entries), etc.

***

## API commands <a href="#id-customerapi-infrastructureddos-infrastructureddosapicommands" id="id-customerapi-infrastructureddos-infrastructureddosapicommands"></a>

### **List Primary Zones**

Lists all available primary zones. Use the output ID(s) in other calls.

`https://api.link11.de/?apikey=l11securedns&key=[$DOMAINKEY]&list_primary_zones`

**Response:**

```
{
  "status_code": 200,
  "status_text": "OK",
  "data": 
  [
    {
      "id": "l11securednsprimary5014",
      "domain": "sweft.com",
      "entries": "9",
      "date_created": "2019-04-25T08:01:33Z",
      "date_updated": "2019-04-25T08:01:33Z"
    },
    {
      "id": "l11securednsprimary5017",
      "domain": "testsweft.com",
      "entries": "0",
      "date_created": "2020-01-16T13:49:00Z",
      "date_updated": "2020-01-16T13:49:00Z"
    }
  ]
}
```

### **List Secondary Zones**

Lists all available secondary zones. Use the output ID(s) in other calls.

`https://api.link11.de/?apikey=l11securedns&key=[$DOMAINKEY]&list_secondary_zones`

**Response:**

```
{
  "status_code": 200,
  "status_text": "OK",
  "data": [
    {
      "id": "l11securednsprimary5014",
      "domain": "sweft.com",
      "entries": "9",
      "date_created": "2019-04-25T08:01:33Z",
      "date_updated": "2019-04-25T08:01:33Z"
    },
    {
      "id": "l11securednsprimary5017",
      "domain": "testsweft.com",
      "entries": "0",
      "date_created": "2020-01-16T13:49:00Z",
      "date_updated": "2020-01-16T13:49:00Z"
    }
  ]
}
```

### **Add Zone (L11 primary)**

Adds a primary zone where Link11 is the primary DNS server for zone

`https://api.link11.de/?apikey=l11securedns&key=[$DOMAINKEY]&add_primary_zone&domain=[$DOMAIN]`

| Parameter | Example     |
| --------- | ----------- |
| domain    | example.com |

### **Add Zone (L11 secondary)**

Adds a primary zone where Link11 is secondary DNS server for zone → specify: DNS origin server (can be 2 separate servers)

`https://api.link11.de/?apikey=l11securedns&key=[$DOMAINKEY]&add_secondary_zone&domain=[$DOMAIN]&origin1=[Origin-IP1]&origin2=[Origin-IP2]`

| Parameter        | Example     |
| ---------------- | ----------- |
| domain           | example.com |
| origin1, origin2 | 12.43.65.87 |

**Response:**

```
{
  "status_code": 200,
  "status_text": "OK",
  "data": {
    "added": 1,
    "id": "l11securednsprimary5021"
  }
}
```

### **Update Origin (secondary zone)**

Updates Origin Server for a secondary zone

`https://api.link11.de/?apikey=l11securedns&key=[$DOMAINKEY]&update_secondary_zone&zone=[$ZONE-ID]&origin1=[Origin-IP1]&origin2=[Origin-IP2]`

| Parameter        | Example                  | Explanation                                                           |
| ---------------- | ------------------------ | --------------------------------------------------------------------- |
| zone             | l11securednssecondary316 | Can obtain from calling [List Secondary Zones](#list-secondary-zones) |
| origin1, origin2 | 12.43.65.87              |                                                                       |

**Response:**

```
{
  "status_code": 200,
  "status_text": "OK",
  "data": {
    "added": 1,
    "id": "l11securednssecondary316"
  }
}
```

### **Delete Primary Zone**

Deletes Primary Zone

`https://api.link11.de/?apikey=l11securedns&key=[$DOMAINKEY]&delete_primary_zone&zone=[$ZONE-ID]`

| Parameter | Example                | Explanation                                                       |
| --------- | ---------------------- | ----------------------------------------------------------------- |
| zone      | l11securednsprimary316 | Can obtain from calling [List Primary Zones](#list-primary-zones) |

**Response:**

```
{
  "status_code": 200,
  "status_text": "OK",
  "data": {
    "deleted": 1
  }
}
```

### **Delete Secondary Zone**

Deletes Secondary Zone

`https://api.link11.de/?apikey=l11securedns&key=[$DOMAINKEY]&delete_secondary_zone&zone=[$ZONE-ID]`

| Parameter | Example                  | Explanation                                                           |
| --------- | ------------------------ | --------------------------------------------------------------------- |
| zone      | l11securednssecondary316 | Can obtain from calling [List Secondary Zones](#list-secondary-zones) |

**Response:**

```
{
  "status_code": 200,
  "status_text": "OK",
  "data": {
    "deleted": 1
  }
}
```

### **List Primary Zone Entries**

Lists all zone entries for a Zone ID

`https://api.link11.de/?apikey=l11securedns&key=[$DOMAINKEY]&list_primary_zone_entries&zone=[$ZONE-ID]`

| Parameter | Example                | Explanation                                                       |
| --------- | ---------------------- | ----------------------------------------------------------------- |
| zone      | l11securednsprimary316 | Can obtain from calling [List Primary Zones](#list-primary-zones) |

**Response:**

```
{
  "status_code": 200,
  "status_text": "OK",
  "data": [
    {
      "id": "l11securednsprimaryentry3971",
      "name": ".",
      "ttl": 1234,
      "value": "20010000000000000000000000000001",
      "type": "AAAA",
      "date_updated": "2020-01-17T15:21:54Z"
    },
    {
      "id": "l11securednsprimaryentry3969",
      "name": ".",
      "ttl": 1234,
      "value": "1.2.3.4",
      "type": "A",
      "date_updated": "2020-01-17T14:49:52Z"
    }
  ]
}
```

### **Add Primary Zone Entry**

`http://api.link11.de/?apikey=l11securedns&key=[$DOMAINKEY]&add_primary_zone_entry&zone=[$ZONE-ID]&name=www3&value=1.1.1.1&type=A&ttl=60"`

| Parameter | Example                | Explanation                                                                                                                                                                                                                                                                                                                                                                                                                   |
| --------- | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| zone      | l11securednsprimary316 | Can obtain from calling [List Primary Zones](#list-primary-zones)                                                                                                                                                                                                                                                                                                                                                             |
| name      | www3                   | subdomain, e.g. “www3” for www3.example.com                                                                                                                                                                                                                                                                                                                                                                                   |
| value     | 1.1.1.1                | <p>Depends on the <em>type</em> field. For A, an IPv4 address. For<br>AAAA, an IPv6 address. For ANAME, CNAME, MX, and NS, a hostname. For CAAIS and CAAIW, a CA identifier (e.g.,  <code>letsencrypt.org</code>). For CAAIO, a URL. For TXT, a string. For SPF, a Sender Policy Framework record. For SRV, a Service record in the format "priority:weight:port:target" (e.g.,<code>100:50:5060:sip.example.com</code>).</p> |
| type      | A                      | <p>One of these values: A, AAAA, ANAME, CAAIO, CAAIS, CAAIW, CNAME, MX, MX10, MX20, MX30, NS, TXT, SPF, SRV.<br><br>CAAIS represents "CAA issue", CAAIO is "CAA iodef", and CAAIW is "CAA issuewild".<br><br>MX is an MX record with default priority. MX10, MX20, and MX30 records have priorities of 10, 20 and 30, respectively.</p>                                                                                       |
| ttl       | 60                     | Time to live                                                                                                                                                                                                                                                                                                                                                                                                                  |

**Response:**

```
{
  "status_code": 200,
  "status_text": "OK",
  "data": {
    "updated": 1,
    "id": "l11securednsprimaryentry3972"
  }
}
```

### **Update Primary Zone Entry**

Updates Primary Zone entries

`http://api.link11.de/?apikey=l11securedns&key=[$DOMAINKEY]&update_primary_zone_entry&zone=[$ZONE-ID]&entry=[$ZONE-ENTRY-ID]&value=3.4.5.6"`

<table><thead><tr><th width="193">Parameter</th><th>Example</th><th>Explanation</th></tr></thead><tbody><tr><td>zone</td><td>l11securednsprimary316</td><td>Can obtain from calling <a href="#list-primary-zones">List Primary Zones</a></td></tr><tr><td>entry</td><td>l11securednsprimaryentry3972</td><td>Can obtain from calling <a href="#list-primary-zone-entries">List Primary Zone Entries</a></td></tr><tr><td>value</td><td>3.4.5.6</td><td>IP address</td></tr></tbody></table>

**Response:**

```
{
  "status_code": 400,
  "status_text": "Unknown"
}
```

### **Delete Primary Zone Entry**

Deletes a primary zone entry.

`http://api.link11.de/?apikey=l11securedns&key=[$DOMAINKEY]&delete_primary_zone_entry&zone=[$ZONE-ID]&entry=[$ZONE-ENTRY-ID]`

<table><thead><tr><th width="206">Parameter</th><th>Example</th><th>Explanation</th></tr></thead><tbody><tr><td>zone</td><td>l11securednsprimary316</td><td>Can obtain from calling <a href="#list-primary-zones">List Primary Zones</a></td></tr><tr><td>entry</td><td>l11securednsprimaryentry3971</td><td>Can obtain from calling <a href="#list-primary-zone-entries">List Primary Zone Entries</a></td></tr></tbody></table>

**Response:**

```
{
  "status_code": 200,
  "status_text": "OK",
  "data": {
    "deleted": 1
  }
}
```

### **List Reverse Zones**

Lists all available reverse zones

`https://api.link11.de/?apikey=l11securedns&key=[$DOMAINKEY]&list_reverse_zones`

**Response:**

```
{
   "status_code" : 200,
   "data" : [
      {
         "nserver3" : "ns3.link11.de",
         "from" : "0",
         "nserver1" : "ns1.link11.de",
         "nserver2" : "ns2.link11.de",
         "to" : "3",
         "entries" : "0",
         "id" : "l11securednsreverse2480",
         "date_created" : "2020-03-13T12:09:22Z",
         "date_updated" : "2020-03-13T12:09:22Z",
         "zone" : "14.143.78.in-addr.arpa"
      }
   ],
   "status_text" : "OK"
}
```

### **List Reverse Zone Entries**

Lists all reverse zone entries

`http://api.link11.de/?apikey=l11securedns&key=[$DOMAINKEY]&list_reverse_zone_entries&zone=[$ZONE-ID]`

| Parameter | Example                 | Explanation                                                       |
| --------- | ----------------------- | ----------------------------------------------------------------- |
| zone      | l11securednsreverse2480 | Can obtain from calling [List Reverse Zones](#list-reverse-zones) |

**Response:**

```
{
   "status_code" : 200,
   "data" : [
      {
         "individual" : "1",
         "full" : "1.14.143.78.in-addr.arpa",
         "id" : "l11securednsreverseentry9120",
         "value" : "schweft.com",
         "date_updated" : "2020-03-13T12:15:34Z"
      }
   ],
   "status_text" : "OK"
}
```

### **List Geo-Zones**

Lists all configured geo-zones of a primary zone entry

`https://api.link11.de/?apikey=l11securedns&key=[$DOMAINKEY]&list_primary_zone_geo_entries&zone=[$ZONE-ID]'`

| Parameter | Example                 | Explanation                                                       |
| --------- | ----------------------- | ----------------------------------------------------------------- |
| zone      | l11securednsprimary5014 | Can obtain from calling [List Primary Zones](#list-primary-zones) |

**Response:**

```
{
  "status_code": 200,
  "status_text": "OK",
  "data": [
    {
      "id": "l11securednsprimarygeoentry6",
      "name": "www",
      "value": "2.2.2.255",
      "type": "A",
      "geo_config": "NA;US;*;*",
      "date_updated": "2021-03-17T14:11:16Z"
    },
    {
      "id": "l11securednsprimarygeoentry15",
      "name": "www2",
      "value": "2.2.2.255",
      "type": "CNAME",
      "geo_config": "*;DE;*;*",
      "date_updated": "2021-03-18T10:02:51Z"
    }
    […]
  ]
}
```

### **Add Geo-Zone Entry**

Add Geo-Entry to a primary zone

`http://api.link11.de/?apikey=l11securedns&key=[$DOMAINKEY]&add_primary_zone_geo_entry&zone=[$ZONE-ID]&name=www3&value=1.1.1.2&type=A&geo_config=EU;DE;*;*`

<table><thead><tr><th width="171">Parameter</th><th>Example</th><th>Explanation</th></tr></thead><tbody><tr><td>zone</td><td>l11securednsprimary5014</td><td>Can obtain from calling <a href="#list-primary-zones">List Primary Zones</a></td></tr><tr><td>name</td><td>www3</td><td>subdomain, e.g. “www3” for www3.example.com</td></tr><tr><td>value</td><td>1.1.1.2</td><td>See explanation in <a href="#add-primary-zone-entry">Add Primary Zone Entry</a></td></tr><tr><td>type</td><td>A</td><td>See explanation in <a href="#add-primary-zone-entry">Add Primary Zone Entry</a></td></tr><tr><td>geo_config</td><td>EU;DE;HE;Frankfurt am Main</td><td>Continent ISO Code; Country ISO Code; Subdivision ISO Code; English City Name</td></tr></tbody></table>

**Response:**

```
{
    "status_code":200,
    "status_text":"OK",
    "data":{
        "inserted":1,
        "id":"l11securednsprimarygeoentry16"
    }
}
```

### **Update Geo-Zone Entry**

If a geo-zone is to be updated, the id of the corresponding zone must be specified via the entry parameter. In addition, all values, and not just the values to be changed, must be specified.

`http://api.link11.de/?apikey=l11securedns&key=[$DOMAINKEY]&update_primary_zone_geo_entry&zone=[$ZONE-ID]&entry=[$ZONE-GEOENTRY-ID]&name=www3&value=1.1.1.2&type=A&geo_config=EU;DE;BE;Berlin`

<table><thead><tr><th width="171">Parameter</th><th>Example</th><th>Explanation</th></tr></thead><tbody><tr><td>zone</td><td>l11securednsprimary5014</td><td>Can obtain from calling <a href="#list-primary-zones">List Primary Zones</a></td></tr><tr><td>entry</td><td>l11securednsprimarygeoentry16</td><td>Can obtain from calling <a href="#list-geo-zones">List Geo-Zones</a></td></tr><tr><td>name</td><td>www3</td><td>subdomain, e.g. “www3” for www3.example.com</td></tr><tr><td>value</td><td>1.1.1.2</td><td>See explanation in <a href="#add-primary-zone-entry">Add Primary Zone Entry</a></td></tr><tr><td>type</td><td>A</td><td>See explanation in <a href="#add-primary-zone-entry">Add Primary Zone Entry</a></td></tr><tr><td>geo_config</td><td>EU;DE;HE;Frankfurt am Main</td><td>Continent ISO Code; Country ISO Code; Subdivision ISO Code; English City Name</td></tr></tbody></table>

**Response:**

```
{
    "status_code":200,
    "status_text":"OK",
    "data":{
        "updated":1
    }
}
```

### **Remove Geo-Zone**

Deletes a Geo-Zone

`http://api.link11.de/?apikey=l11securedns&key=[$DOMAINKEY]&delete_primary_zone_geo_entry&zone=[$ZONE-ID]&entry=[$ZONE-GEOENTRY-ID]`

<table><thead><tr><th width="200">Parameter</th><th>Example</th><th>Explanation</th></tr></thead><tbody><tr><td>zone</td><td>l11securednsprimary5014</td><td>Can obtain from calling <a href="#list-primary-zones">List Primary Zones</a></td></tr><tr><td>entry</td><td>l11securednsprimarygeoentry16</td><td>Can obtain from calling <a href="#list-geo-zones">List Geo-Zones</a></td></tr></tbody></table>

**Response:**

```
{
    "status_code":200,
    "status_text":"OK",
    "data":{
        "deleted":1
    }
}
```
