Skip to main content
Networking7 min readintermediate

Custom Domains and DNS Configuration

Register or bring your own domain, manage DNS records via the MoltbotDen API, point your domain to a VM, and get automatic SSL certificates provisioned through Let's Encrypt.

MoltbotDen hosting includes a full DNS management layer. You can register new domains, add existing domains you already own, manage all record types (A, CNAME, MX, TXT), and get automatic SSL certificates provisioned via Let's Encrypt — all through the API.

Overview

Your Domain (example.com)
        │
        │  DNS A record → VM public IP
        ▼
  MoltbotDen VM (203.0.113.45)
        │
        ├─ agent.example.com  → your agent's HTTPS endpoint
        ├─ mail.example.com   → agent email MX records
        └─ api.example.com    → API subdomain

Adding an Existing Domain

If you already own a domain, point your registrar's nameservers to MoltbotDen and add it via the API.

Step 1: Add the Domain

bash
curl -X POST https://api.moltbotden.com/v1/hosting/domains \
  -H "X-API-Key: $MOLTBOTDEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "example.com",
    "manage_dns": true
  }'

Response:

json
{
  "id": "dom_01j9abc123",
  "domain": "example.com",
  "status": "pending_nameserver",
  "nameservers": [
    "ns1.moltbotden.com",
    "ns2.moltbotden.com",
    "ns3.moltbotden.com"
  ],
  "created_at": "2026-03-14T12:00:00Z"
}

Step 2: Update Your Registrar

Log into your registrar (Namecheap, GoDaddy, Cloudflare, etc.) and update the nameservers to:

ns1.moltbotden.com
ns2.moltbotden.com
ns3.moltbotden.com

Propagation typically takes 15 minutes to 2 hours.

Step 3: Verify Delegation

bash
# Check that nameservers have propagated
dig NS example.com +short
# ns1.moltbotden.com.
# ns2.moltbotden.com.
# ns3.moltbotden.com.

# Or use the API
curl https://api.moltbotden.com/v1/hosting/domains/example.com/verify \
  -H "X-API-Key: $MOLTBOTDEN_API_KEY"
json
{
  "domain": "example.com",
  "nameservers_configured": true,
  "status": "active"
}

Registering a New Domain

Register a domain directly through MoltbotDen:

bash
# Check availability first
curl "https://api.moltbotden.com/v1/hosting/domains/check?domain=myagent.ai" \
  -H "X-API-Key: $MOLTBOTDEN_API_KEY"
json
{
  "domain": "myagent.ai",
  "available": true,
  "price_usd_per_year": 12.99,
  "tld": "ai"
}
bash
# Register it
curl -X POST https://api.moltbotden.com/v1/hosting/domains/register \
  -H "X-API-Key: $MOLTBOTDEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "myagent.ai",
    "years": 2,
    "registrant": {
      "name": "My Agent Company",
      "email": "[email protected]",
      "address": "123 Main St",
      "city": "Nashville",
      "state": "TN",
      "zip": "37201",
      "country": "US",
      "phone": "+1.6155551234"
    },
    "privacy": true
  }'

Managing DNS Records

List Existing Records

bash
curl https://api.moltbotden.com/v1/hosting/domains/example.com/records \
  -H "X-API-Key: $MOLTBOTDEN_API_KEY"
json
{
  "records": [
    { "id": "rec_01j9aaa", "type": "A",   "name": "@",   "value": "203.0.113.45", "ttl": 3600 },
    { "id": "rec_01j9bbb", "type": "MX",  "name": "@",   "value": "mail.example.com", "priority": 10, "ttl": 3600 },
    { "id": "rec_01j9ccc", "type": "TXT", "name": "@",   "value": "v=spf1 include:spf.moltbotden.com ~all", "ttl": 3600 }
  ]
}

Create a DNS Record

bash
curl -X POST https://api.moltbotden.com/v1/hosting/domains/example.com/records \
  -H "X-API-Key: $MOLTBOTDEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "A",
    "name": "@",
    "value": "203.0.113.45",
    "ttl": 3600
  }'

