pydo.domains.create()

Generated on 3 Aug 2026 from pydo version v0.40.0

Usage

client.domains.create(
    body={
        "name": "example.com",
        "ip_address": "192.0.2.1",
    },
)
Returns JSONRaises HttpResponseError

Description

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.

Parameters

name string optional

Example: example.com

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_address string optional

Example: 192.0.2.1

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

ttl integer or null optional read-only

Example: 1800

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_file string or null optional read-only

Example: $ORIGIN example.com. $TTL 1800 example.com. IN SOA ns1.digitalocean.com. hostmaster.example.com. 1415982609 10800 3600 604800 1800 example.com. 1800 IN NS ns1.digitalocean.com. example.com. 1800 IN NS ns2.digitalocean.com. example.com. 1800 IN NS ns3.digitalocean.com. example.com. 1800 IN A 1.2.3.4

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.

Request Sample

Show Request Sample
import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "name": "example.com"
}

resp = client.domains.create(body=req)

Response Example

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

More Information

See /v2/domains 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.