---
updatedAt: 2025-11-11T21:43:57.000Z
agentTools:
  projectIndex: https://domains.opensrs.guide/llms.txt
---

# set_dns_zone

Set the records for a domain's DNS zone.

## Request parameters for set\_dns\_zone

## Standard parameters

* **action** = set\_dns\_zone
* **object** = domain

## Attributes

Parameters within the **attributes** associative array are described below.

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Parameter name
      </th>

      <th>
        Obligation
      </th>

      <th>
        Definition/Value
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        domain
      </td>

      <td>
        Required
      </td>

      <td>
        The domain whose DNS you want to set.
      </td>
    </tr>

    <tr>
      <td>
        records
      </td>

      <td>
        Required
      </td>

      <td>
        A list of the record types defined for the domain; each record includes the settings for that record.

        Record types may be

        * 􏰀A
        * 􏰀 AAAA
        * 􏰀 CNAME 􏰀 
        * MX
        * SRV
        * TXT

        For more information, see the **Records** table below.
      </td>
    </tr>
  </tbody>
</Table>

## Records

Parameters within the **records** associative array are described below.

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Parameter name
      </th>

      <th>
        Obligation
      </th>

      <th>
        Definition/Value
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        A
      </td>

      <td>
        Optional
      </td>

      <td>
        Maps the domain name to the IP address. The A record consists of the following:

        * **ip\_address**—Internet Protocol Address. A numeric address that computers recognize, for example, 123.45.54.123.

        * **subdomain**— The third level of the domain name, such as **www** or **ftp**.
      </td>
    </tr>

    <tr>
      <td>
        AAAA
      </td>

      <td>
        Optional
      </td>

      <td>
        Maps the domain name to the IPv6 address. 

        The **AAAA** record consists of the following:

        * **ipv6\_address**—The next generation Internet Protocol designed as the successor to version 4. It is normally written as eight groups of four hexadecimal digits (i.e. 2003:0db8: 85a3:0000:0000:8a2e: 0370:7334

        * **subdomain**—The third level of the domain name, such as **www** or **ftp**.
      </td>
    </tr>

    <tr>
      <td>
        CNAME
      </td>

      <td>
        Optional
      </td>

      <td>
        Canonical Name. CNAME records can be used when you want a subdomain to point to another hostname. Allows you to create an alias for your domain.

        The **CNAME** record consists of the following:

        * **hostname**—The FQDN of the domain that\
          you want to access.

        * **subdomain**—The third level of the domain name, such as **www** or **ftp**.
      </td>
    </tr>

    <tr>
      <td>
        MX
      </td>

      <td>
        Optional
      </td>

      <td>
        Mail Exchange. MX records determine how mail is delivered to your domain. Ensures that email that is sent to you is routed to the correct destination. 

        The **MX** record consists of the following:

        * **priority**—The priority of the target host, lower value means more preferred.

        * **subdomain**—The third level of the domain name, such as **www** or **ftp**.

        * **hostname**—The FQDN of the domain that you want to access.
      </td>
    </tr>

    <tr>
      <td>
        nameservers\_ok
      </td>

      <td>
        Required
      </td>

      <td>
        Indicates whether the domain is set up to use the OpenSRS nameservers.

        * **0**—Domain is not set up to use the OpenSRS nameservers

        * **1**—Domain is set up to use the OpenSRS nameservers
      </td>
    </tr>

    <tr>
      <td>
        records
      </td>

      <td>
        Required
      </td>

      <td>
        A list of the record types defined for the domain; each record includes the settings for that record.

        Record types may be

        * **A**
        * **AAAA**
        * **CNAME** 
        * **MX**
        * **SRV**
        * **TXT**
      </td>
    </tr>

    <tr>
      <td>
        SRV
      </td>

      <td>
        Optional
      </td>

      <td>
        Service Record.\
        The **SRV** record consists of the following:

        * **priority**—The priority of the target host, lower value means more preferred.

        * **weight**—Arelative weight for records with the same priority.

        * **subdomain**—The third level of the domain name, such as **www** or **ftp**.

        * **hostname**—The FQDN of the domain that you want to access.

        * **port**—The TCP or UDP port on which the service is to be found.
      </td>
    </tr>

    <tr>
      <td>
        TXT
      </td>

      <td>
        Optional
      </td>

      <td>
        Text Record. Allows you to attach comments to a hostname to validate that email is being sent from the IP address of the domain's mail server.

        The **TXT** record consists of the following:

        * **subdomain**—The third level of the domain name, such as **www** or **ftp**.

        * **text**—The comments that you want to include.
      </td>
    </tr>
  </tbody>
</Table>

## Response parameters for set\_dns\_zone

## Standard parameters

* **action** = reply
* **object** = domain
* **is\_success** = a Boolean is returned, indicating success or failure of the\
  request
* **response\_code** = response code indicating outcome of the request
* **response\_text** = message describing the outcome of the request

## Attributes

If the request is successful, the **attributes** associative array may include the following:

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Parameter name
      </th>

      <th>
        Obligation
      </th>

      <th>
        Definition/Value
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        nameservers\_ok
      </td>

      <td>
        Returned if **is\_success = true**
      </td>

      <td>
        Indicates whether the domain is set up to use the OpenSRS nameservers.

        * **0**—Domain is not set up to use the OpenSRS nameservers

        * **1**—Domain is set up to use the OpenSRS nameservers
      </td>
    </tr>

    <tr>
      <td>
        records
      </td>

      <td>
        Returned if **is\_success = true**
      </td>

      <td>
        A list of the record types defined for the domain; each record includes the settings for that record.\
        Record types may be

        * **A**
        * **AAAA**
        * **CNAME** 
        * **MX**
        * **SRV**
        * **TXT**

        For more information, see the **Records** table below.
      </td>
    </tr>
  </tbody>
</Table>

**Records**

Parameters within the **records** associative array are described below.

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Parameter name
      </th>

      <th>
        Obligation
      </th>

      <th>
        Definition/Value
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        A
      </td>

      <td>
        Optional
      </td>

      <td>
        Maps the domain name to the IP address. The A record consists of the following:

        * **ip\_address**—InternetProtocolAddress.A numeric address that computers recognize, for example, 123.45.54.123.

        * **subdomain**—The third level of the domain name, such as **www** or **ftp**.
      </td>
    </tr>

    <tr>
      <td>
        AAAA
      </td>

      <td>
        Optional
      </td>

      <td>
        Maps the domain name to the IPv6 address. 

        The **AAAA** record consists of the following:

        * **subdomain**—The third level of the domain name, such as www or ftp.

        * **ipv6\_address**—The next generation Internet Protocol designed as the successor to version 4. It is normally written as eight groups of four hexadecimal digits (i.e. 2003:0db8: 85a3:0000:0000:8a2e:0370:7334)
      </td>
    </tr>

    <tr>
      <td>
        CNAME
      </td>

      <td>
        Optional
      </td>

      <td>
        Canonical Name. CNAME records can be used when you want a subdomain to point to another hostname. Allows you to create an alias for your domain.

        The **CNAME** record consists of the following:

        * **hostname**—The FQDN of the domain that you\
          want to access.

        * **subdomain**—The third level of the domain name, such as **www** or **ftp**.
      </td>
    </tr>

    <tr>
      <td>
        MX
      </td>

      <td>
        Optional
      </td>

      <td>
        Mail Exchange. MX records determine how mail is delivered to your domain. Ensures that email that is sent to you is routed to the correct destination.

        The **MX** record consists of the following:

        * **priority**—The priority of the target host,lower\
          value means more preferred.

        * **subdomain**—The third level of the domain\
          name, such as **www** or **ftp**.

        * **hostname**—The FQDN of the domain that you want to access.
      </td>
    </tr>

    <tr>
      <td>
        SRV
      </td>

      <td>
        Optional
      </td>

      <td>
        Service Record.\
        The SRV record consists of the following:

        * **priority**—The priority of the target host,lower\
          value means more preferred.

        * **weight**—A relative weight for records with the same priority.

        * **subdomain**—The third level of the domain name, such as **www** or **ftp**.

        * **hostname**—The FQDN of the domain that you want to access.

        * **port**—The TCP or UDP port on which the service is to be found.
      </td>
    </tr>

    <tr>
      <td>
        TXT
      </td>

      <td>
        Optional
      </td>

      <td>
        Text Record. Allows you to attach comments to a hostname to validate that email is being sent from the IP address of the domain's mail server.

        The **TXT** record consists of the following:

        * **subdomain**—The third level of the domain\
          name, such as **www** or **ftp**.

        * **text**—The comments that you want to include.
      </td>
    </tr>
  </tbody>
</Table>

## Examples for set\_dns\_zone

**Request**

```xml
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!DOCTYPE OPS_envelope SYSTEM 'ops.dtd'>
<OPS_envelope>
    <header>
        <version>0.9</version>
    </header>
    <body>
        <data_block>
            <dt_assoc>
                <item key="protocol">XCP</item>
                <item key="action">SET_DNS_ZONE</item>
                <item key="object">DOMAIN</item>
                <item key="attributes">
                    <dt_assoc>
                        <item key="domain">example.com</item>
                        <item key="records">
                            <dt_assoc>
                                <item key="A">
                                    <dt_array>
                                        <item key="0">
                                            <dt_assoc>
                                                <item key="subdomain"></item>
                                                <item key="ip_address">123.123.123.2</item>
                                            </dt_assoc>
                                        </item>
                                        <item key="1">
                                            <dt_assoc>
                                                <item key="subdomain">*</item>
                                                <item key="ip_address">123.123.123.3</item>
                                            </dt_assoc>
                                        </item>
                                        <item key="2">
                                            <dt_assoc>
                                                <item key="subdomain">www</item>
                                                <item key="ip_address">123.123.123.4</item>
                                            </dt_assoc>
                                        </item>
                                    </dt_array>
                                </item>
                                <item key="CNAME">
                                    <dt_array>
                                        <item key="0">
                                            <dt_assoc>
                                                <item key="subdomain">portal</item>
                                                <item key="hostname">www.example.com</item>
                                            </dt_assoc>
                                        </item>
                                    </dt_array>
                                </item>
                                <item key="MX">
                                    <dt_array>
                                        <item key="0">
                                            <dt_assoc>
                                                <item key="subdomain"></item>
                                                <item key="hostname">mx.example.com.cust.test.hostedemail.com</item>
                                                <item key="priority">10</item>
                                            </dt_assoc>
                                        </item>
                                    </dt_array>
                                </item>
                                <item key="TXT">
                                    <dt_array>
                                        <item key="0">
                                            <dt_assoc>
                                                <item key="subdomain">mail</item>
                                                <item key="text">v=spf1
                                                    exists:example.com -all</item>
                                            </dt_assoc>
                                        </item>
                                    </dt_array>
                                </item>
                                <item key="AAAA">
                                    <dt_array>
                                        <item key="0">
                                            <dt_assoc>
                                                <item key="subdomain">itportal</item>
                                                <item key="ipv6_address">2001:00ab:0000:00a1:0001:000b:00cc:00de</item>
                                            </dt_assoc>
                                        </item>
                                    </dt_array>
                                </item>
                                <item key="SRV">
                                    <dt_array>
                                        <item key="0">
                                            <dt_assoc>
                                                <item key="subdomain">itcontrol</item>
                                                <item key="hostname">control.example.com</item>
                                                <item key="port">443</item>
                                                <item key="priority">10</item>
                                                <item key="weight">1</item>
                                            </dt_assoc>
                                        </item>
                                    </dt_array>
                                </item>
                            </dt_assoc>
                        </item>
                    </dt_assoc>
                </item>
            </dt_assoc>
        </data_block>
    </body>
</OPS_envelope>
```

**Response**

```xml
<?xml version='1.0' encoding="UTF-8" standalone="no"?>
<!DOCTYPE OPS_envelope SYSTEM "ops.dtd">
<OPS_envelope>
    <header>
        <version>0.9</version>
    </header>
    <body>
        <data_block>
            <dt_assoc>
                <item key="protocol">XCP</item>
                <item key="action">REPLY</item>
                <item key="object">DOMAIN</item>
                <item key="response_text">Command Successful</item>
                <item key="response_code">200</item>
                <item key="is_success">1</item>
                <item key="attributes">
                    <dt_assoc>
                        <item key="records">
                            <dt_assoc>
                                <item key="A">
                                    <dt_array>
                                        <item key="0">
                                            <dt_assoc>
                                                <item key="subdomain"></item>
                                                <item key="ip_address">123.123.123.2</item>
                                            </dt_assoc>
                                        </item>
                                        <item key="1">
                                            <dt_assoc>
                                                <item key="subdomain">*</item>
                                                <item key="ip_address">123.123.123.3</item>
                                            </dt_assoc>
                                        </item>
                                        <item key="2">
                                            <dt_assoc>
                                                <item key="subdomain">www</item>
                                                <item key="ip_address">123.123.123.4</item>
                                            </dt_assoc>
                                        </item>
                                    </dt_array>
                                </item>
                                <item key="MX">
                                    <dt_array>
                                        <item key="0">
                                            <dt_assoc>
                                                <item key="priority">10</item>
                                                <item key="subdomain"></item>
                                                <item key="hostname">mx.example.com.cust.test.hostedemail.com</item>
                                            </dt_assoc>
                                        </item>
                                    </dt_array>
                                </item>
                                <item key="TXT">
                                    <dt_array>
                                        <item key="0">
                                            <dt_assoc>
                                                <item key="text">v=spf1 exists:example.com -all</item>
                                                <item key="subdomain">mail</item>
                                            </dt_assoc>
                                        </item>
                                    </dt_array>
                                </item>
                                <item key="SRV">
                                    <dt_array>
                                        <item key="0">
                                            <dt_assoc>
                                                <item key="priority">10</item>
                                                <item key="weight">1</item>
                                                <item key="subdomain">itcontrol</item>
                                                <item key="hostname">control.example.com</item>
                                                <item key="port">443</item>
                                            </dt_assoc>
                                        </item>
                                    </dt_array>
                                </item>
                                <item key="CNAME">
                                    <dt_array>
                                        <item key="0">
                                            <dt_assoc>
                                                <item key="subdomain">portal</item>
                                                <item key="hostname">www.example.com</item>
                                            </dt_assoc>
                                        </item>
                                    </dt_array>
                                </item>
                                <item key="AAAA">
                                    <dt_array>
                                        <item key="0">
                                            <dt_assoc>
                                                <item key="subdomain">itportal</item>
                                                <item key="ipv6_address">2001:00ab:0000:00a1:0001:000b:00cc:00de</item>
                                            </dt_assoc>
                                        </item>
                                    </dt_array>
                                </item>
                            </dt_assoc>
                        </item>
                        <item key="nameservers_ok">1</item>
                    </dt_assoc>
                </item>
            </dt_assoc>
        </data_block>
    </body>
</OPS_envelope>
```