Domain records

Domain record resources are used to set or retrieve information about the individual DNS records configured for a domain. This allows you to build and manage DNS zone files by adding and modifying individual records for a domain.

The CloudsFor DNS management interface allows you to configure the following DNS records:

There is also an additional field called id that is auto-assigned for each record and used as a unique identifier for requests. Each record contains all of these attribute types. For record types that do not utilize all fields, a value of null will be set for that record.

Attribute Type Description
id number A unique identifier for each domain record.
type string The type of the DNS record (ex: A, CNAME, TXT, ...).
name string The name to use for the DNS record.
data string The value to use for the DNS record.
priority nullable number The priority for SRV and MX records.
port nullable number The port for SRV records.
weight nullable number The weight for SRV records.

List all Domain Records

To get a listing of all records configured for a domain, send a GET request to /api/v1/domains/$DOMAIN_NAME/records.

The response will be a JSON object with a key called domain_records. The value of this will be an array of domain record objects, each of which contains the standard domain record attributes:

For attributes that are not used by a specific record type, a value of null will be returned. For instance, all records other than SRV will have null for the weight and port attributes.

Attribute Type Description
id number A unique identifier for each domain record.
type string The type of the DNS record (ex: A, CNAME, TXT, ...).
name string The name to use for the DNS record.
data string The value to use for the DNS record.
priority nullable number The priority for SRV and MX records.
port nullable number The port for SRV records.
weight nullable number The weight for SRV records.

cURL Example:

curl -X GET -H 'Content-Type: application/json' -u 'user@example.com:password' "https://cloudsfor.com/api/v1/domains/example.com/records"

Request Headers:

Content-Type: application/json
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

Response Headers:

content-type: application/json; charset=utf-8
status: 200 OK

Response Body:

{
  "domain_records": [
    {
      "id": 3352892,
      "type": "NS",
      "name": "@",
      "data": "ns1.cloudsfor.com",
      "priority": null,
      "port": null,
      "weight": null
    },
    {
      "id": 3352893,
      "type": "NS",
      "name": "@",
      "data": "ns2.cloudsfor.com",
      "priority": null,
      "port": null,
      "weight": null
    },
    {
      "id": 3352894,
      "type": "NS",
      "name": "@",
      "data": "ns3.cloudsfor.com",
      "priority": null,
      "port": null,
      "weight": null
    },
    {
      "id": 3352895,
      "type": "A",
      "name": "@",
      "data": "1.2.3.4",
      "priority": null,
      "port": null,
      "weight": null
    }
  ],
  "links": {
  },
  "meta": {
    "total": 4
  }
}

Create a new Domain Record

To create a new record to a domain, send a POST request to /api/v1/domains/$DOMAIN_NAME/records.

The request must include all of the required fields for the domain record type being added. The required attributes per domain record type:

Attribute Type Description Required
type string
The record type (A, MX, CNAME, etc).
All records
name string
The host name, alias, or service being defined by
the record.
A, AAAA,
CNAME,TXT
SRV
data string
Variable data depending on record type. See the
[Domain Records]() section for more detail on each
record type.
A, AAAA,NS
CNAME, MX,
TXT, SRV,
priority
nullable
number
The priority of the host (for SRV and MX records. null
otherwise).
MX, SRV
port
nullable
number
The port that the service is accessible on (for SRV
records only. null otherwise).
SRV
weight
nullable
number
The weight of records with the same priority (for SRV
records only. null otherwise).
SRV

The response body will be a JSON object with a key called domain_record. The value of this will be an object representing the new record. Attributes that are not applicable for the record type will be set to null. An id attribute is generated for each record as part of the object.

Attribute Type Description
id number A unique identifier for each domain record.
type string The type of the DNS record (ex: A, CNAME, TXT, ...).
name string The name to use for the DNS record.
data string The value to use for the DNS record.
priority nullable number The priority for SRV and MX records.
port nullable number The port for SRV records.
weight nullable number The weight for SRV records.

