> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # UpdateDnsZone # Package: domains # Namespace: DomainDns # Method link: https://dev.wix.com/docs/api-reference/account-level/domains/domain-dns/update-dns-zone.md ## Introduction Adds DNS records to and removes DNS records from a DNS zone in [Google's Cloud DNS](https://cloud.google.com/dns). The call is synchronous, that means it fails in case of an error on Google's side. You can only set up a single `record` object per DNS record type. If you want to specify multiple values for the same record type, you must save them in the `values` for the relevant type. This means, you must delete the relevant record and add a new `addition` object for this type to the request, in case you want to add values for an existing DNS record type. > __Important:__ This call requires an account level API key and cannot be authenticated with the standard authorization header. --- ## REST API ### Schema ``` Method: updateDnsZone Description: Adds DNS records to and removes DNS records from a DNS zone in [Google's Cloud DNS](https://cloud.google.com/dns). The call is synchronous, that means it fails in case of an error on Google's side. You can only set up a single `record` object per DNS record type. If you want to specify multiple values for the same record type, you must save them in the `values` for the relevant type. This means, you must delete the relevant record and add a new `addition` object for this type to the request, in case you want to add values for an existing DNS record type. > __Important:__ This call requires an account level API key and cannot be authenticated with the standard authorization header. URL: https://www.wixapis.com/domains/v1/dns-zones/{domainName} Method: PATCH # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: additions.type, additions.hostName, additions.values, deletions.type, deletions.hostName, deletions.values Method parameters: param name: additions | type: array | description: DNS records to add to the DNS zone. Max: 50 additions - name: type | type: RecordType | description: [DNS record type](https://en.wikipedia.org/wiki/List_of_DNS_record_types). | required: true - enum: - UNKNOWN: Default value. Used in case the record type isn't known. You can't set a record type to `UNKNOWN`. - A: Address record. Most fundamental type of DNS record that indicates the IP address of a given domain. - AAAA: Address record in [IPv6 format](https://en.wikipedia.org/wiki/IPv6). - NS: Name server record. Describes which server contains the actual DNS record. - SOA: [Start of authority record](https://en.wikipedia.org/wiki/SOA_record). Holds administrative information about the zone. - CNAME: [CNAME record](https://en.wikipedia.org/wiki/CNAME_record). Maps an alias name to the canonical domain name. - MX: MX record. Directs emails to mail servers. - TXT: [TXT record](https://en.wikipedia.org/wiki/TXT_record). Used by domain admins to add human-readable descriptions. - SPF: SPF record. Used for email authentication. - SRV: [Service record](https://en.wikipedia.org/wiki/SRV_record). Defines the server location. - PTR: Pointer record. Specifies which host is supported for a given IP address. - NAPTR: [Name Authority Pointer record](https://en.wikipedia.org/wiki/NAPTR_record). Used by Internet telephony applications. - name: hostName | type: string | description: Host name. Can be a subdomain. For example, `domain.com` or `mail.domain.com`. Equal to the domain name, except for `CNAME` records. | required: true - name: ttl | type: integer | description: [Time to live](https://en.wikipedia.org/wiki/Time_to_live) in seconds. - name: values | type: array | description: DNS record values. Wix limits DNS records to 50 values per type. External providers may support a different maximum number of DNS records for a specific type, Wix doesn't validate that you don't exceed these external limits. Max: 50 records | required: true param name: deletions | type: array | description: DNS records to remove from the DNS zone. Max: 50 deletions param name: dnssecEnabled | type: dnssecEnabled | description: Whether you want to enable or disable [DNS Security Extensions (DNSSEC)](https://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions). Return type: UpdateDnsZoneResponse - name: dnsZone | type: DnsZone | description: Updated DNS zone. - name: domainName | type: string | description: Domain name including the TLD. Both root domains and subdomains are supported. - name: records | type: array | description: DNS records. You can only set up a single `record` object per DNS record type. If you want to specify multiple values for the same record type, you must save them in the `values` for the relevant type. Min: 2 DNS record - a DNS zone file has to have at least two required DNS records: NS and SOA records Max: 5000 DNS records - name: type | type: RecordType | description: [DNS record type](https://en.wikipedia.org/wiki/List_of_DNS_record_types). - enum: - UNKNOWN: Default value. Used in case the record type isn't known. You can't set a record type to `UNKNOWN`. - A: Address record. Most fundamental type of DNS record that indicates the IP address of a given domain. - AAAA: Address record in [IPv6 format](https://en.wikipedia.org/wiki/IPv6). - NS: Name server record. Describes which server contains the actual DNS record. - SOA: [Start of authority record](https://en.wikipedia.org/wiki/SOA_record). Holds administrative information about the zone. - CNAME: [CNAME record](https://en.wikipedia.org/wiki/CNAME_record). Maps an alias name to the canonical domain name. - MX: MX record. Directs emails to mail servers. - TXT: [TXT record](https://en.wikipedia.org/wiki/TXT_record). Used by domain admins to add human-readable descriptions. - SPF: SPF record. Used for email authentication. - SRV: [Service record](https://en.wikipedia.org/wiki/SRV_record). Defines the server location. - PTR: Pointer record. Specifies which host is supported for a given IP address. - NAPTR: [Name Authority Pointer record](https://en.wikipedia.org/wiki/NAPTR_record). Used by Internet telephony applications. - name: hostName | type: string | description: Host name. Can be a subdomain. For example, `domain.com` or `mail.domain.com`. Equal to the domain name, except for `CNAME` records. - name: ttl | type: integer | description: [Time to live](https://en.wikipedia.org/wiki/Time_to_live) in seconds. - name: values | type: array | description: DNS record values. Wix limits DNS records to 50 values per type. External providers may support a different maximum number of DNS records for a specific type, Wix doesn't validate that you don't exceed these external limits. Max: 50 records - name: id | type: string | description: GUID of the Dns Zone. Identical to the domain name including TLD. - name: dnssecEnabled | type: boolean | description: Whether [DNS Security Extensions (DNSSEC)](https://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions) are enabled. Default: `false` - name: dnssecInfo | type: DnssecInfo | description: Information about [DNSSEC](https://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions). Available only if `{"dnssecEnabled": true}`. - name: keyTag | type: integer | description: Unique 16-bit identifier for a [DNSKEY](https://cloud.google.com/dns/docs/reference/rest/v1/dnsKeys) record that allows efficient DNSSEC validation in zones with multiple keys. - name: digest | type: string | description: Cryptographic hash of the [DNSKEY](https://cloud.google.com/dns/docs/reference/rest/v1/dnsKeys) record that's included in the delegation signer (DS) record and ensures secure DNSSEC validation. ``` ### Examples ### Update a DNS zone. ```curl curl -X PATCH 'https://www.wixapis.com/domains/v1/dns-zones/mysite.com' \ -H 'wix-account-id: ' \ -H 'Authorization: ' \ -d '{ "deletions": [ { "values": "google-site-verification=epsWybsHVqJqkw0dD2xrIaSO_jYJAmczAU7IqLWToVM", "type": "TXT", "hostName": "mysite.com", "ttl": 3600 } ], "additions": [ { "values": "10 aspmx.l.google.com", "type": "MX", "hostName": "mysite.com", "ttl": 3600 } ], "domainName": "mysite.com" }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.domains.DomainDns.updateDnsZone(domainName, options) Description: Adds DNS records to and removes DNS records from a DNS zone in [Google's Cloud DNS](https://cloud.google.com/dns). The call is synchronous, that means it fails in case of an error on Google's side. You can only set up a single `record` object per DNS record type. If you want to specify multiple values for the same record type, you must save them in the `values` for the relevant type. This means, you must delete the relevant record and add a new `addition` object for this type to the request, in case you want to add values for an existing DNS record type. > __Important:__ This call requires an account level API key and cannot be authenticated with the standard authorization header. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: domainName, options.additions.type, options.additions.hostName, options.additions.values, options.deletions.type, options.deletions.hostName, options.deletions.values Method parameters: param name: domainName | type: string | description: Domain to update the DNS zone for. Must include the TLD. | required: true param name: options | type: UpdateDnsZoneOptions none - name: additions | type: array | description: DNS records to add to the DNS zone. Max: 50 additions - name: type | type: RecordType | description: [DNS record type](https://en.wikipedia.org/wiki/List_of_DNS_record_types). - enum: - UNKNOWN: Default value. Used in case the record type isn't known. You can't set a record type to `UNKNOWN`. - A: Address record. Most fundamental type of DNS record that indicates the IP address of a given domain. - AAAA: Address record in [IPv6 format](https://en.wikipedia.org/wiki/IPv6). - NS: Name server record. Describes which server contains the actual DNS record. - SOA: [Start of authority record](https://en.wikipedia.org/wiki/SOA_record). Holds administrative information about the zone. - CNAME: [CNAME record](https://en.wikipedia.org/wiki/CNAME_record). Maps an alias name to the canonical domain name. - MX: MX record. Directs emails to mail servers. - TXT: [TXT record](https://en.wikipedia.org/wiki/TXT_record). Used by domain admins to add human-readable descriptions. - SPF: SPF record. Used for email authentication. - SRV: [Service record](https://en.wikipedia.org/wiki/SRV_record). Defines the server location. - PTR: Pointer record. Specifies which host is supported for a given IP address. - NAPTR: [Name Authority Pointer record](https://en.wikipedia.org/wiki/NAPTR_record). Used by Internet telephony applications. - name: hostName | type: string | description: Host name. Can be a subdomain. For example, `domain.com` or `mail.domain.com`. Equal to the domain name, except for `CNAME` records. - name: ttl | type: integer | description: [Time to live](https://en.wikipedia.org/wiki/Time_to_live) in seconds. - name: values | type: array | description: DNS record values. Wix limits DNS records to 50 values per type. External providers may support a different maximum number of DNS records for a specific type, Wix doesn't validate that you don't exceed these external limits. Max: 50 records - name: deletions | type: array | description: DNS records to remove from the DNS zone. Max: 50 deletions - name: dnssecEnabled | type: boolean | description: Whether you want to enable or disable [DNS Security Extensions (DNSSEC)](https://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions). Return type: PROMISE - name: dnsZone | type: DnsZone | description: Updated DNS zone. - name: domainName | type: string | description: Domain name including the TLD. Both root domains and subdomains are supported. - name: records | type: array | description: DNS records. You can only set up a single `record` object per DNS record type. If you want to specify multiple values for the same record type, you must save them in the `values` for the relevant type. Min: 2 DNS record - a DNS zone file has to have at least two required DNS records: NS and SOA records Max: 5000 DNS records - name: type | type: RecordType | description: [DNS record type](https://en.wikipedia.org/wiki/List_of_DNS_record_types). - enum: - UNKNOWN: Default value. Used in case the record type isn't known. You can't set a record type to `UNKNOWN`. - A: Address record. Most fundamental type of DNS record that indicates the IP address of a given domain. - AAAA: Address record in [IPv6 format](https://en.wikipedia.org/wiki/IPv6). - NS: Name server record. Describes which server contains the actual DNS record. - SOA: [Start of authority record](https://en.wikipedia.org/wiki/SOA_record). Holds administrative information about the zone. - CNAME: [CNAME record](https://en.wikipedia.org/wiki/CNAME_record). Maps an alias name to the canonical domain name. - MX: MX record. Directs emails to mail servers. - TXT: [TXT record](https://en.wikipedia.org/wiki/TXT_record). Used by domain admins to add human-readable descriptions. - SPF: SPF record. Used for email authentication. - SRV: [Service record](https://en.wikipedia.org/wiki/SRV_record). Defines the server location. - PTR: Pointer record. Specifies which host is supported for a given IP address. - NAPTR: [Name Authority Pointer record](https://en.wikipedia.org/wiki/NAPTR_record). Used by Internet telephony applications. - name: hostName | type: string | description: Host name. Can be a subdomain. For example, `domain.com` or `mail.domain.com`. Equal to the domain name, except for `CNAME` records. - name: ttl | type: integer | description: [Time to live](https://en.wikipedia.org/wiki/Time_to_live) in seconds. - name: values | type: array | description: DNS record values. Wix limits DNS records to 50 values per type. External providers may support a different maximum number of DNS records for a specific type, Wix doesn't validate that you don't exceed these external limits. Max: 50 records - name: _id | type: string | description: GUID of the Dns Zone. Identical to the domain name including TLD. - name: dnssecEnabled | type: boolean | description: Whether [DNS Security Extensions (DNSSEC)](https://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions) are enabled. Default: `false` - name: dnssecInfo | type: DnssecInfo | description: Information about [DNSSEC](https://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions). Available only if `{"dnssecEnabled": true}`. - name: keyTag | type: integer | description: Unique 16-bit identifier for a [DNSKEY](https://cloud.google.com/dns/docs/reference/rest/v1/dnsKeys) record that allows efficient DNSSEC validation in zones with multiple keys. - name: digest | type: string | description: Cryptographic hash of the [DNSKEY](https://cloud.google.com/dns/docs/reference/rest/v1/dnsKeys) record that's included in the delegation signer (DS) record and ensures secure DNSSEC validation. ``` ### Examples ### Update a DNS zone with an API Key ```javascript import { createClient, ApiKeyStrategy } from "@wix/sdk"; import { domainDns } from "@wix/domains"; const wixClient = createClient({ modules: { domainDns }, auth: ApiKeyStrategy({ siteId: "MY-SITE-ID", apiKey: "MY-API-KEY", }), }); async function updateDnsZone(domainName, options) { const response = await domainDns.updateDnsZone(domainName, options); } ``` ### updateDnsZone (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { domainDns } from '@wix/domains'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { domainDns }, // Include the auth strategy and host as relevant }); async function updateDnsZone(domainName,options) { const response = await myWixClient.domainDns.updateDnsZone(domainName,options); }; ``` ---