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, 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 for easier grouping and filtering.
Authorization
To work with the API, you must pass Selectel Token in the X-Token header when running each query. Learn more on how to obtain the Selectel token and log in the instructions.
The actual API is located at https://api.selectel.ru/domains/v1/
.
For example, the query below will return a list of all added domains:
curl -H 'X-Token: <key>' -H "Content-Type: application/json" https://api.selectel.ru/domains/v1/
Response:
[{"user_id": 1174374, "name": "test.com", "tags": [], "change_date": 1590484494, "create_date": 1590484494, "id": 2363763}]
All available methods for working with the DNS Hosting API are listed below in the form of the OpenAPI 3.0 specification.
URL: https://api.selectel.ru/domains/v1/
Example query:
curl -H 'X-Token: <key>' -H "Content-Type: application/json" https://api.selectel.ru/domains/v1/
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, run the command:
bind_upload.py [-h] --key <key> --name <name> --zone <zone>
Where:
--key
is the API access key;--name
is the domain name to be added;--zone
is 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.