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.


GET/api/v1/zones/:id/records

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

GET
/api/v1/zones/444576043220111360/records
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."
}

POST/api/v1/zones/:id/records

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, SRV and URI records only; unused by other record types. Values are typically between 1 and 10. Records with lower priorities are preferred.

Request

POST
/api/v1/zones/444576043220111360/records
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."
}

GET/api/v1/zones/:id/records/:id

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

GET
/api/v1/zones/44457604../records/4003368..42496
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."
}

POST/api/v1/zones/:id/records/:id

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

POST
/api/v1/zones/44457..11360/records/43514..8640
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/api/v1/zones/:id/records/:id

Delete a DNS record

This endpoint allows you to delete DNS records. Note: This will permanently delete the record.

Request

DELETE
/api/v1/zones/44457..1360/records/4351..8640
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."
}

Was this page helpful?