Domains
API reference for listing your sending domains and whether each one can send.
List sending domains#
GET/api/v1/domains
Your domains and whether each can send. Only a domain with can_send: true works in a From address.
Request
curl https://maillayer.com/api/v1/domains \ -H "Authorization: Bearer $MAILLAYER_KEY"
Response · 200
{
"data": [
{
"name": "mail.acme.com", "status": "verified", "can_send": true,
"tracking": {
"host": "links.mail.acme.com", "status": "active",
"record": { "type": "CNAME", "name": "links.mail.acme.com", "value": "links1.mllinks.com" },
"error": null
}
},
{ "name": "news.acme.com", "status": "pending", "can_send": false, "tracking": null }
]
}Set a tracking subdomain#
PATCH/api/v1/domains/:name
Campaign links and unsubscribe links from this domain use your own subdomain once it's active. Send null to remove it, which breaks links in emails already sent through it.
Body
tracking_subdomainstring | nullrequiredOne word, likelinks, forlinks.mail.acme.com. Add theCNAMErecord in the response;statusgoes frompendingtoactiveonce DNS and HTTPS are ready.
Request
curl -X PATCH https://maillayer.com/api/v1/domains/mail.acme.com \
-H "Authorization: Bearer $MAILLAYER_KEY" \
-H "Content-Type: application/json" \
-d '{ "tracking_subdomain": "links" }'Errors: 404 not_found, 422 invalid_tracking_subdomain (not one word, domain not verified, or already in use).
Add and verify domains in the dashboard; see Verify a sending domain.