# Change DNS zone of a domain

> Replace the DNS zone of one domain with BIND zone file text - with a dry run first.

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

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

## MCP tool

`manitu_domain_dns_zone_set`

### Description for the model

Replaces the DNS zone of a domain at manitu, by its name, with BIND zone file text - the WHOLE zone. To add, change or remove records: read the zone with manitu_domain_dns_zone_get (format raw), change the text, and send it back with the zone_revision you read. Always call with dry_run true first and show the customer what changes (record_count_list tells what was there before and after - nothing should go missing by accident); store (dry_run false) only after an explicit yes - web site and e-mail of the domain depend on the zone. manitu keeps the SOA (only refresh, retry, expire and ttl are taken; the serial is counted up) and the NS records of the domain itself (notice_list says when one was dropped); comments the customer wrote are not kept - notice_list then says comments_removed, mention it only then. Refused with a conflict when the zone changed since it was read (zone_changed - read it again, apply the change again), when manitu does not hold the zone (zone_not_primary_at_manitu), the domain is not active (zone_not_editable) or the zone stored cannot be read (zone_stored_not_readable - manitu has to repair it: tell the customer to contact manitu). Text that cannot be read is refused with line number (of the text sent), code and reason; text the name server would not load is refused with its reason (line numbers then count in the zone as composed by manitu). 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`)
- `zone_data` (string, required) - The whole zone as BIND zone file text - as manitu_domain_dns_zone_get gives it (format raw), changed. Class IN only; of the $ directives only $TTL and $ORIGIN (within the zone) - no $INCLUDE or $GENERATE. (minLength `1`; maxLength `524288`)
- `zone_revision` (string, required) - zone_revision from manitu_domain_dns_zone_get or from the answer of your last change - the version the change is based on. (pattern `"^[0-9a-f]{64}$"`)
- `dry_run` (boolean) - true: check and compose only, store nothing - the answer shows the zone as it would be stored. Default false.

### Example

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "manitu_domain_dns_zone_set",
    "arguments": {
      "name": "example.com",
      "zone_data": "string",
      "zone_revision": "string"
    }
  }
}
```

## REST

`POST https://api.manitu.de/v1/domain/dns/zone/set`

### 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`)
- `zone_data` (string, required) - The whole zone as BIND zone file text - as manitu_domain_dns_zone_get gives it (format raw), changed. Class IN only; of the $ directives only $TTL and $ORIGIN (within the zone) - no $INCLUDE or $GENERATE. (minLength `1`; maxLength `524288`)
- `zone_revision` (string, required) - zone_revision from manitu_domain_dns_zone_get or from the answer of your last change - the version the change is based on. (pattern `"^[0-9a-f]{64}$"`)
- `dry_run` (boolean) - true: check and compose only, store nothing - the answer shows the zone as it would be stored. Default false.

### Response

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

- `name` (string, required) - The domain, with international characters.
- `dry_run` (boolean, required) - true: nothing was stored.
- `zone_data` (string, required) - The zone as stored - or as it would be (dry_run).
- `zone_revision` (string, required) - The revision of the zone now - after a dry run the one sent, unchanged.
- `record_count_list` (array of object, required) - Records per type (A, MX, TXT, TLSA ...), before and after - types with records only, SOA left out.
  - `record_count_list[].type` (string, required)
  - `record_count_list[].count_before` (integer, required)
  - `record_count_list[].count_after` (integer, required)
- `notice_list` (array of string, required) - What manitu kept or dropped: soa_kept (SOA name server or contact sent were not taken), apex_ns_kept (NS records of the domain itself sent were not taken), comments_removed.

### 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/zone/set' \
  -H 'X-API-Key: $API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"name":"example.com","zone_data":"string","zone_revision":"string"}'
```

## Example result

```json
{
  "name": "example.com",
  "dry_run": true,
  "zone_data": "string",
  "zone_revision": "string",
  "record_count_list": [
    {
      "type": "string",
      "count_before": 1,
      "count_after": 1
    }
  ],
  "notice_list": [
    "soa_kept"
  ]
}
```
