# Add DNS record

> Add one record to the DNS zone of a domain, beside those of the same name and type.

- Effect: Write - Changes the account. Agents ask first.
- Idempotent: yes
- Stability: beta
- MCP tool: `manitu_domain_dns_record_add` on https://mcp.manitu.de/mcp
- REST: `POST https://api.manitu.de/v1/domain/dns/record/add`
- Needs: `service_domain`
- Page: /reference/domain/dns/record/add/

**Changes the account. Agents say what will happen and wait for an explicit yes before calling it.**

## MCP tool

`manitu_domain_dns_record_add`

### Description for the model

Adds one record to the DNS zone of a domain at manitu, beside the records of the same name and type ("add this TXT for the certificate check", "a second MX"). host is relative to the domain ("@" the domain itself); a value as in a zone file, a TXT the text itself; a name in a value without a final dot is relative to the domain. A value that is there already changes nothing (changed false). To replace the records of a name use manitu_domain_dns_record_set. Tell the customer what is added and wait for an explicit yes - web site and e-mail of the domain depend on the zone. The NS records of the domain itself are manitu's, and a CNAME stands alone (cname_not_alone). Refused with a conflict when manitu does not hold the zone (zone_not_primary_at_manitu), the domain is not active (zone_not_editable) or the zone changed since zone_revision (zone_changed). Every change counts the serial up and answers the new zone_revision - pass that one with the next change. A new serial after your own change is expected, not a change by someone else.

### Arguments

- `name` (string, required) - The domain name, with international characters or in ASCII. (minLength `1`; maxLength `253`)
- `host` (string, required) - The name of the record, relative to the domain: "@" for the domain itself, "www" for www.<domain>, "*.dev" for a wildcard - with international characters or in ASCII. (minLength `1`; maxLength `253`)
- `type` (string, required) - The record type. (one of `"A"`, `"AAAA"`, `"CAA"`, `"CNAME"`, `"MX"`, `"NS"`, `"SRV"`, `"TXT"`)
- `zone_revision` (string) - Optional: zone_revision from manitu_domain_dns_zone_get or from the answer of your last change - refused with zone_changed if the zone changed since. (pattern `"^[0-9a-f]{64}$"`)
- `value` (string, required) - The value as in a zone file - A "192.0.2.1", MX "10 mail", SRV "10 5 5060 sip", CAA "0 issue \"letsencrypt.org\"" - but TXT the text itself, without quotes. A name in it without a final dot is relative to the domain ("mail" is mail.<domain>): end an outside name with a dot ("mail.example.com."). (minLength `1`; maxLength `4096`)
- `ttl` (integer) - How long resolvers may keep it, in seconds. Left out: the zone's default. (minimum `60`; maximum `604800`)

### Example

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "manitu_domain_dns_record_add",
    "arguments": {
      "name": "example.com",
      "host": "string",
      "type": "A",
      "value": "string"
    }
  }
}
```

## REST

`POST https://api.manitu.de/v1/domain/dns/record/add`

### Authentication

One of `X-API-Key`, `Authorization: Bearer …` - never more than one in a request.

### Request body

JSON; unknown fields are refused.

- `name` (string, required) - The domain name, with international characters or in ASCII. (minLength `1`; maxLength `253`)
- `host` (string, required) - The name of the record, relative to the domain: "@" for the domain itself, "www" for www.<domain>, "*.dev" for a wildcard - with international characters or in ASCII. (minLength `1`; maxLength `253`)
- `type` (string, required) - The record type. (one of `"A"`, `"AAAA"`, `"CAA"`, `"CNAME"`, `"MX"`, `"NS"`, `"SRV"`, `"TXT"`)
- `zone_revision` (string) - Optional: zone_revision from manitu_domain_dns_zone_get or from the answer of your last change - refused with zone_changed if the zone changed since. (pattern `"^[0-9a-f]{64}$"`)
- `value` (string, required) - The value as in a zone file - A "192.0.2.1", MX "10 mail", SRV "10 5 5060 sip", CAA "0 issue \"letsencrypt.org\"" - but TXT the text itself, without quotes. A name in it without a final dot is relative to the domain ("mail" is mail.<domain>): end an outside name with a dot ("mail.example.com."). (minLength `1`; maxLength `4096`)
- `ttl` (integer) - How long resolvers may keep it, in seconds. Left out: the zone's default. (minimum `60`; maximum `604800`)

### Response

In `data`; the rest of the body as on every call.

- `name` (string, required) - The domain, with international characters.
- `host` (string, required) - The name of the record, relative to the domain, in ASCII; "@" for the domain itself.
- `type` (string, required) - (one of `"A"`, `"AAAA"`, `"CAA"`, `"CNAME"`, `"MX"`, `"NS"`, `"SRV"`, `"TXT"`)
- `changed` (boolean, required) - false: it was so already - nothing was stored.
- `ttl` (integer | null, required) - The TTL of the records now, in seconds; null: the zone's default.
- `value_list` (array of string, required) - The values of this host and type now, as stored - empty when there are none left.
- `zone_revision` (string, required) - The revision of the zone now.

### Statuses

- `200` Success.
- `400` The request does not match the declared input schema.
- `401` No credential was presented, or it was not recognised.
- `403` The credential is not permitted to use this operation.
- `500` The server failed. Nothing about the request was wrong. Whether a change took effect is not known - check before trying it again.
- `503` The channel this operation forwards through is unavailable.

### Example

```sh
curl -X POST 'https://api.manitu.de/v1/domain/dns/record/add' \
  -H 'X-API-Key: $API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"name":"example.com","host":"string","type":"A","value":"string"}'
```

## Example result

```json
{
  "name": "example.com",
  "host": "string",
  "type": "A",
  "changed": true,
  "ttl": 1,
  "value_list": [
    "string"
  ],
  "zone_revision": "string"
}
```