cURL Example:

curl -X POST -H 'Content-Type: application/json' -u 'user@example.com:password' -d '{"type":"A","name":"test","data":"162.10.66.0","priority":null,"port":null,"weight":null}' "https://cloudsfor.com/api/v1/domains/example.com/records"

Request Headers:

Content-Type: application/json
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

Request Body:

{
  "type": "A",
  "name": "customdomainrecord.com",
  "data": "162.10.66.0",
  "priority": null,
  "port": null,
  "weight": null
}

Response Headers:

content-type: application/json; charset=utf-8
status: 201 Created

Response Body:

{
  "domain_record": {
    "id": 3352896,
    "type": "A",
    "name": "customdomainrecord.com",
    "data": "162.10.66.0",
    "priority": null,
    "port": null,
    "weight": null
  }
}

Retrieve an existing Domain Record

To retrieve a specific domain record, send a GET request to /api/v1/domains/$DOMAIN_NAME/records/$RECORD_ID.

The response will be a JSON object with a key called domain_record. The value of this will be an object that contains all of the standard domain record attributes:

Attribute Type Description
id number A unique identifier for each domain record.
type string The type of the DNS record (ex: A, CNAME, TXT, ...).
name string The name to use for the DNS record.
data string The value to use for the DNS record.
priority nullable number The priority for SRV and MX records.
port nullable number The port for SRV records.
weight nullable number The weight for SRV records.

cURL Example:

curl -X GET -H 'Content-Type: application/json' -u 'user@example.com:password' "https://cloudsfor.com/api/v1/domains/example.com/records/3352896"

Request Headers:

Content-Type: application/json
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

Response Headers:

content-type: application/json; charset=utf-8
status: 200 OK

Response Body:

{
  "domain_record": {
    "id": 3352896,
    "type": "A",
    "name": "test",
    "data": "162.10.66.0",
    "priority": null,
    "port": null,
    "weight": null
  }
}

Update a Domain Record

To update an existing record, send a PUT request to /api/v1/domains/$DOMAIN_NAME/records/$RECORD_ID. Any attribute valid for the record type can be set to a new value for the record.

Attribute Type Description Required
type string
The record type (A, MX, CNAME, etc).
All records
name string
The host name, alias, or service being defined by
the record.

A, AAAA,
CNAME,TXT
SRV
data string
Variable data depending on record type. See the
[Domain Records]() section for more detail on each
record type.
A, AAAA,NS
CNAME, MX,
TXT, SRV,
priority
nullable
number
The priority of the host (for SRV and MX records. null
otherwise).
MX, SRV
port
nullable
number
The port that the service is accessible on (for SRV
records only. null otherwise).
SRV
weight
nullable
number
The weight of records with the same priority (for SRV
records only. null otherwise).
SRV

cURL Example:

curl -X PUT -H 'Content-Type: application/json' -u 'user@example.com:password' -d '{"name":"new-test"}' "https://cloudsfor.com/api/v1/domains/example.com/records/3352896"

Request Headers:

Content-Type: application/json
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

Request Body:

{
  "name": "new-test"
}

Response Headers:

content-type: application/json; charset=utf-8
status: 200 OK

Response Body:

{
  "domain_record": {
    "id": 3352896,
    "type": "A",
    "name": "updated-record-name.com",
    "data": "162.10.66.0",
    "priority": null,
    "port": null,
    "weight": null
  }
}

Delete a Domain Record

To delete a record for a domain, send a DELETE request to /api/v1/domains/$DOMAIN_NAME/records/$RECORD_ID.

The record will be deleted and the response status will be a 204. This indicates a successful request with no body returned.

cURL Example:

curl -X DELETE -H 'Content-Type: application/json' -u 'user@example.com:password' "https://cloudsfor.com/api/v1/domains/example.com/records/3352896"

Request Headers:

Content-Type: application/json
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

Response Headers:

content-type: application/octet-stream
status: 204 No Content