---
name: azion-add-edit-or-delete-a-record
description: >-
  Add, change, or delete a record in an Edge DNS zone from Azion Console, the Azion CLI, or the API, and see when Azion's nameservers answer it.
---

# Add, edit, or delete a record

You can add, edit, or delete a record in an [Edge DNS](/en/documentation/platform/edge-dns/) zone from Azion Console, the Azion CLI, or the Azion API. Each record tells Azion's nameservers which values to return for one name of the zone. To create the zone itself, refer to [Create, edit, or delete a zone](/en/documentation/guides/application-security/dns/edge-dns-configure-main-settings/).

---

Choose an interface. Each section below then shows the steps for that interface only.

## Prerequisites

- A zone in Edge DNS for your domain. To create one, refer to [Create, edit, or delete a zone](/en/documentation/guides/application-security/dns/edge-dns-configure-main-settings/).
- The **Edit Edge DNS** permission, which requires **View Edge DNS**. Refer to [Teams permissions](/en/documentation/fundamentals/teams-permissions/).

**Console**

- Access to Azion Console. To sign in, refer to [Access Azion Console](/en/documentation/guides/platform/account-and-billing/how-to-access-azion-console/).

**CLI**

- The [Azion CLI](/en/documentation/devtools/cli/) installed and authorized.
- The ID of the zone. `azion list dns-zone` prints it in the `ID` column, next to the zone's `NAME` and `DOMAIN`.

**API**

