DNS-hosting API

The following operations can currently be performed with the API:

  • add, change, and delete domains;
  • add and edit resource records: SRV, MX, CNAME, TXT, A, AAAA, NS, SPF (which is here for compatibility, but not recommended for use–see RFC 7208), and PTR; when a domain is added, SOA records are created automatically with MINIMUM and EXPIRE values set to 300 and 604800 respectively;
  • change the contact email address in SOA records;
  • add and edit reverse records for IP addresses;
  • tag domains.

Getting Started

First, you’ll need to obtain a key here.

The actual API is located at https://api.selectel.ru/domains/v1/`. Your key will have to be included in GET requests to this address. The X-Sid: <key> parameter will have to be added to POST, PUT, PATCH, and DELETE request headers, but there is one nuance: the key structure is <hash>_<user_id>, but the user_id should be removed when it is added to headers (the parameter will thus be: X-Sid: <hash>); however, in query parameters, the key will have to be fully added: api_key=<key>.

Script for Uploading BIND Zones

The script for automating migration for Python 2

The script for automating migration for Python 3

To upload a BIND zone, enter the command:

$ bind_upload.py [-h] --key <key> --name <name> --zone <zone>

For the --key parameter value, enter your API access key; for --name, enter the domain name to be added. For the --zone parameter, enter the path to the zone file.

The script returns information on the added domain in JSON format. If any errors occur while adding a resource record, information on the error will be included in the response.