Replace the email domain

<Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

Moves the app's email sending to a different domain it already owns.

A current domain that is already sending keeps sending until the new one verifies, so mail keeps going out while DNS propagates. A current domain that never finished setup isn't sending, and nothing sends until the new domain verifies. During the changeover List email domains returns both.

The new domain has the same requirements as Enable email sending for a domain. It has to be connected, ready, and different from the current one. Sending the domain already in use is rejected.

This works only when the app has exactly one email domain. A replacement that's still in flight leaves two, and this call is rejected until that clears. Base44 tries to remove the old domain once the new one verifies, but that doesn't happen on every path and can fail quietly. When a replacement is rejected, read List email domains and clear the extra domain with Disable email sending for a domain.

post/api/apps/{app_id}/custom-email-domains/replace

Path parameters

app_idstring required

ID of the app whose email domains you want to work with.

ID of the app whose email domains you want to work with.

Request body

domainstring required

Domain to move to. It has to be connected to this app and different from the current one.

sender_namestring required

Name recipients see in the From line.

from_emailstring email required

Address mail is sent from once the new domain verifies.

Example request

{
  "domain": "mail.example.com",
  "sender_name": "Nordwind Furniture",
  "from_email": "no-reply@mail.example.com"
}

Response

The new domain's setup started. The old one keeps sending until it verifies.

domainstring required

The domain being moved to.

statusstring required

Where the new domain's setup got to. Only active sends mail, and the old domain keeps sending until this reads it. The pending_ values mean setup is still in progress, and the failed_ values mean it stopped and you can start it again with Retry email domain setup.

email_domain_idstring required

ID of this app's email configuration. It identifies the configuration, not the individual domain.

externalboolean

Whether you brought the new domain yourself (true) or bought it through Base44 (false).

Example response

{
  "domain": "mail.example.com",
  "status": "pending_domain_verification",
  "email_domain_id": "68b1c0d4e7b91d003c45a1f2",
  "dns_records": [
    {
      "name": "em1234.mail.example.com",
      "status": "pending",
      "ttl": 300,
      "type": "CNAME",
      "value": "u1234567.wl123.sendgrid.net"
    }
  ]
}

Changes

No recorded changes to this endpoint across all 1 revision of this API.