# records

> openwaf-cloud ctl records commands to list, add, change, delete and import DNS records from a BIND zone file.

`<zone>` is the domain or the zone id. `<record>` is the record id or its name (`www`, `www.example.com` or `@`), with `/TYPE` when the name has several records (`www/AAAA`). Every change is a new zone version and accepts `--reason`, `--dry-run`, `--yes` and `--wait`.

## records list

```text
records list <zone> [--json]
```

The zone's DNS records with their id, type, name, content, TTL, priority, proxy status, tags and comment.

## records add

```text
records add <zone> type=… name=… content=… [ttl=…] [proxied=…] [priority=…] [comment=…] [tags:='[…]'] --reason "…"
```

| Key | Meaning |
|---|---|
| `type` | `A`, `AAAA`, `CNAME`, `MX`, `TXT`, `NS`, `SRV` or `CAA`. |
| `name` | `@`, a relative name (`www`) or a full one; `*` for a wildcard. |
| `content` | A/AAAA: the address. CNAME, NS, MX: a host name. TXT: the text without quotes. SRV: `weight port target`. CAA: `flags tag "value"`. |
| `ttl` | Seconds. |
| `priority` | Required for MX and SRV, not allowed otherwise. |
| `proxied` | `true` to serve the name through the OpenWAF edge (A, AAAA and CNAME only). The name then answers with the edge addresses and the content becomes the origin. All A/AAAA/CNAME records of a name share the value. |
| `comment` | A note on the record. Not published in the DNS; it is part of the zone's versions. |
| `tags` | A JSON list of labels, stored in lower case: `tags:='["web","prod"]'`. |

In an external zone, only proxied A, AAAA and CNAME records are accepted: they are the sites you point at the edge from your own DNS.

```sh
openwaf-cloud ctl records add example.com type=A name=www content=203.0.113.10 proxied=true \
  --reason "Add www behind the WAF" --wait
openwaf-cloud ctl records add example.com type=MX name=@ content=mail.example.com priority=10 \
  --reason "Mail"
```

## records set

```text
records set <zone> <record> key=value … --reason "…"
```

Changes only the fields you give, with the same keys as `records add`, including `comment=` and `tags:=<json>`.

```sh
openwaf-cloud ctl records set example.com www/A content=203.0.113.20 --reason "New origin"
```

## records rm

```text
records rm <zone> <record> --reason "…"
```

Deletes a record. Deleting the last proxied record of a name stops serving that site.

## records import

```text
records import <zone> <file|-> [--proxied] --reason "…"
```

Imports a BIND zone file (`-` reads it from standard input) as **one** change. The CLI first shows the records it would create and every entry it leaves out, with its line and the reason (`fuera, línea N: …`); then it simulates, asks for confirmation and applies them as a single version.

| Option | Meaning |
|---|---|
| `--proxied` | Import with the proxy on the A, AAAA and CNAME records whose name can be a site. |

Limits: the first 5,000 entries of the file are read, and one import creates at most 500 records; split larger files.

```sh
openwaf-cloud ctl records import example.com example.com.zone --proxied --reason "Move DNS to OpenWAF"
```
