> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/network-services/cloud-dns/api-how-tos/export-dns-zone.md).

# Export a DNS Zone

Similar to retrieving a primary zone, you need to provide the UUID of the primary zone that you want to export.

{% hint style="info" %}
**Prerequisite:** You need an <code class="expression">space.vars.ionos\_cloud</code> account with API credentials configured with the appropriate permissions.
{% endhint %}

To export an existing primary zone at Cloud DNS in a BIND format, follow this step:

* Perform a GET request providing the zoneId of your primary zone.

{% hint style="success" %}
**Result:** On a successful GET request, you receive the BIND file with the primary zone having the UUID assigned.
{% endhint %}

## Request

```bash
curl --location --request GET 'https://dns.de-fra.ionos.com/zones/d6ba6fc1-fc82-4f0c-b030-2638778e0bef/zonefile' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJraWQiO' \
```

## Response

**200 Successful operation**

```bash
;Zone: example.com
;Exported: Sat Jul 22 10:30:18 UTC 2023
 
$ORIGIN example.com.
$TTL 3600
 
@   86400   IN  SOA example.com. hostmaster.1und1.com. (
                    2017060107  ; serial
                    28800   ; refresh
                    7200    ; retry
                    604800  ; expire
                    600 )   ; minimum
@   86400   IN  NS  ns-ic.ui-dns.com.
@   86400   IN  NS  ns-ic.ui-dns.de.
@   86400   IN  NS  ns-ic.ui-dns.org.
@   86400   IN  NS  ns-ic.ui-dns.biz.
www 60  IN  A   192.0.2.2
www 60  IN  AAAA    2001:0db8::1
shop    60  IN  CNAME   boutique.example.com.
```

## Zone file

The exported zone file is in BIND format, a widely used format supported by most DNS software, including the BIND DNS server.

The file includes all record types associated with the selected primary zone, including SOA record, NS record, Service (SRV) record, and configuration information such as TTL values.

An example of a file in BIND format with an updated SRV record is as follows:

```bash
;Zone: example.com
;Exported: Mon Aug 14 09:20:53 UTC 2023

$ORIGIN  example.com.
$TTL 3600

@	86400	IN	SOA	example.com. hostmaster.1und1.com. (
					2017060107	; serial
					28800	; refresh
					7200	; retry
					604800	; expire
					600 )	; minimum
@   86400   IN  NS  ns-ic.ui-dns.com.
@   86400   IN  NS  ns-ic.ui-dns.de.
@   86400   IN  NS  ns-ic.ui-dns.org.
@   86400   IN  NS  ns-ic.ui-dns.biz.
www 60  IN  A   192.0.2.2
www 60  IN  AAAA    2001:0db8::1
shop    60  IN  CNAME   boutique.example.com.
sub12	60	IN	SRV	10 0 5223 server1.example.com.
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ionos.com/cloud/network-services/cloud-dns/api-how-tos/export-dns-zone.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
