> 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/~/revisions/bM7yG7XCmGE9IxWqMpBu/managed-services/cloud-dns/api-how-tos/create-dns-record.md).

# Create a DNS Record

Similar to creating a DNS zone, you need to provide the UUID of the DNS zone to host the new record.

{% hint style="info" %}
**Note:** There are various record types for DNS records, and each of them has unique specifications.
{% endhint %}

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

To create a DNS zone of Type A, follow this step:

* Perform a POST request with these details:
  * corresponding UUID of the DNS zone,
  * name of the subdomain; example: www
  * record type; in this case: A,
  * content or destination of the A record in the form of an IPv4 address; example: 1.1.1.1
  * TTL you need (minimum 60 seconds and maximum 86.400 seconds), and
  * status of the DNS record (enable), true or false.

{% hint style="success" %}
**Result:** On a successful POST request, you receive a response with the DNS record having the UUID assigned.
{% endhint %}

{% hint style="info" %}
**Info:** If you want to create a Wildcard DNS record, you need to provide “\*” as the name of your DNS record to match the requests for all non-existent names under your DNS zone name.
{% endhint %}

### Request

```bash
curl --location \  
--request POST 'https://dns.de-fra.ionos.com/zones/2a4428b3-dbe0-4357-9c02-609025b3a40f/records' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJraWQiO' \
--header 'Content-Type: application/json' \
--data '{
   "properties": {
    "name": "*",
    "type": "A",
    "content": "1.2.3.4",
    "ttl": 3600,
    "enabled": true
  }

}'

```

### Response

**202 Successful operation**

```json
{
  "id": "90d81ac0-3a30-44d4-95a5-12959effa6ee",
  "metadata": {
    "lastModifiedDate": "2022-08-21T15:52:53Z",
    "createdDate": "2022-08-21T15:52:53Z",
    "state": "CREATED",
    "fqdn": "*.example.com",
    "zoneId": "2a4428b3-dbe0-4357-9c02-609025b3a40f"
  },
  "properties": {
    "name": "*",
    "type": "A",
    "content": "1.2.3.4",
    "ttl": 3600,
    "enabled": true
  }
}

```

#### Response Fields

| Field                | Type   | Description                                                                 | Example                              |
| -------------------- | ------ | --------------------------------------------------------------------------- | ------------------------------------ |
| **id**               | string | UUID of the newly created DNS record                                        | 90d81ac0-3a30-44d4-95a5-12959effa6ee |
| **createdDate**      | string | DNS record creation timestamp                                               | 2023-03-15T09:58:59.147746133Z       |
| **lastModifiedDate** | string | DNS record update timestamp                                                 | 2023-03-15T09:58:59.147746133Z       |
| **zoneId**           | string | UUID of the DNS zone of the DNS record                                      | 2a4428b3-dbe0-4357-9c02-609025b3a40f |
| **fqdn**             | string | Fully qualified domain name resulting from the record name and the zoneName | \*.example.com                       |
| **state**            | string | State of the request                                                        | CREATED                              |

## Create records of other types

Create records of other types Cloud DNS supports the following record types: A, AAAA , CNAME, ALIAS, MX, NS, SOA, SRV, TXT, CAA, SSHFP, TLSA, SMIMEA, DS, HTTPS, SVCB, OPENPGPKEY, CERT, URI, RP and LOC.

Here is a brief explanation of the most common record types:

* **A**: Specifies the IPv4 address associated with a zone name.
* **AAAA**: Specifies the IPv6 address associated with a zone name.
* **MX**: Specifies the mail exchange servers for a zone name.
* **CNAME**: Specifies an alias for a zone name, allowing multiple names to resolve to the same IP address.
* **TXT**: Allows arbitrary text to be associated with a zone name that is commonly used for SPF records and other types of verification.
* **NS**: Specifies the name servers for a zone name.
* **SRV**: Specifies the location of services for a zone name that is commonly used for Session Initiation Protocol (SIP) and other protocols.

Here you can see examples of records with different record types:

| Record Type | Record Name                               | Record Value                            | Notes                             |
| ----------- | ----------------------------------------- | --------------------------------------- | --------------------------------- |
| **A**       | example.com                               | 192.168.1.1                             |                                   |
| **AAAA**    | example.com                               | 2001:0db8:85a3:0000:0000:8a2e:0370:7334 |                                   |
| **MX**      | example.com                               | mail.example.com                        | Priority is mandatory             |
| **CNAME**   | [www.example.com](http://www.example.com) | example.com                             |                                   |
| **TXT**     | example.com                               | v=spf1 mx -all                          |                                   |
| **NS**      | example.com                               | ns1.example.com                         |                                   |
| **SRV**     | \_sip.\_tcp.example.com                   | 10 5060 sipserver.example.com           | Priority weight port is mandatory |

## Quota

To retrieve the quota of DNS records, perform a GET request to the `/quota` endpoint.

{% hint style="success" %}
**Result:** On a successful GET request, you receive a response containing the quota limits and quota usage for your contract.
{% endhint %}

### Request

```bash
curl --location 'https://dns.de-fra.ionos.com/quota' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJraWQiO' \
--header 'Content-Type: application/json'
```

### Response

**200 OK**

```json
{
  "quotaLimits": {
    "records": 100000,
    "reverseRecords": 5000,
    "secondaryZones": 100000,
    "zones": 50000
  },
  "quotaUsage": {
    "records": 9,
    "reverseRecords": 1,
    "secondaryZones": 6,
    "zones": 5
  }
}
```

#### Response Fields

| Field              | Type   | Description                        | Example |
| ------------------ | ------ | ---------------------------------- | ------- |
| **records**        | string | Number of DNS records              | 100000  |
| **reverseRecords** | string | Number of reverse DNS records      | 5000    |
| **secondaryZones** | string | Number of secondary DNS zones      | 100000  |
| **zones**          | string | Number of DNS zones                | 50000   |
| **records**        | string | Number of DNS records used         | 9       |
| **reverseRecords** | string | Number of reverse DNS records used | 1       |
| **secondaryZones** | string | Number of secondary DNS zones used | 6       |
| **zones**          | string | Number of DNS zones used           | 5       |


---

# 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/~/revisions/bM7yG7XCmGE9IxWqMpBu/managed-services/cloud-dns/api-how-tos/create-dns-record.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.