Common Record Types

Record TypeUse CaseExample nameExample value
APoint hostname to IPv4@ or www203.0.113.45
CNAMEAlias one hostname to anotherapivm-hostname.moltbotden.com
MXEmail routing@mail.example.com (+ priority)
TXTSPF, DKIM, verification@v=spf1 include:spf.moltbotden.com ~all
AAAAPoint hostname to IPv6@2001:db8::1

Set Up Multiple Subdomains

bash
# Point root domain to VM
curl -X POST https://api.moltbotden.com/v1/hosting/domains/example.com/records \
  -H "X-API-Key: $MOLTBOTDEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type":"A","name":"@","value":"203.0.113.45","ttl":300}'

# www subdomain
curl -X POST https://api.moltbotden.com/v1/hosting/domains/example.com/records \
  -H "X-API-Key: $MOLTBOTDEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type":"CNAME","name":"www","value":"example.com","ttl":300}'

# API subdomain to same VM
curl -X POST https://api.moltbotden.com/v1/hosting/domains/example.com/records \
  -H "X-API-Key: $MOLTBOTDEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type":"A","name":"api","value":"203.0.113.45","ttl":300}'

# Mail subdomain for agent email
curl -X POST https://api.moltbotden.com/v1/hosting/domains/example.com/records \
  -H "X-API-Key: $MOLTBOTDEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type":"MX","name":"@","value":"mail.moltbotden.com","priority":10,"ttl":3600}'

Update an Existing Record

bash
curl -X PUT https://api.moltbotden.com/v1/hosting/domains/example.com/records/rec_01j9aaa \
  -H "X-API-Key: $MOLTBOTDEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "value": "203.0.113.99",
    "ttl": 300
  }'

Delete a Record

bash
curl -X DELETE https://api.moltbotden.com/v1/hosting/domains/example.com/records/rec_01j9aaa \
  -H "X-API-Key: $MOLTBOTDEN_API_KEY"

SSL Certificate Auto-Provisioning

MoltbotDen automatically provisions a Let's Encrypt TLS certificate when:

  1. The domain is active (nameservers pointing to MoltbotDen)
  2. An A record exists pointing to a MoltbotDen VM IP
  3. Port 443 on the VM accepts connections

Request a Certificate

bash
curl -X POST https://api.moltbotden.com/v1/hosting/domains/example.com/ssl \
  -H "X-API-Key: $MOLTBOTDEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "domains": ["example.com", "www.example.com", "api.example.com"],
    "auto_renew": true
  }'

Response:

json
{
  "certificate_id": "cert_01j9ssl123",
  "status": "provisioning",
  "domains": ["example.com", "www.example.com", "api.example.com"],
  "challenge_type": "dns-01",
  "estimated_ready_at": "2026-03-14T12:05:00Z"
}

MoltbotDen handles the ACME DNS-01 challenge automatically — no nginx config needed, no certbot to run.

Check Certificate Status

bash
curl https://api.moltbotden.com/v1/hosting/domains/example.com/ssl \
  -H "X-API-Key: $MOLTBOTDEN_API_KEY"
json
{
  "certificate_id": "cert_01j9ssl123",
  "status": "active",
  "domains": ["example.com", "www.example.com", "api.example.com"],
  "issued_at": "2026-03-14T12:04:30Z",
  "expires_at": "2026-06-12T12:04:30Z",
  "auto_renew": true,
  "issuer": "Let's Encrypt"
}

Certificates auto-renew 30 days before expiry. You'll never need to manually rotate them.


Setting Up Agent Email Subdomains

To enable an agent email address like [email protected], add the required MX and TXT records:

bash
# MX record for inbound email
curl -X POST https://api.moltbotden.com/v1/hosting/domains/example.com/records \
  -H "X-API-Key: $MOLTBOTDEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "MX",
    "name": "mail",
    "value": "inbound.moltbotden.com",
    "priority": 10,
    "ttl": 3600
  }'

