Setting up a custom sending domain is required for production email delivery. Ark handles DKIM key generation and SPF configuration — you add the DNS records and verify.
Step 1: Add Your Domain
Dashboard
Python
Node.js
Ruby
Go
cURL
Go to Domains in your Ark dashboard
Click Add Domain
Enter your domain name (e.g., mail.yourdomain.com)
Copy the DNS records shown
from ark import Ark
client = Ark()
domain = client.domains.create( name = "mail.yourdomain.com" )
print ( f "Domain ID: { domain.data.id } " )
print ( "DNS Records to configure:" )
spf = domain.data.dns_records.spf
print ( f " SPF: { spf.type } { spf.name } -> { spf.value } " )
dkim = domain.data.dns_records.dkim
print ( f " DKIM: { dkim.type } { dkim.name } -> { dkim.value } " )
rp = domain.data.dns_records.return_path
print ( f " Return Path: { rp.type } { rp.name } -> { rp.value } " )
import Ark from 'ark-email' ;
const client = new Ark ();
const domain = await client . domains . create ({
name: 'mail.yourdomain.com' ,
});
console . log ( `Domain ID: ${ domain . data . id } ` );
console . log ( 'DNS Records to configure:' );
const { spf , dkim , returnPath } = domain . data . dnsRecords ;
console . log ( ` SPF: ${ spf . type } ${ spf . name } -> ${ spf . value } ` );
console . log ( ` DKIM: ${ dkim . type } ${ dkim . name } -> ${ dkim . value } ` );
console . log ( ` Return Path: ${ returnPath . type } ${ returnPath . name } -> ${ returnPath . value } ` );
require "ark_email"
client = ArkEmail :: Client . new
domain = client. domains . create ( name: "mail.yourdomain.com" )
puts "Domain ID: #{ domain. data . id } "
puts "DNS Records to configure:"
spf = domain. data . dns_records . spf
puts " SPF: #{ spf. type } #{ spf. name } -> #{ spf. value } "
dkim = domain. data . dns_records . dkim
puts " DKIM: #{ dkim. type } #{ dkim. name } -> #{ dkim. value } "
rp = domain. data . dns_records . return_path
puts " Return Path: #{ rp. type } #{ rp. name } -> #{ rp. value } "
client := ark . NewClient ()
domain , err := client . Domains . Create ( ctx , ark . DomainCreateParams {
Name : ark . String ( "mail.yourdomain.com" ),
})
fmt . Printf ( "Domain ID: %s \n " , domain . Data . ID )
fmt . Println ( "DNS Records to configure:" )
spf := domain . Data . DNSRecords . SPF
fmt . Printf ( " SPF: %s %s -> %s \n " , spf . Type , spf . Name , spf . Value )
dkim := domain . Data . DNSRecords . DKIM
fmt . Printf ( " DKIM: %s %s -> %s \n " , dkim . Type , dkim . Name , dkim . Value )
rp := domain . Data . DNSRecords . ReturnPath
fmt . Printf ( " Return Path: %s %s -> %s \n " , rp . Type , rp . Name , rp . Value )
curl -X POST https://api.arkhq.io/v1/domains \
-H "Authorization: Bearer $ARK_API_KEY " \
-H "Content-Type: application/json" \
-d '{"name": "mail.yourdomain.com"}'
Understanding the response:
zone — The DNS zone where you’ll add records (your root domain)
name — The relative hostname to enter in your DNS provider (most providers auto-append the zone)
fullName — The complete FQDN for reference
value — The record value to copy
For a root domain like yourdomain.com, the SPF name would be @ (representing the apex).
Add three records to your DNS provider. Most providers auto-append your domain, so use the name field (not fullName).
SPF Record
Field Value Type TXTName Use name from API (e.g., mail for subdomains, @ for root) Value v=spf1 a mx include:spf.arkhq.io ~allTTL 3600 (or Auto)
Already have an SPF record? Edit your existing one — only one SPF record is allowed per domain. Add include:spf.arkhq.io to it.Example: v=spf1 include:spf.arkhq.io include:_spf.google.com ~all
DKIM Record
Field Value Type TXTName Use name from API (e.g., ark-abc123._domainkey.mail) Value The DKIM value from the API response (starts with k=rsa;t=s;p=...) TTL 3600 (or Auto)
Return Path (CNAME)
Field Value Type CNAMEName Use name from API (e.g., psrp.mail) Value rp.arkhq.ioTTL 3600 (or Auto)
Step 3: Verify Your Domain
After adding DNS records, verify. Propagation usually takes a few minutes but can take up to 48 hours.
Dashboard
Python
Node.js
cURL
Go to Domains and click Verify DNS records on your domain. result = client.domains.verify( "dom_abc123" )
if result.data.verified:
print ( "Domain verified!" )
else :
records = result.data.dns_records
print ( f " SPF: { records.spf.status } " )
print ( f " DKIM: { records.dkim.status } " )
print ( f " Return Path: { records.return_path.status } " )
const result = await client . domains . verify ( 'dom_abc123' );
if ( result . data . verified ) {
console . log ( 'Domain verified!' );
} else {
const { spf , dkim , returnPath } = result . data . dnsRecords ;
console . log ( ` SPF: ${ spf . status } ` );
console . log ( ` DKIM: ${ dkim . status } ` );
console . log ( ` Return Path: ${ returnPath . status } ` );
}
curl -X POST https://api.arkhq.io/v1/domains/dom_abc123/verify \
-H "Authorization: Bearer $ARK_API_KEY "
Once all three records show status OK, you can send email from any address at your domain (e.g., hello@mail.yourdomain.com, support@mail.yourdomain.com).
Optional: DMARC Configuration
DMARC tells receiving servers how to handle emails that fail SPF or DKIM authentication.
Field Value Type TXTName _dmarc.mail (or _dmarc for root domain)Value v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com
Start with p=none to monitor, then move to p=quarantine or p=reject once you’re confident in your configuration.
Provider-Specific Guides
Troubleshooting
Check DNS propagation : Use dnschecker.org to verify records are visible globally
Check record values : Ensure you copied the exact values from the API response
Check record names : Use the name field, not fullName — most DNS providers auto-append your domain
Wait and retry : DNS can take up to 48 hours to propagate fully
You can only have one SPF record per domain
If you have multiple email services, combine them: v=spf1 include:spf.arkhq.io include:_spf.google.com ~all
SPF has a 10 DNS lookup limit. Use SPF checker tools to verify
For subdomains like mail.yourdomain.com:
SPF name: mail (not @)
DKIM name: ark-xyz._domainkey.mail
Return Path name: psrp.mail
For root domains like yourdomain.com:
SPF name: @
DKIM name: ark-xyz._domainkey
Return Path name: psrp
Next Steps