v8

latestOpenAPI 3.0.0Apache 2.0raw.githubusercontent.com2025-10-165266542.4 MB
DigitalOcean-public.v2-new_Domains

Create a New Domain

To create a new domain, send a POST request to /v2/domains. Set the "name" attribute to the domain name you are adding. Optionally, you may set the "ip_address" attribute, and an A record will be automatically created pointing to the apex domain.

post/v2/domains

Request body

namestring

The name of the domain itself. This should follow the standard domain format of domain.TLD. For instance, example.com is a valid domain name.

ip_addressstring

This optional attribute may contain an IP address. When provided, an A record will be automatically created pointing to the apex domain.

ttlinteger nullable

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

zone_filestring nullable

This attribute contains the complete contents of the zone file for the selected domain. Individual domain record resources should be used to get more granular control over records. However, this attribute can also be used to get information about the SOA record, which is created automatically and is not accessible as an individual record resource.

Example request

{
  "name": "example.com",
  "ip_address": "192.0.2.1",
  "ttl": 1800,
  "zone_file": "$ORIGIN example.com.\n$TTL 1800\nexample.com. IN SOA ns1.digitalocean.com. hostmaster.example.com. 1415982609 10800 3600 604800 1800\nexample.com. 1800 IN NS ns1.digitalocean.com.\nexample.com. 1800 IN NS ns2.digitalocean.com.\nexample.com. 1800 IN NS ns3.digitalocean.com.\nexample.com. 1800 IN A 1.2.3.4\n"
}

Response

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

Example response

{
  "domain": {
    "name": "example.com",
    "ttl": 1800,
    "zone_file": null
  }
}