Edit a DNS record

This request is used for editing a DNS record for the domain.

The DNS record can be specified using the ID.

  1. Request syntax
  2. Request example
  3. Response structure

Request syntax

The request should be sent over the HTTPS protocol using the POST method.

POST /api2/admin/dns/edit
Host: pddimp.yandex.ru
PddToken: <PDD token>
...

domain=<domain name>
&record_id=<record ID>
[&admin_mail=<administrator's email address>]
[&content=<record contents>]
[&priority=<record priority>]
[&weight=<SRV record weight>]
[&port=<host port>]
[&target=<host's canonical name>]
[&subdomain=<subdomain name>]
[&ttl=<lifespan of record>]
[&refresh=<time between updates>]
[&retry=<time between attempts to get record>]
[&expire=<time limit>]
[&neg_cache=<caching time>]

Headers:

Name Description
PddToken

PDD token.

Name Description
PddToken

PDD token.

Parameters:

Parameter Type Value
Mandatory
domain String

Name of the domain.

record_id Integer

ID of the DNS record.

Optional
subdomain String

Subdomain name. For example, “domain.com” is the name of a subdomain of the “com” domain, and “my.domain.com” is a subdomain of the “domain.com” domain.

The default value is “@” (the domain root).

This parameter should be passed if you need to create or modify the DNS record for a subdomain, and not for the domain.

ttl Integer

Lifetime of the DNS record, in seconds.

For SOA records, this is how long the DNS record's value is cached by intermediary DNS servers. This length of time will also be used by default for all other new records in the zone. Acceptable values are from 900 to 1209600. The recommended value is 21600.

refresh Integer

The frequency in seconds for secondary DNS servers to check DNS records for this zone. Acceptable values are from 900 to 86400. The recommended value is 10800.

This parameter must be passed if an SOA record is being edited.

retry Integer

The time in seconds between repeated attempts by secondary DNS servers to get the zone records. Repeat requests are sent if the primary server does not respond. Acceptable values are from 90 to 3600. The recommended value is 900.

This parameter must be passed if an SOA record is being edited.

expire Integer

The time in seconds after which secondary DNS servers consider the zone records nonexistent if the primary server does not respond. Acceptable values are from 90 to 3600. The recommended value is 900.

This parameter must be passed if an SOA record is being edited.

neg_cache Integer

The time in seconds during which a negative response from the DNS server (ERROR = NXDOMAIN) will be cached. Acceptable values are from 90 to 86400. The recommended value is 10800.

This parameter must be passed if an SOA record is being edited.

admin_mail String

The email address of the domain administrator.

This parameter is required only for SOA records.

content String

Contents of the DNS record.

For records of the type:
  • A — the address in IPv4 format (for example, “194.84.46.241”).
  • AAAA — the address in IPv6 format (for example, "2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d").
  • CNAME, MX or NS — the absolute domain name (FQDN).
  • TXT — text of the TXT record (for example, “v=spf1 redirect=_spf.yandex.ru”).
priority Integer

Priority of the DNS record (the smaller the value, the higher its priority).

This parameter is required only for SRV and MX records.

The default value is 10.

port String

The TCP or UDP port of the host where the service resides. The service may be, for example, jabber.

This parameter is required only for SRV records.

weight Integer

The weight of the SRV record in relation to other SRV records for the same domain and with the same priority.

This parameter is required only for SRV records.

target String

The canonical name of the host providing the service.

This parameter is required only for SRV records.

Parameter Type Value
Mandatory
domain String

Name of the domain.

record_id Integer

ID of the DNS record.

Optional
subdomain String

Subdomain name. For example, “domain.com” is the name of a subdomain of the “com” domain, and “my.domain.com” is a subdomain of the “domain.com” domain.

The default value is “@” (the domain root).

This parameter should be passed if you need to create or modify the DNS record for a subdomain, and not for the domain.

ttl Integer

Lifetime of the DNS record, in seconds.

For SOA records, this is how long the DNS record's value is cached by intermediary DNS servers. This length of time will also be used by default for all other new records in the zone. Acceptable values are from 900 to 1209600. The recommended value is 21600.

refresh Integer

The frequency in seconds for secondary DNS servers to check DNS records for this zone. Acceptable values are from 900 to 86400. The recommended value is 10800.

This parameter must be passed if an SOA record is being edited.

retry Integer

The time in seconds between repeated attempts by secondary DNS servers to get the zone records. Repeat requests are sent if the primary server does not respond. Acceptable values are from 90 to 3600. The recommended value is 900.

This parameter must be passed if an SOA record is being edited.

expire Integer

The time in seconds after which secondary DNS servers consider the zone records nonexistent if the primary server does not respond. Acceptable values are from 90 to 3600. The recommended value is 900.

This parameter must be passed if an SOA record is being edited.

neg_cache Integer

The time in seconds during which a negative response from the DNS server (ERROR = NXDOMAIN) will be cached. Acceptable values are from 90 to 86400. The recommended value is 10800.

This parameter must be passed if an SOA record is being edited.

admin_mail String

The email address of the domain administrator.

This parameter is required only for SOA records.

content String

Contents of the DNS record.

For records of the type:
  • A — the address in IPv4 format (for example, “194.84.46.241”).
  • AAAA — the address in IPv6 format (for example, "2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d").
  • CNAME, MX or NS — the absolute domain name (FQDN).
  • TXT — text of the TXT record (for example, “v=spf1 redirect=_spf.yandex.ru”).
priority Integer

Priority of the DNS record (the smaller the value, the higher its priority).

This parameter is required only for SRV and MX records.

The default value is 10.

port String

The TCP or UDP port of the host where the service resides. The service may be, for example, jabber.

This parameter is required only for SRV records.

weight Integer

The weight of the SRV record in relation to other SRV records for the same domain and with the same priority.

This parameter is required only for SRV records.

target String

The canonical name of the host providing the service.

This parameter is required only for SRV records.

Request example

POST /api2/admin/dns/edit HTTP/1.1
Host: pddimp.yandex.ru
PddToken: 123456789ABCDEF0000000000000000000000000000000000000
...
domain=domain.com&record_id=1&subdomain=www&ttl=14400&content=127.0.0.1
cURL
curl -H 'PddToken: 123456789ABCDEF0000000000000000000000000000000000000' -d 'domain=domain.com&record_id=1&subdomain=www&ttl=14400&content=127.0.0.1' 'https://pddimp.yandex.ru/api2/admin/dns/edit'

Response structure

{
  "domain": "{domain name}", 
  "record_id": "{record ID}",  
  "record":
  {
    "record_id": "{record ID}",
    "type": "{record type}",     
    "domain": "{domain name}"
    "fqdn": {"absolute domain name"},    
    "ttl": "{record lifetime}",     
    "subdomain": "{subdomain name}",     
    "content": "{record contents}",
    "priority": "{record priority}",
    "operation": "{editing}"    
  },
  "success": "{status of request execution}"
}
Name Type of value Description
domain String

Name of the domain.

record Object

Information about the DNS record.

success String

Status of request execution.

Possible values:
  • ok — Request executed successfully.
  • error — Request executed with error.
error String

Error code.

Included in the response if the request resulted in an error.

Possible values:
  • unknown — A temporary failure or API error occurred (repeat the request again later).
  • no_token (no_domain, no_ip ) — A mandatory parameter was omitted.
  • bad_domain — The domain name was not specified or does not conform to the RFC.
  • prohibited — A forbidden domain name.
  • bad_token (bad_login, bad_passwd) — An invalid PDD token (or username/password) was passed.
  • no_auth — The PddToken header was omitted.
  • not_allowed — This operation is not allowed for this user (the user is not the domain administrator).
  • blocked — Blocked domain (for example, due to spam and so on).
  • occupied — The domain name is in use by another user.
  • domain_limit_reached — Exceeded the acceptable number of connected domains (50).
  • no_reply — Yandex.Mail for Domain cannot connect to the server source for the import.
Keys for the record object
record_id Integer

ID of the DNS record.

type String

Type of DNS record.

Possible values:
  • SRV
  • TXT
  • NS
  • MX
  • SOA
  • A
  • AAAA
  • CNAME
domain String

Name of the domain.

fqdn String

Absolute domain name (FQDN).

ttl Integer

Lifetime of the DNS record, in seconds.

subdomain String

Subdomain name. For example, “my.domain.com” is the name of a subdomain of the “domain.com” domain. You can use “my” in place of “my.domain.com”.

content String

Contents of the DNS record.

priority Integer

Priority of the DNS record. Exists for MX and SRV records. For all other DNS records, an empty string is returned.

operation String

The current operation being performed with the DNS record. Only the editing value is possible.

Name Type of value Description
domain String

Name of the domain.

record Object

Information about the DNS record.

success String

Status of request execution.

Possible values:
  • ok — Request executed successfully.
  • error — Request executed with error.
error String

Error code.

Included in the response if the request resulted in an error.

Possible values:
  • unknown — A temporary failure or API error occurred (repeat the request again later).
  • no_token (no_domain, no_ip ) — A mandatory parameter was omitted.
  • bad_domain — The domain name was not specified or does not conform to the RFC.
  • prohibited — A forbidden domain name.
  • bad_token (bad_login, bad_passwd) — An invalid PDD token (or username/password) was passed.
  • no_auth — The PddToken header was omitted.
  • not_allowed — This operation is not allowed for this user (the user is not the domain administrator).
  • blocked — Blocked domain (for example, due to spam and so on).
  • occupied — The domain name is in use by another user.
  • domain_limit_reached — Exceeded the acceptable number of connected domains (50).
  • no_reply — Yandex.Mail for Domain cannot connect to the server source for the import.
Keys for the record object
record_id Integer

ID of the DNS record.

type String

Type of DNS record.

Possible values:
  • SRV
  • TXT
  • NS
  • MX
  • SOA
  • A
  • AAAA
  • CNAME
domain String

Name of the domain.

fqdn String

Absolute domain name (FQDN).

ttl Integer

Lifetime of the DNS record, in seconds.

subdomain String

Subdomain name. For example, “my.domain.com” is the name of a subdomain of the “domain.com” domain. You can use “my” in place of “my.domain.com”.

content String

Contents of the DNS record.

priority Integer

Priority of the DNS record. Exists for MX and SRV records. For all other DNS records, an empty string is returned.

operation String

The current operation being performed with the DNS record. Only the editing value is possible.