# Import a DNS Zone

You can import a primary zone from your existing DNS provider to IONOS Cloud.

{% hint style="info" %}
**Prerequisite** You need an IONOS Cloud account with API credentials configured with the appropriate permissions.
{% endhint %}

To import an existing primary zone to IONOS Cloud DNS, follow these steps:

1\. Create a primary zone without records.

2\. Perform a PUT request providing the zoneId of the newly created primary zone and the zone file.

{% hint style="success" %}
**Result:** On a successful PUT request, the records provided in the zone file will be added to your primary zone.
{% endhint %}

{% hint style="info" %}
**Important:** If the zone file you import contains CNAME entries that point to names in another private zone, Azure DNS resolution of the CNAME will fail unless the other private zone is imported or the CNAME entries are modified.
{% endhint %}

## Request

```bash
curl --location --request PUT 'https://dns.de-fra.ionos.com/zones/42b21ce3-6fc7-44af-b0c9-2aaadbf2b333/zonefile' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJraWQiO' \
--data-raw '$ORIGIN example.com.
www 60  IN  A   1.2.3.4
shop    60  IN  CNAME   app.example.com.'
```

## Response

**200 Successful operation**

```json
{
  "id": "42b21ce3-6fc7-44af-b0c9-2aaadbf2b333",
  "type": "collection",
  "href": "<RESOURCE-URI>",
  "items": [
    {
      "id": "d6ba6fc1-fc82-4f0c-b030-2638778e0bef",
      "type": "record",
      "href": "<RESOURCE-URI>",
      "metadata": {
        "createdDate": "2022-08-21T15:52:53Z",
        "createdBy": "ionos:iam:cloud:31960002:users/87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
        "createdByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
        "lastModifiedDate": "2022-08-21T15:52:53Z",
        "lastModifiedBy": "ionos:iam:cloud:31960002:users/87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
        "lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
        "resourceURN": "ionos:<product>:<location>:<contract>:<resource-path>",
        "state": "PROVISIONING",
        "fqdn": "app.example.com",
        "zoneId": "a363f30c-4c0c-4552-9a07-298d87f219bf"
      },
      "properties": {
        "name": "app",
        "type": "A",
        "content": "192.0.2.2",
        "ttl": 3600,
        "priority": 0,
        "enabled": true
      }
    }
  ],
  "offset": 0,
  "limit": 1000,
  "_links": {
    "prev": "http://PREVIOUS-PAGE-URI",
    "self": "http://THIS-PAGE-URI",
    "next": "http://NEXT-PAGE-URI"
  }
}
```

## Zone file

The imported file has to be in BIND format, a widely used format supported by most DNS software, including the popular BIND DNS server.

The file should include all the record types associated with the selected primary zone. The Start of Authority (SOA) and Name Server (NS) records are not to be considered since IONOS Cloud uses its name server configuration.


---

# Agent Instructions: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