- A [personal token](/en/documentation/guides/platform/account-and-billing/personal-tokens/) and `curl`.
- The `id` of the zone. A `GET` request to `https://api.azion.com/v4/workspace/dns/zones` lists the zones of the account in `results`, each with its `id` and `domain`.
- For every endpoint and field of the API, refer to the [Azion API reference](https://api.azion.com/).

---

## Add a record

The example adds an A record that answers `192.0.2.1` for `www.example.com`. Replace the name, the type, and the value with your own. The value format of each type is on [Record types](/en/documentation/platform/edge-dns/record-types/).

**Console**

To add the record in Azion Console:

1. **Open the Edge DNS page**

   Access [Azion Console](https://console.azion.com/) > **Edge DNS**.

2. **Open the zone**

   On the **Zones** page, select the row of the zone.

3. **Select the Records tab**

4. **Select + Record**

   The **Create Record** drawer opens.

5. **Enter the record name**

   In **Name**, enter `www`. The name is relative to the zone, and the Console adds the domain for you, so never type it. To answer for the domain itself, enter `@`.

6. **Select the record type**

   In **Record Type**, select *A - IPv4 Address*.

7. **Set the TTL**

   In **TTL (seconds)**, keep `3600`, or enter how long resolvers may cache the answer. For an ANAME record, keep the TTL at `20`.

8. **Enter the value**

   In **Value**, enter `192.0.2.1`. To answer with several values, enter one value per line.

9. **(Optional) Choose the policy**

   In the **Policy** section, keep **Policy Type** at *Simple*. To share answers between several records of one name, select *Weighted* and follow [Weight records to balance traffic](/en/documentation/guides/application-security/dns/load-balance-dns/).

10. **Select Save**

The Console shows `Edge DNS Record has been created`, and the record appears in the **Records** table of the zone.

**CLI**

To add the record with the Azion CLI, replace `<zone-id>` with the ID of your zone. Enter the name relative to the zone, without the domain:

```bash
azion create dns-record --zone-id <zone-id> --name www --type A --rdata 192.0.2.1 --ttl 3600
```

The command prints the ID of the record:

```text
Created DNS record with ID 100228
```

The zone holds the record. To give a record several values, repeat `--rdata` or pass the values as a comma-separated list.

**API**

To add the record with the Azion API, send a `POST` request to the records endpoint of the zone. Replace `<zone-id>` with the `id` of your zone, and enter the name relative to the zone, without the domain:

```bash
curl -X POST https://api.azion.com/v4/workspace/dns/zones/<zone-id>/records \
  -H "Authorization: Token [TOKEN VALUE]" \
  -H "Content-Type: application/json" \
  -d '{"name":"www","type":"A","rdata":["192.0.2.1"],"ttl":3600}'
```

A `201` returns the record:

```json
{
  "state": "executed",
  "data": {
    "id": 100172,
    "description": "",
    "name": "www",
    "ttl": 3600,
    "type": "A",
    "rdata": ["192.0.2.1"],
    "policy": "simple",
    "weight": 255
  }
}
```

The zone holds the record. Record its `id`: you edit or delete the record by that ID.

The API refuses a record that conflicts with the zone, such as a second simple record of the same name and type, and the record is not saved. For each refusal and its code, refer to [Zones and records](/en/documentation/platform/edge-dns/zones-and-records/#errors).

Save a record before anything queries its name. A name that nobody queried before you saved its record answers within seconds. A name queried earlier is answered `NXDOMAIN` for up to one hour, the SOA minimum. To fix it, refer to [A new record returns NXDOMAIN](/en/documentation/platform/edge-dns/troubleshooting/#a-new-record-returns-nxdomain).

---

## Edit a record

You change a record in place, with no need to delete and add it again. The example lowers the TTL of `www` to 300 seconds, which shortens how long resolvers keep the old value before a planned change. For that practice, refer to [Lower the TTL a few days before a planned change](/en/documentation/platform/edge-dns/best-practices/#lower-the-ttl-a-few-days-before-a-planned-change).

**Console**

To edit the record in Azion Console:

1. **Open the Edge DNS page**

   Access [Azion Console](https://console.azion.com/) > **Edge DNS**.

2. **Open the zone**

   On the **Zones** page, select the row of the zone.

3. **Select the Records tab**

4. **Open the record**

   In the **Records** table, select the row of the record. The **Edit Record** drawer opens with its fields.

5. **Change the TTL**

   In **TTL (seconds)**, enter `300`. To change what the record answers, edit **Value** instead.

6. **Select Save**

The Console shows `Edge DNS Record has been updated`, and the **TTL (seconds)** column of the record reads `300`.

**CLI**

To edit the record with the Azion CLI, pass only the flags you change. Replace `<record-id>` with the ID that the create printed:

```bash
azion update dns-record --zone-id <zone-id> --record-id <record-id> --ttl 300
```

The command confirms the update:

```text
DNS record 100214 was updated
```

To change what the record answers, pass the value to `--rdata` instead. To check the result, list the records of the zone:

```bash
azion list dns-record --zone-id <zone-id>
```

The output prints one row per record, with its ID:

```text
ID      NAME  TYPE  TTL  RDATA
100172  www   A     300  192.0.2.1
…
```

The `TTL` column of the record reads `300`.

**API**

To edit the record with the Azion API, send a `PATCH` request with only the fields you change. Replace `<record-id>` with the `id` that the create returned:

```bash
curl -X PATCH https://api.azion.com/v4/workspace/dns/zones/<zone-id>/records/<record-id> \
  -H "Authorization: Token [TOKEN VALUE]" \
  -H "Content-Type: application/json" \
  -d '{"ttl":300}'
```

A `200` returns the whole record with the changed TTL:

```json
{
  "state": "executed",
  "data": {
    "id": 100172,
    "description": "",
    "name": "www",
    "ttl": 300,
    "type": "A",
    "rdata": ["192.0.2.1"],
    "policy": "simple",
    "weight": 255
  }
}
```

To change what the record answers, send `rdata` instead. A `PUT` request replaces the record and takes `name`, `type`, and `rdata`. A `GET` request to `https://api.azion.com/v4/workspace/dns/zones/<zone-id>/records` lists the records of the zone with their `id`.

A change to an existing record can take a few minutes to reach every nameserver. After that, each resolver keeps the old value until its TTL runs out. If a query still returns the old value, refer to [A changed record still returns the old value](/en/documentation/platform/edge-dns/troubleshooting/#a-changed-record-still-returns-the-old-value).

---

## Delete a record

Deleting a record removes it from the zone, and it cannot be reversed. For a weighted record, first set its weight to `0`, as [Set a weight of 0 before you delete a weighted record](/en/documentation/platform/edge-dns/best-practices/#set-a-weight-of-0-before-you-delete-a-weighted-record) explains.

**Console**

To delete the record in Azion Console:

1. **Open the Edge DNS page**

   Access [Azion Console](https://console.azion.com/) > **Edge DNS**.

2. **Open the zone**

   On the **Zones** page, select the row of the zone.

3. **Select the Records tab**

4. **Select Delete on the record's row**

   In the **Records** table, open the actions of the record's row and select **Delete**.

5. **Type the record name**

   In the **Delete record** dialog, type the **Name** of the record in the box, such as `www` or `@`.

6. **Select Delete**

The Console shows `Edge DNS Record successfully deleted`, and the record leaves the **Records** table.

**CLI**

To delete the record with the Azion CLI, replace `<zone-id>` and `<record-id>` with the IDs of the zone and the record:

```bash
azion delete dns-record --zone-id <zone-id> --record-id <record-id>
```

The command confirms the delete:

```text
DNS record 100228 was successfully deleted
```

The record is deleted, and `azion list dns-record --zone-id <zone-id>` no longer lists it.

**API**

To delete the record with the Azion API, send a `DELETE` request to the record:

```bash
curl -X DELETE https://api.azion.com/v4/workspace/dns/zones/<zone-id>/records/<record-id> \
  -H "Authorization: Token [TOKEN VALUE]"
```

The API answers `200`:

```json
{"state":"executed"}
```

The record is deleted. A `GET` request on its ID then returns `404` with `10004` `Not Found`.

Resolvers that cached an answer from the record keep it until the record's TTL runs out.

---

## Next steps

- [Query a zone with dig](/en/documentation/guides/application-security/dns/run-the-dig-command.md): Check what Azion's nameservers answer for a record.
- [Record types](/en/documentation/platform/edge-dns/record-types.md): Look up the value each record type takes.
- [Point an apex domain with ANAME](/en/documentation/guides/application-security/dns/access-root-domain.md): Serve example.com itself from an Azion workload.
- [Migrate nameservers to Azion](/en/documentation/guides/platform/migration/migrate-ns-to-azion.md): Delegate your domain to Edge DNS once its records are in place.
