dots.v2.domains.byDomain_name().records.post()

Generated on 27 Oct 2026 from DoTs version v1.21.0

Usage

client.v2.domains.byDomain_name(domain_name).records.post(body: Domain_record_aaaa | Domain_record_a | Domain_record_caa | Domain_record_cname | Domain_record_mx | Domain_record_ns | Domain_record_soa | Domain_record_srv | Domain_record_txt, requestConfiguration?: RequestConfiguration<object>): Promise<undefined | RecordsPostResponse>

Description

To create a new record to a domain, send a POST request to /v2/domains/{domain_name}/records.

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

See the attribute table for details regarding record types and their respective required attributes.

Parameters

Path Parameters

domain_name string required

Example: example.com

The name of the domain itself.

Request Body

domain_record_a

id integer optional read-only

Example: 28448429

A unique identifier for each domain record.

type string required

Example: NS

The type of the DNS record. For example: A, CNAME, TXT, ...

name string required

Example: @

The host name, alias, or service being defined by the record.

data string required

Example: ns1.digitalocean.com

Variable data depending on record type. For example, the "data" value for an A record would be the IPv4 address to which the domain will be mapped. For a CAA record, it would contain the domain name of the CA being granted permission to issue certificates.

priority integer or null optional

The priority for SRV and MX records.

port integer or null optional

The port for SRV records.

ttl integer optional

Example: 1800

This value is the time to live for the record, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested.

weight integer or null optional

The weight for SRV records.

flags integer or null optional

An unsigned integer between 0-255 used for CAA records.

tag string or null optional

The parameter tag for CAA records. Valid values are "issue", "issuewild", or "iodef"

domain_record_aaaa

id integer optional read-only

Example: 28448429

A unique identifier for each domain record.

type string required

Example: NS

The type of the DNS record. For example: A, CNAME, TXT, ...

name string required

Example: @

The host name, alias, or service being defined by the record.

data string required

Example: ns1.digitalocean.com

Variable data depending on record type. For example, the "data" value for an A record would be the IPv4 address to which the domain will be mapped. For a CAA record, it would contain the domain name of the CA being granted permission to issue certificates.

priority integer or null optional

The priority for SRV and MX records.

port integer or null optional

The port for SRV records.

ttl integer optional

Example: 1800

This value is the time to live for the record, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested.

weight integer or null optional

The weight for SRV records.

flags integer or null optional

An unsigned integer between 0-255 used for CAA records.

tag string or null optional

The parameter tag for CAA records. Valid values are "issue", "issuewild", or "iodef"

domain_record_caa

id integer optional read-only

Example: 28448429

A unique identifier for each domain record.

type string required

Example: NS

The type of the DNS record. For example: A, CNAME, TXT, ...

name string required

Example: @

The host name, alias, or service being defined by the record.

data string required

Example: ns1.digitalocean.com

Variable data depending on record type. For example, the "data" value for an A record would be the IPv4 address to which the domain will be mapped. For a CAA record, it would contain the domain name of the CA being granted permission to issue certificates.

priority integer or null optional

The priority for SRV and MX records.

port integer or null optional

The port for SRV records.

ttl integer optional

Example: 1800

This value is the time to live for the record, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested.

weight integer or null optional

The weight for SRV records.

flags integer or null required

An unsigned integer between 0-255 used for CAA records.

tag string or null required

The parameter tag for CAA records. Valid values are "issue", "issuewild", or "iodef"

domain_record_cname

id integer optional read-only

Example: 28448429

A unique identifier for each domain record.

type string required

Example: NS

The type of the DNS record. For example: A, CNAME, TXT, ...

name string required

Example: @

The host name, alias, or service being defined by the record.

data string required

Example: ns1.digitalocean.com

Variable data depending on record type. For example, the "data" value for an A record would be the IPv4 address to which the domain will be mapped. For a CAA record, it would contain the domain name of the CA being granted permission to issue certificates.

priority integer or null optional

The priority for SRV and MX records.

port integer or null optional

The port for SRV records.

ttl integer optional

Example: 1800

This value is the time to live for the record, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested.

weight integer or null optional

The weight for SRV records.

flags integer or null optional

An unsigned integer between 0-255 used for CAA records.

tag string or null optional

The parameter tag for CAA records. Valid values are "issue", "issuewild", or "iodef"

domain_record_mx

id integer optional read-only

Example: 28448429

A unique identifier for each domain record.

type string required

Example: NS

The type of the DNS record. For example: A, CNAME, TXT, ...

name string optional

Example: @

The host name, alias, or service being defined by the record.

data string required

Example: ns1.digitalocean.com

Variable data depending on record type. For example, the "data" value for an A record would be the IPv4 address to which the domain will be mapped. For a CAA record, it would contain the domain name of the CA being granted permission to issue certificates.

priority integer or null required

The priority for SRV and MX records.

port integer or null optional

The port for SRV records.

ttl integer optional

