# How to add records

import Tabs from '~/components/tabs/Tabs'

import Code from '~/components/Code/Code.astro'

After defining your [Edge DNS main settings](/en/documentation/products/guides/secure/edge-dns-configure-main-settings/), you can add records to specify which IPs are associated with the domain and how **Edge DNS** should handle requests for the domain.

---

<Tabs client:visible>
    <Fragment slot="tab.console">Console</Fragment>
    <Fragment slot="tab.api">API</Fragment>

<Fragment slot="panel.console">
1. Access [Azion Console](/en/documentation/products/guides/how-to-access-azion-console/) > **Edge DNS**.
2. From the list, choose the Edge DNS zone in which you want to add records.
3. Select the **Records** tab.
4. Click the **+ Record** button.
5. In **Name**, provide the new record's name.
- Depending on the [type of record](/en/documentation/products/secure/edge-dns/#type) you want to use, there may exist specific formats and recommendations.
6. In **Record Type**, select the type of record you want to add.
- Accepts the types `A`, `AAAA`, `ANAME`, `CAA`, `CNAME`, `DS`, `MX`, `NS`, `PTR`, `SRV`, and `TXT`.
7. In **Value**, add the items for the DNS response to the registered record. The accepted values vary according to the [chosen type of record](/en/documentation/products/secure/edge-dns/#type).
8. In **TTL (seconds)**, choose the time, in seconds, that a response can be cached on a resolver server. Maximum value: `2147483647`.
9. In **Policy**, select between **Simple** or **Weighted**.
10.  If you select **Weighted** in **Policy**:
    - In **Weight**, specify the weight for each record. Accepts values from `0` to `255`.
    - In **Description** (optional), you can describe, for example, the distinction between records with the same **Name** and **Type**. Accepts up to *45 characters*. 
11.  Click the **Save** button.
</Fragment>

<Fragment slot="panel.api">
1. Run the following `GET` request in your terminal, replacing `[TOKEN VALUE]` with your [personal token](/en/documentation/products/guides/personal-tokens/) to retrieve your `<zone_id>`:

<Code lang="bash" code={`
curl --request GET \
  --url https://api.azion.com/v4/edge_dns/zones \
  --header 'Accept: application/json' \
  --header 'Authorization: Token [TOKEN VALUE]]'
`} />

1. You'll receive a response with all your existing firewalls. Copy the value of the `<id>` that you want to use.
2. Run the following `POST` request, replacing `[TOKEN VALUE]` with your [personal token](/en/documentation/products/guides/personal-tokens/) and the `<zone_id>` value you copied:

<Code lang="bash" code={`
curl --request POST \
  --url https://api.azion.com/v4/dns/zones/<zone_id>/records \
  --header 'Accept: application/json' \
  --header 'Authorization: Token [TOKEN VALUE]' \
  --header 'Content-Type: application/json' \
  --data '{
    "type": "CNAME",
    "name": "www",
    "rdata": ["www.mydomain.com"],
    "ttl": 20,
    "description": "description"
  }'
`} />

Wait a few minutes for the changes to propagate and your records will be created in the hosted zone you chose.

:::tip
Check the [Azion API documentation](https://api.azion.com/) to know more about what the Azion API can offer.
:::
</Fragment>

</Tabs>

---