Add a DNS record

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

  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/add
Host: pddimp.yandex.ru
PddToken: <PDD token>
...

domain=<domain name>
&type=<record type>
[&admin_mail=<administrator's email address>]
[&content=<ip or domain name>]
[&priority=<record priority>]
[&weight=<SRV record weight>]
[&port=<host port>]
[&target=<host's canonical name>]
[&subdomain=<subdomain name>]
[&ttl=<lifespan of record>]

Headers:

Name Description
PddToken

PDD token.

Name Description
PddToken

PDD token.

Parameters:

Parameter Type Value
Mandatory
domain String

Name of the domain.

type String

Type of DNS record.

Possible values:
  • SRV
  • TXT
  • NS
  • MX
  • SOA
  • A
  • AAAA
  • CNAME
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.

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.

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.

target String

The canonical name of the host providing the service.

This parameter is required only for SRV records.

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. The default value is 21600.

Parameter Type Value
Mandatory
domain String

Name of the domain.

type String

Type of DNS record.

Possible values:
  • SRV
  • TXT
  • NS
  • MX
  • SOA
  • A
  • AAAA
  • CNAME
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.

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.

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.

target String

The canonical name of the host providing the service.

This parameter is required only for SRV records.

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. The default value is 21600.

Request example

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

Response structure

{
  "domain": "{domain name}", 
  "record":
  { 
    "record_id": "{record ID}",  
    "type": "{type of record}",
    "domain": "{domain name}",
    "subdomain": "{subdomain name}",
    "fqdn": "{absolute domain name}",
    "content": "{record contents}",
    "ttl": "{record lifetime}",
    "priority": "{record priority}"   
  },
  "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.

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.