Example: 1800

This value is the time to live for the record, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested.

weight integer or null optional

The weight for SRV records.

flags integer or null optional

An unsigned integer between 0-255 used for CAA records.

tag string or null optional

The parameter tag for CAA records. Valid values are "issue", "issuewild", or "iodef"

domain_record_ns

id integer optional read-only

Example: 28448429

A unique identifier for each domain record.

type string required

Example: NS

The type of the DNS record. For example: A, CNAME, TXT, ...

name string required

Example: @

The host name, alias, or service being defined by the record.

data string required

Example: ns1.digitalocean.com

Variable data depending on record type. For example, the "data" value for an A record would be the IPv4 address to which the domain will be mapped. For a CAA record, it would contain the domain name of the CA being granted permission to issue certificates.

priority integer or null optional

The priority for SRV and MX records.

port integer or null optional

The port for SRV records.

ttl integer optional

Example: 1800

This value is the time to live for the record, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested.

weight integer or null optional

The weight for SRV records.

flags integer or null required

An unsigned integer between 0-255 used for CAA records.

tag string or null required

The parameter tag for CAA records. Valid values are "issue", "issuewild", or "iodef"

domain_record_soa

id integer optional read-only

Example: 28448429

A unique identifier for each domain record.

type string required

Example: NS

The type of the DNS record. For example: A, CNAME, TXT, ...

name string optional

Example: @

The host name, alias, or service being defined by the record.

data string optional

Example: ns1.digitalocean.com

Variable data depending on record type. For example, the "data" value for an A record would be the IPv4 address to which the domain will be mapped. For a CAA record, it would contain the domain name of the CA being granted permission to issue certificates.

priority integer or null optional

The priority for SRV and MX records.

port integer or null optional

The port for SRV records.

ttl integer required

Example: 1800

This value is the time to live for the record, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested.

weight integer or null optional

The weight for SRV records.

flags integer or null optional

An unsigned integer between 0-255 used for CAA records.

tag string or null optional

The parameter tag for CAA records. Valid values are "issue", "issuewild", or "iodef"

domain_record_srv

id integer optional read-only

Example: 28448429

A unique identifier for each domain record.

type string required

Example: NS

The type of the DNS record. For example: A, CNAME, TXT, ...

name string required

Example: @

The host name, alias, or service being defined by the record.

data string required

Example: ns1.digitalocean.com

Variable data depending on record type. For example, the "data" value for an A record would be the IPv4 address to which the domain will be mapped. For a CAA record, it would contain the domain name of the CA being granted permission to issue certificates.

priority integer or null required

The priority for SRV and MX records.

port integer or null required

The port for SRV records.

ttl integer optional

Example: 1800

This value is the time to live for the record, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested.

weight integer or null optional

The weight for SRV records.

flags integer or null required

An unsigned integer between 0-255 used for CAA records.

tag string or null required

The parameter tag for CAA records. Valid values are "issue", "issuewild", or "iodef"

domain_record_txt

id integer optional read-only

Example: 28448429

A unique identifier for each domain record.

type string required

Example: NS

The type of the DNS record. For example: A, CNAME, TXT, ...

name string required

Example: @

The host name, alias, or service being defined by the record.

data string required

Example: ns1.digitalocean.com

Variable data depending on record type. For example, the "data" value for an A record would be the IPv4 address to which the domain will be mapped. For a CAA record, it would contain the domain name of the CA being granted permission to issue certificates.

priority integer or null optional

The priority for SRV and MX records.

port integer or null optional

The port for SRV records.

ttl integer optional

Example: 1800

This value is the time to live for the record, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested.

weight integer or null optional

The weight for SRV records.

flags integer or null required

An unsigned integer between 0-255 used for CAA records.

tag string or null required

The parameter tag for CAA records. Valid values are "issue", "issuewild", or "iodef"

Request Sample

Show Request Sample
import { FetchRequestAdapter } from "@microsoft/kiota-http-fetchlibrary";
import {
    createDigitalOceanClient,
    DigitalOceanApiKeyAuthenticationProvider,
} from "@digitalocean/dots";

const authProvider = new DigitalOceanApiKeyAuthenticationProvider(process.env.DIGITALOCEAN_TOKEN!);
const adapter = new FetchRequestAdapter(authProvider);
const client = createDigitalOceanClient(adapter);

const response = await client.v2.domains
    .byDomain_name("example.com").records.post({
    type: "A",
    name: "www",
    data: "162.10.66.0",
    priority: null,
    port: null,
    ttl: 1800,
    weight: null,
    flags: null,
    tag: null,
});

Response Example

Show Response Example
{
  "domain_record": {
    "id": 28448433,
    "type": "A",
    "name": "www",
    "data": "162.10.66.0",
    "priority": null,
    "port": null,
    "ttl": 1800,
    "weight": null,
    "flags": null,
    "tag": null
  }
}

More Information

See /v2/domains/{domain_name}/records in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.