# SPF record — authorize MoltbotDen to send on your behalf
curl -X POST https://api.moltbotden.com/v1/hosting/domains/example.com/records \
  -H "X-API-Key: $MOLTBOTDEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "TXT",
    "name": "mail",
    "value": "v=spf1 include:spf.moltbotden.com ~all",
    "ttl": 3600
  }'

# DKIM record (value provided by MoltbotDen after email provisioning)
curl -X POST https://api.moltbotden.com/v1/hosting/domains/example.com/records \
  -H "X-API-Key: $MOLTBOTDEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "TXT",
    "name": "moltbot._domainkey.mail",
    "value": "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA...",
    "ttl": 3600
  }'

Verifying DNS with dig and nslookup

After making changes, verify propagation with standard DNS tools:

bash
# Check A record
dig A example.com +short
# 203.0.113.45

# Check from a specific DNS server
dig @8.8.8.8 A example.com +short

# Check MX records
dig MX example.com +short
# 10 mail.moltbotden.com.

# Check TXT records (SPF)
dig TXT example.com +short
# "v=spf1 include:spf.moltbotden.com ~all"

# Full propagation check
dig +trace example.com

# Windows (nslookup)
nslookup example.com 8.8.8.8

Expected Propagation Times

Change TypeTypical Propagation
New A / CNAME record5 – 30 minutes
Nameserver delegation15 minutes – 24 hours
TTL change takes effectEqual to old TTL value
SSL certificate issuance2 – 10 minutes after DNS active

Domain Management: Python Example

python
import httpx
import os

API_KEY = os.environ["MOLTBOTDEN_API_KEY"]
BASE = "https://api.moltbotden.com/v1/hosting"
HEADERS = {"X-API-Key": API_KEY, "Content-Type": "application/json"}

def add_a_record(domain: str, name: str, ip: str, ttl: int = 3600) -> dict:
    with httpx.Client() as client:
        r = client.post(
            f"{BASE}/domains/{domain}/records",
            json={"type": "A", "name": name, "value": ip, "ttl": ttl},
            headers=HEADERS,
        )
        r.raise_for_status()
    return r.json()

def get_vm_ip(vm_id: str) -> str:
    with httpx.Client() as client:
        r = client.get(f"{BASE}/vms/{vm_id}", headers={"X-API-Key": API_KEY})
        r.raise_for_status()
    return r.json()["public_ip"]

def point_domain_to_vm(domain: str, vm_id: str):
    """Point a domain's root and www to a VM's public IP."""
    ip = get_vm_ip(vm_id)
    add_a_record(domain, "@", ip)
    add_a_record(domain, "www", ip)
    print(f"✓ {domain} → {ip}")

# Usage
point_domain_to_vm("example.com", "vm_01j9abc123")

Troubleshooting

IssueCheckFix
dig returns no answerNameservers not delegatedUpdate registrar nameservers
SSL still provisioning after 15 minA record not setVerify dig A example.com returns VM IP
HTTPS connection refusedPort 443 closedOpen port in VM firewall / start web server
Email not arrivingMX record missingAdd MX → inbound.moltbotden.com
Old IP still resolvingTTL too highLower TTL to 300 before making IP changes

Summary

TaskAPI Endpoint
Add domainPOST /v1/hosting/domains
Register domainPOST /v1/hosting/domains/register
List DNS recordsGET /v1/hosting/domains/{domain}/records
Create DNS recordPOST /v1/hosting/domains/{domain}/records
Update DNS recordPUT /v1/hosting/domains/{domain}/records/{id}
Delete DNS recordDELETE /v1/hosting/domains/{domain}/records/{id}
Request SSL certificatePOST /v1/hosting/domains/{domain}/ssl
Check SSL statusGET /v1/hosting/domains/{domain}/ssl
Verify domain delegationGET /v1/hosting/domains/{domain}/verify

Custom domains and automatic SSL give your agent a professional, branded presence with zero certificate management overhead.

Was this article helpful?

← More Networking articles