DNS Records
The DNS records endpoints allow you view and manage DNS records belonging to each DNS zone on your account. We'll look at how to query, create, update, and delete DNS records.
The record model
The DNS record model contains all the information about a record.
Properties
- Name
id- Type
- string
- Description
Unique identifier for the DNS record.
- Name
zone_id- Type
- string
- Description
Unique identifier for the DNS zone the record belongs to.
- Name
name- Type
- string
- Description
The name of DNS record which could be one of
@for the zone root, or a subdomain e.g.mail.domain.cv. It must be 255 characters long or less.
- Name
type- Type
- string
- Description
The type of DNS record which could typically be one of
A,AAAA,CNAME,MX,TXT,DKIM,SPF,DMARC,SRV.
- Name
content- Type
- string
- Description
The content of the DNS record which varies with the type of record.
- Name
ttl- Type
- integer
- Description
Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. Value must be between 60 and 86400.
- Name
comment- Type
- string
- Description
Comments or notes about the DNS record. This field has no effect on DNS responses.
- Name
created_at- Type
- timestamp
- Description
Timestamp of when the record was created.
- Name
updated_at- Type
- timestamp
- Description
Timestamp of when the record was last updated.
List all records
This endpoint allows you to retrieve a paginated list of all your DNS records. By default, a maximum of 20 records are shown per page.
Optional attributes
- Name
page- Type
- integer
- Description
The page to retrieve zone records for.
- Name
per_page- Type
- integer
- Description
The number of records to retrieve per page.
Request
curl https://ola.cv/api/v1/zones/444576043220111360/records \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {token}' \
-H 'Content-Type: application/json'
Response
{
"data": [
{
"id": "400336825089642496",
"zone_id": "444576043220111360",
"name": "anotherdomain.cv",
"type": "A",
"content": "198.51.100.4",
"ttl": 3600,
"comment": "Domain setup",
"created_at": "2024-08-14T14:08:22.000000Z",
"updated_at": "2024-08-15T16:53:30.000000Z"
}
],
"meta": {
"current_page": 1,
"first_page_url": "https://ola.cv/api/v1/zones/444576043220111360/records?page=1",
"next_page_url": null,
"path": "https://ola.cv/api/v1/zones/444576043220111360/records",
"per_page": 20,
"prev_page_url": null,
},
"message": "Zone records retrieved successfully."
}
Create a DNS record
This endpoint allows you to create a new DNS record on a zone in your account.
Required attributes
- Name
name- Type
- string
- Description
The name of DNS record which could be one of
@for the zone root, or a subdomain e.g.mail.domain.cv. It must be 255 characters long or less.
- Name
type- Type
- string
- Description
The type of DNS record which could typically be one of
A,AAAA,CNAME,MX,TXT,DKIM,SPF,DMARC,SRV.
- Name
content- Type
- string
- Description
The content of the DNS record which varies with the type of record.
- Name
ttl- Type
- integer
- Description
Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. Value must be between 60 and 86400.
Optional attributes
- Name
comment- Type
- string
- Description
Comments or notes about the DNS record. This field has no effect on DNS responses.
- Name
priority- Type
- string
- Description
Required for
MX,SRVandURIrecords only; unused by other record types. Values are typically between 1 and 10. Records with lower priorities are preferred.
Request
curl https://ola.cv/api/v1/zones/444576043220111360/records \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {token}' \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"type": "MX",
"name": "@",
"content": "smtp.google.com",
"priority": 1,
"ttl": 60
}'
Response
{
"data": {
"id": "435141188682608640",
"zone_id": "444576043220111360",
"name": "anotherdomain.cv",
"type": "MX",
"content": "smtp.google.com",
"ttl": 60,
"comment": null,
"created_at": "2024-09-18T19:56:38.000000Z",
"updated_at": "2024-09-18T19:56:38.000000Z"
},
"message": "DNS record created successfully."
}
Retrieve a DNS record
This endpoint allows you to retrieve a DNS record by providing the record ID. Refer to the list at the top of this page to see which properties are included with DNS record objects.
Request
curl https://ola.cv/api/v1/zones/444576043220111360/records/400336825089642496 \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {token}' \
-H 'Content-Type: application/json'
Response
{
"data": {
"id": "400336825089642496",
"zone_id": "444576043220111360",
"name": "anotherdomain.cv",
"type": "A",
"content": "198.51.100.4",
"ttl": 3600,
"comment": "Domain activation",
"created_at": "2024-08-14T14:08:22.000000Z",
"updated_at": "2024-08-15T16:53:30.000000Z"
},
"message": "Zone record retrieved successfully."
}
Update a DNS record
This endpoint allows you to perform an update on a DNS record. See record model at the top of this page to see which properties are included with DNS record objects.
Request
curl https://ola.cv/api/v1/zones/444576043220111360/records/435141188682608640 \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {token}' \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"type": "MX",
"name": "@",
"content": "mx.zoho.eu.",
"priority": 10,
"ttl": 60
}'
Response
{
"data": {
"id": "435141188682608640",
"zone_id": "444576043220111360",
"name": "anotherdomain.cv",
"type": "MX",
"content": "mx.zoho.eu.",
"ttl": 60,
"comment": null,
"created_at": "2024-09-18T19:56:38.000000Z",
"updated_at": "2024-09-18T19:56:38.000000Z"
},
"message": "DNS record updated successfully."
}
Delete a DNS record
This endpoint allows you to delete DNS records. Note: This will permanently delete the record.
Request
curl https://ola.cv/api/v1/zones/444576043220111360/records/435141188682608640 \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {token}' \
-H 'Content-Type: application/json' \
-X DELETE
Response
{
"data": {
"id": "435141188682608640"
},
"message": "DNS record deleted successfully."
}