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:

NameDescription
PddToken

PDD token.

Parameters:

ParameterTypeValue
Mandatory
domainString

Name of the domain.

typeString

Type of DNS record.

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

The email address of the domain administrator.

This parameter is required only for SOA records.

contentString

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 ().
  • TXT — text of the TXT record (for example, “v=spf1 redirect=_spf.yandex.ru”).
priorityInteger

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.

weightInteger

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.

portString

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.

targetString

The canonical name of the host providing the service.

This parameter is required only for SRV records.

Optional
subdomainString

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.

ttlInteger

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}"
}
NameType of valueDescription
domainString

Name of the domain.

recordObject

Information about the DNS record.

successString

Status of request execution.

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

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_idInteger

ID of the DNS record.

typeString

Type of DNS record.

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

Name of the domain.

fqdnString

Absolute domain name ().

ttlInteger

Lifetime of the DNS record, in seconds.

subdomainString

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”.

contentString

Contents of the DNS record.

priorityInteger

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