Quickstart
Register and configure a domain in 5 minutes.
Installation
TypeScript:
npm install @usetransactional/nodePython:
pip install usetransactionalInitialize the Client
TypeScript:
import { Transactional } from '@usetransactional/node';
const client = new Transactional({
apiKey: process.env.TRANSACTIONAL_API_KEY,
});Python:
from usetransactional import Transactional
client = Transactional(api_key="your_api_key")Step 1: Search for Available Domains
TypeScript:
const results = await client.domains.search('mycompany');
console.log('Available domains:');
for (const domain of results.available) {
console.log(`${domain.domain} - $${domain.price}/year`);
}
// Check specific domain
const availability = await client.domains.checkAvailability('mycompany.com');
console.log('Available:', availability.available);
console.log('Price:', availability.price);Python:
results = client.domains.search("mycompany")
print("Available domains:")
for domain in results.available:
print(f"{domain.domain} - ${domain.price}/year")
# Check specific domain
availability = client.domains.check_availability("mycompany.com")
print(f"Available: {availability.available}")
print(f"Price: {availability.price}")Step 2: Register the Domain
TypeScript:
const domain = await client.domains.register({
domainName: 'mycompany.com',
years: 1, // Registration period
// Registrant contact
registrant: {
firstName: 'John',
lastName: 'Doe',
organization: 'My Company Inc.',
email: 'john@example.com',
phone: '+1.4155551234',
address: '123 Main Street',
city: 'San Francisco',
state: 'CA',
postalCode: '94102',
country: 'US',
},
// Options
whoisPrivacy: true,
autoRenew: true,
});
console.log('Domain registered!');
console.log('Expires:', domain.expiresAt);Python:
domain = client.domains.register(
domain_name="mycompany.com",
years=1,
registrant={
"firstName": "John",
"lastName": "Doe",
"organization": "My Company Inc.",
"email": "john@example.com",
"phone": "+1.4155551234",
"address": "123 Main Street",
"city": "San Francisco",
"state": "CA",
"postalCode": "94102",
"country": "US",
},
whois_privacy=True,
auto_renew=True,
)
print("Domain registered!")
print(f"Expires: {domain.expires_at}")Step 3: Configure DNS
Add Basic Records
TypeScript:
// Point domain to your server
await client.domains.dns.create('mycompany.com', {
type: 'A',
name: '@', // Root domain
value: '203.0.113.1',
ttl: 3600,
});
// Add www subdomain
await client.domains.dns.create('mycompany.com', {
type: 'CNAME',
name: 'www',
value: 'mycompany.com',
ttl: 3600,
});
console.log('DNS records created!');Python:
# Point domain to your server
client.domains.dns.create(
"mycompany.com",
type="A",
name="@",
value="203.0.113.1",
ttl=3600,
)
# Add www subdomain
client.domains.dns.create(
"mycompany.com",
type="CNAME",
name="www",
value="mycompany.com",
ttl=3600,
)
print("DNS records created!")Use DNS Preset for Email
TypeScript:
// Apply Transactional Email preset
await client.domains.dns.applyPreset('mycompany.com', {
preset: 'TRANSACTIONAL_EMAIL',
});
// This automatically creates:
// - MX records for inbound email
// - SPF record for sending authentication
// - DKIM records for message signing
// - DMARC record for policyStep 4: Verify DNS Configuration
TypeScript:
const records = await client.domains.dns.list('mycompany.com');
console.log('DNS Records:');
for (const record of records) {
console.log(`${record.type} ${record.name} → ${record.value}`);
}
// Verify email configuration
const verification = await client.domains.verifyEmail('mycompany.com');
console.log('SPF:', verification.spf.valid ? 'Valid' : 'Invalid');
console.log('DKIM:', verification.dkim.valid ? 'Valid' : 'Invalid');
console.log('DMARC:', verification.dmarc.valid ? 'Valid' : 'Invalid');Step 5: Set Up Webhooks (Optional)
Get notified of domain events:
TypeScript:
const webhook = await client.domains.webhooks.create({
url: 'https://yourapp.com/webhooks/domains',
events: [
'domain.registered',
'domain.expiring_soon',
'domain.renewed',
'dns.changed',
],
});
console.log('Webhook created');Complete Example
TypeScript:
import { Transactional } from '@usetransactional/node';
const client = new Transactional({
apiKey: process.env.TRANSACTIONAL_API_KEY,
});
async function setupDomain() {
const domainName = 'mycompany.com';
// 1. Check availability
const availability = await client.domains.checkAvailability(domainName);
if (!availability.available) {
console.log('Domain not available');
return;
}
// 2. Register domain
const domain = await client.domains.register({
domainName,
years: 2,
registrant: {
firstName: 'John',
lastName: 'Doe',
email: 'john@example.com',
phone: '+1.4155551234',
address: '123 Main Street',
city: 'San Francisco',
state: 'CA',
postalCode: '94102',
country: 'US',
},
whoisPrivacy: true,
autoRenew: true,
});
console.log('Domain registered:', domain.domainName);
// 3. Configure DNS for website
await client.domains.dns.create(domainName, {
type: 'A',
name: '@',
value: '203.0.113.1',
});
await client.domains.dns.create(domainName, {
type: 'CNAME',
name: 'www',
value: domainName,
});
// 4. Configure for email
await client.domains.dns.applyPreset(domainName, {
preset: 'TRANSACTIONAL_EMAIL',
});
// 5. List all records
const records = await client.domains.dns.list(domainName);
console.log('\nDNS Records:');
records.forEach(r => console.log(` ${r.type} ${r.name}: ${r.value}`));
// 6. Get domain info
const info = await client.domains.get(domainName);
console.log('\nDomain Info:');
console.log(' Status:', info.status);
console.log(' Expires:', info.expiresAt);
console.log(' Auto-renew:', info.autoRenew);
console.log(' WHOIS Privacy:', info.whoisPrivacy);
}
setupDomain();What's Next?
Your domain is now registered and configured. Here's what you can do:
- Send emails - Use the domain with Transactional Email
- Add more DNS records - Configure additional services
- Enable DNSSEC - Add cryptographic security
- Monitor expiration - Set up renewal reminders
Next Steps
- DNS Management - Advanced DNS configuration
- DNS Presets - Quick setup templates
- Email Integration - Use with email sending