DNS Presets

Quick DNS configurations for common services.

Overview

DNS presets provide one-click configurations for common services. Apply presets to quickly set up email, hosting, or other integrations.

Available Presets

PresetDescription
TRANSACTIONAL_EMAILTransactional Email service
GOOGLE_WORKSPACEGoogle Workspace email
MICROSOFT_365Microsoft 365 email
ZOHO_MAILZoho Mail
VERCELVercel hosting
NETLIFYNetlify hosting
GITHUB_PAGESGitHub Pages
CLOUDFLARE_PAGESCloudflare Pages

Applying Presets

Basic Usage

TypeScript:

await client.domains.dns.applyPreset('example.com', {
  preset: 'TRANSACTIONAL_EMAIL',
});

Python:

client.domains.dns.apply_preset(
    "example.com",
    preset="TRANSACTIONAL_EMAIL"
)

With Options

await client.domains.dns.applyPreset('example.com', {
  preset: 'VERCEL',
  options: {
    projectName: 'my-project',
    includeWww: true,
  },
});

Preview Before Applying

const preview = await client.domains.dns.previewPreset('example.com', {
  preset: 'TRANSACTIONAL_EMAIL',
});
 
console.log('Records to be created:');
for (const record of preview.toCreate) {
  console.log(`  + ${record.type} ${record.name}: ${record.value}`);
}
 
console.log('Records to be modified:');
for (const record of preview.toModify) {
  console.log(`  ~ ${record.type} ${record.name}`);
}
 
console.log('Records to be deleted:');
for (const record of preview.toDelete) {
  console.log(`  - ${record.type} ${record.name}`);
}
 
// Apply if satisfied
if (confirm('Apply these changes?')) {
  await client.domains.dns.applyPreset('example.com', {
    preset: 'TRANSACTIONAL_EMAIL',
  });
}

Email Presets

Transactional Email

Sets up MX, SPF, DKIM, and DMARC for Transactional Email:

await client.domains.dns.applyPreset('example.com', {
  preset: 'TRANSACTIONAL_EMAIL',
});
 
// Creates:
// MX @ → inbound.usetransactional.com (priority 10)
// TXT @ → v=spf1 include:usetransactional.com ~all
// TXT dkim1._domainkey → k=rsa; p=...
// TXT dkim2._domainkey → k=rsa; p=...
// TXT _dmarc → v=DMARC1; p=quarantine; ...

Google Workspace

await client.domains.dns.applyPreset('example.com', {
  preset: 'GOOGLE_WORKSPACE',
});
 
// Creates:
// MX @ → aspmx.l.google.com (priority 1)
// MX @ → alt1.aspmx.l.google.com (priority 5)
// MX @ → alt2.aspmx.l.google.com (priority 5)
// MX @ → alt3.aspmx.l.google.com (priority 10)
// MX @ → alt4.aspmx.l.google.com (priority 10)
// TXT @ → v=spf1 include:_spf.google.com ~all

With DKIM (requires verification code from Google):

await client.domains.dns.applyPreset('example.com', {
  preset: 'GOOGLE_WORKSPACE',
  options: {
    dkimSelector: 'google',
    dkimKey: 'v=DKIM1; k=rsa; p=MIGfMA0GCSq...',
  },
});

Microsoft 365

await client.domains.dns.applyPreset('example.com', {
  preset: 'MICROSOFT_365',
});
 
// Creates:
// MX @ → example-com.mail.protection.outlook.com (priority 0)
// TXT @ → v=spf1 include:spf.protection.outlook.com -all
// CNAME autodiscover → autodiscover.outlook.com
// CNAME sip → sipdir.online.lync.com
// CNAME lyncdiscover → webdir.online.lync.com

Zoho Mail

await client.domains.dns.applyPreset('example.com', {
  preset: 'ZOHO_MAIL',
  options: {
    region: 'US', // or 'EU', 'IN', 'AU', 'CN'
  },
});

Hosting Presets

Vercel

await client.domains.dns.applyPreset('example.com', {
  preset: 'VERCEL',
  options: {
    includeWww: true,
  },
});
 
// Creates:
// A @ → 76.76.21.21
// CNAME www → cname.vercel-dns.com

For Vercel projects with custom CNAME:

await client.domains.dns.applyPreset('example.com', {
  preset: 'VERCEL',
  options: {
    cname: 'cname.vercel-dns.com',
    includeWww: true,
  },
});

Netlify

await client.domains.dns.applyPreset('example.com', {
  preset: 'NETLIFY',
  options: {
    loadBalancer: 'netlify-lb.netlify.app',
    includeWww: true,
  },
});
 
// Creates:
// A @ → 75.2.60.5
// CNAME www → netlify-lb.netlify.app

GitHub Pages

await client.domains.dns.applyPreset('example.com', {
  preset: 'GITHUB_PAGES',
  options: {
    username: 'mycompany',
    includeWww: true,
  },
});
 
// Creates:
// A @ → 185.199.108.153
// A @ → 185.199.109.153
// A @ → 185.199.110.153
// A @ → 185.199.111.153
// CNAME www → mycompany.github.io

Cloudflare Pages

await client.domains.dns.applyPreset('example.com', {
  preset: 'CLOUDFLARE_PAGES',
  options: {
    projectName: 'my-project',
    includeWww: true,
  },
});
 
// Creates:
// CNAME @ → my-project.pages.dev
// CNAME www → my-project.pages.dev

Multiple Presets

Combine presets for full configuration:

// Set up website hosting
await client.domains.dns.applyPreset('example.com', {
  preset: 'VERCEL',
  options: { includeWww: true },
});
 
// Add email
await client.domains.dns.applyPreset('example.com', {
  preset: 'TRANSACTIONAL_EMAIL',
  merge: true, // Don't overwrite existing records
});

Custom Presets

Create reusable presets for your organization:

// Create custom preset
const preset = await client.domains.presets.create({
  name: 'my-saas-setup',
  description: 'Standard setup for our SaaS customers',
  records: [
    { type: 'A', name: '@', value: '203.0.113.1' },
    { type: 'CNAME', name: 'www', value: 'example.com' },
    { type: 'CNAME', name: 'app', value: 'app.myplatform.com' },
    { type: 'TXT', name: '@', value: 'v=spf1 include:usetransactional.com ~all' },
  ],
});
 
// Apply custom preset
await client.domains.dns.applyPreset('customer-domain.com', {
  preset: preset.id,
});

List Custom Presets

const presets = await client.domains.presets.list();
 
for (const preset of presets) {
  console.log(`${preset.name}: ${preset.description}`);
}

Update Custom Preset

await client.domains.presets.update(preset.id, {
  records: [
    // Updated records
  ],
});

Delete Custom Preset

await client.domains.presets.delete(preset.id);

Rollback Preset

If something goes wrong, rollback to previous state:

// Get preset application history
const history = await client.domains.dns.getHistory('example.com');
 
// Rollback to previous state
await client.domains.dns.rollback('example.com', {
  snapshotId: history[1].id, // Previous snapshot
});

Preset Validation

Presets validate compatibility before application:

try {
  await client.domains.dns.applyPreset('example.com', {
    preset: 'GOOGLE_WORKSPACE',
  });
} catch (error) {
  if (error.code === 'PRESET_CONFLICT') {
    console.log('Conflicts found:');
    for (const conflict of error.details.conflicts) {
      console.log(`  ${conflict.type} ${conflict.name}: ${conflict.reason}`);
    }
  }
}

Next Steps