Skip to content

Domains

Manage custom domains for receiving emails. Before you can receive emails on a domain, it must be verified via DNS TXT record and configured with MoMail’s MX records.

Retrieve all domains associated with your account.

GET /domains
{
"success": true,
"data": [
{
"domain_id": "dom_abc123",
"domain_name": "example.com",
"verified": true,
"mx_configured": true,
"created_at": "2024-01-15T10:30:00.000Z"
}
]
}
FieldTypeDescription
domain_idstringUnique identifier for the domain
domain_namestringThe registered domain name
verifiedbooleanWhether DNS verification is complete
mx_configuredbooleanWhether MX records are properly configured
created_atstringISO 8601 timestamp of domain creation

Register a new domain for email receiving.

POST /domains
{
"domain": "example.com"
}
FieldTypeRequiredDescription
domainstringYesValid domain name (1-253 characters)
{
"success": true,
"data": {
"domain_id": "dom_abc123",
"domain_name": "example.com",
"verification_token": "momail-verify=xyz789abc...",
"verified": false,
"mx_configured": false,
"created_at": "2024-01-15T10:30:00.000Z"
}
}

Retrieve details for a specific domain.

GET /domains/{id}
ParameterTypeRequiredDescription
idstringYesDomain UUID
{
"success": true,
"data": {
"domain_id": "dom_abc123",
"domain_name": "example.com",
"verification_instructions": {
"type": "TXT",
"name": "_momail",
"value": "momail-verify=xyz789abc..."
},
"verified": false,
"mx_configured": false,
"created_at": "2024-01-15T10:30:00.000Z"
}
}

Trigger DNS verification for a domain. MoMail checks for the TXT record and updates the domain status.

POST /domains/{id}/verify
ParameterTypeRequiredDescription
idstringYesDomain UUID
{
"success": true,
"data": {
"verified": true,
"mx_instructions": {
"host": "mx.momail.io",
"priority": 10
}
}
}
{
"success": false,
"error": {
"code": "VERIFICATION_FAILED",
"message": "TXT record not found or does not match verification token",
"details": {
"expected_txt_record": "momail-verify=xyz789abc...",
"instructions": "Add a TXT record to your DNS with the above value"
}
}
}

Remove a domain from your account.

DELETE /domains/{id}
ParameterTypeRequiredDescription
idstringYesDomain UUID
{
"success": true,
"data": {
"message": "Domain deleted successfully"
}
}

Add this TXT record to verify domain ownership:

TypeNameValue
TXT_momailmomail-verify={your_token}

After verification, add this MX record to receive emails:

TypeHostPriorityValue
MX@10mx.momail.io
Terminal window
# List domains
curl https://api.momail.io/v1/domains \
-H "X-API-Key: your_key"
# Create domain
curl -X POST https://api.momail.io/v1/domains \
-H "X-API-Key: your_key" \
-H "Content-Type: application/json" \
-d '{"domain": "example.com"}'
# Verify domain
curl -X POST https://api.momail.io/v1/domains/dom_abc123/verify \
-H "X-API-Key: your_key"
# Delete domain
curl -X DELETE https://api.momail.io/v1/domains/dom_abc123 \
-H "X-API-Key: your_key"