This is a series of articles dedicated to demonstrating how to get acquainted with Openprovider DNS Zones API methods. If you want to go the beginning of this guide, please navigate to the article "Zones API: How to create a zone".
To get more information about our API in general, please use our documentation portal as your reference.
This is a third article that is going to help better understand the logic behind DNS zone modification.
There are two possible scenarios to consider when modifying a DNS zone:
- rewrite the whole object with new data
- add/delete or modify a select record
While both approaches do the job, the first one suits better for "smaller" zones while the second one is more appropriate for large zone files that can be a hassle to manage in a text editor.

PUT {base_url}/dns/zones/{name}
REQUEST VALUES↓
Name | Type | Description |
domain | array | Required. Extension and name |
master_ip | varchar | Only required for slave zones |
records | array of objects | Required. Array of objects |
is_spamexperts_enabled | boolean | Required for master zones |
REQUEST EXAMPLE↓
curl -X PUT \
https://api.openprovider.eu/v1beta/dns/zones/domain.com \
-H 'Authorization: ,Bearer 2831a37fb8*******90b5aac822' \
-H 'Content-Type: application/json' \
-d '{
"domain": [
{
"extension": "com",
"name": "domain"
}
],
"id": 6574389,
"is_spamexperts_enabled": true,
"master_ip": "127.0.0.1",
"name": "domain.com"
}'
RESPONSE EXAMPLE↓
{
"code": 0,
"data": {
"success": true
},
"desc": ""
}
RESPONSE VALUES↓
Filed | Type | Records |
type | string | A, AAAA, CNAME, MX, SPF, SRV, TXT, NS, TLSA, SSHFP, CAA |
name | string | The part of the hostname before the domain name; for example www or ftp |
value | varchar | The value of the record; depending on the type, certain restrictions apply; see the FAQ for these restrictions |
priority | timestamp | The priority of the record; required for MX records; ignored for all other record types |
TTL | timestamp | Time To Live of the record; this is a value in seconds Accepted values: 900, 3600, 10800, 21600, 43200, 86400. Inserting other values will result in 86400 being saved. |
↓
Adding a single record
In order to add or update a single record it is necessary to utilise a corresponding modifier.
For instance:
REQUEST EXAMPLE↓
curl -X PUT \
https://api.openprovider.eu/v1beta/dns/zones/domain.com \
-H 'Authorization: ,Bearer 2831a37fb8*******90b5aac822' \
-H 'Content-Type: application/json' \
-d '{
"id": 6574389,
"name": "domain.com",
"records": {
"add": [
{
"ttl": 900,
"type": "A",
"value": "5.255.94.114"
}
]
}
}'
Updating a single record
REQUEST EXAMPLE↓
curl -X PUT \
https://api.openprovider.eu/v1beta/dns/zones/domain.com \
-H 'Authorization: ,Bearer 2831a37fb8*******90b5aac822' \
-H 'Content-Type: application/json' \
-d '{
"id": 6574389,
"name": "domain.com",
"records": {
"update":
[
{
"original_record": {
"prio": 10,
"ttl": 3600,
"type": "MX",
"value": "test-mail.domain.com",
},
"record": {
"prio": 10,
"ttl": 3600,
"type": "MX",
"value": "mail.domain.com",
}
}
]
}
}'
In the following article we are going to end a lifecycle of the DNS zone object by deleting it.