curl --request POST \
--url https://app.base44.com/api/apps/{app_id}/custom-email-domains/replace \
--header 'Content-Type: application/json' \
--header 'api_key: <api-key>' \
--data '
{
"domain": "mail.example.com",
"sender_name": "Nordwind Furniture",
"from_email": "no-reply@mail.example.com"
}
'import requests
url = "https://app.base44.com/api/apps/{app_id}/custom-email-domains/replace"
payload = {
"domain": "mail.example.com",
"sender_name": "Nordwind Furniture",
"from_email": "no-reply@mail.example.com"
}
headers = {
"api_key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {api_key: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
domain: 'mail.example.com',
sender_name: 'Nordwind Furniture',
from_email: 'no-reply@mail.example.com'
})
};
fetch('https://app.base44.com/api/apps/{app_id}/custom-email-domains/replace', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.base44.com/api/apps/{app_id}/custom-email-domains/replace",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'domain' => 'mail.example.com',
'sender_name' => 'Nordwind Furniture',
'from_email' => 'no-reply@mail.example.com'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api_key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.base44.com/api/apps/{app_id}/custom-email-domains/replace"
payload := strings.NewReader("{\n \"domain\": \"mail.example.com\",\n \"sender_name\": \"Nordwind Furniture\",\n \"from_email\": \"no-reply@mail.example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api_key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.base44.com/api/apps/{app_id}/custom-email-domains/replace")
.header("api_key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"domain\": \"mail.example.com\",\n \"sender_name\": \"Nordwind Furniture\",\n \"from_email\": \"no-reply@mail.example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.base44.com/api/apps/{app_id}/custom-email-domains/replace")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api_key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"domain\": \"mail.example.com\",\n \"sender_name\": \"Nordwind Furniture\",\n \"from_email\": \"no-reply@mail.example.com\"\n}"
response = http.request(request)
puts response.read_body{
"domain": "mail.example.com",
"status": "pending_domain_verification",
"email_domain_id": "68b1c0d4e7b91d003c45a1f2",
"external": false,
"dns_records": [
{
"name": "em1234.mail.example.com",
"status": "pending",
"ttl": 300,
"type": "CNAME",
"value": "u1234567.wl123.sendgrid.net"
}
]
}Replace the email domain
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.
curl --request POST \
--url https://app.base44.com/api/apps/{app_id}/custom-email-domains/replace \
--header 'Content-Type: application/json' \
--header 'api_key: <api-key>' \
--data '
{
"domain": "mail.example.com",
"sender_name": "Nordwind Furniture",
"from_email": "no-reply@mail.example.com"
}
'import requests
url = "https://app.base44.com/api/apps/{app_id}/custom-email-domains/replace"
payload = {
"domain": "mail.example.com",
"sender_name": "Nordwind Furniture",
"from_email": "no-reply@mail.example.com"
}
headers = {
"api_key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {api_key: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
domain: 'mail.example.com',
sender_name: 'Nordwind Furniture',
from_email: 'no-reply@mail.example.com'
})
};
fetch('https://app.base44.com/api/apps/{app_id}/custom-email-domains/replace', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.base44.com/api/apps/{app_id}/custom-email-domains/replace",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'domain' => 'mail.example.com',
'sender_name' => 'Nordwind Furniture',
'from_email' => 'no-reply@mail.example.com'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api_key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.base44.com/api/apps/{app_id}/custom-email-domains/replace"
payload := strings.NewReader("{\n \"domain\": \"mail.example.com\",\n \"sender_name\": \"Nordwind Furniture\",\n \"from_email\": \"no-reply@mail.example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api_key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.base44.com/api/apps/{app_id}/custom-email-domains/replace")
.header("api_key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"domain\": \"mail.example.com\",\n \"sender_name\": \"Nordwind Furniture\",\n \"from_email\": \"no-reply@mail.example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.base44.com/api/apps/{app_id}/custom-email-domains/replace")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api_key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"domain\": \"mail.example.com\",\n \"sender_name\": \"Nordwind Furniture\",\n \"from_email\": \"no-reply@mail.example.com\"\n}"
response = http.request(request)
puts response.read_body{
"domain": "mail.example.com",
"status": "pending_domain_verification",
"email_domain_id": "68b1c0d4e7b91d003c45a1f2",
"external": false,
"dns_records": [
{
"name": "em1234.mail.example.com",
"status": "pending",
"ttl": 300,
"type": "CNAME",
"value": "u1234567.wl123.sendgrid.net"
}
]
}Authorizations
Personal API key.
Path Parameters
ID of the app whose email domains you want to work with.
Body
Request to replace email domain with a new one.
Domain to move to. It has to be connected to this app and different from the current one.
"mail.example.com"
Name recipients see in the From line.
"Nordwind Furniture"
Address mail is sent from once the new domain verifies.
"no-reply@mail.example.com"
Response
The new domain's setup started. The old one keeps sending until it verifies.
Response for replacing email domain.
The domain being moved to.
"mail.example.com"
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.
"pending_domain_verification"
ID of this app's email configuration. It identifies the configuration, not the individual domain.
"68b1c0d4e7b91d003c45a1f2"
Whether you brought the new domain yourself (true) or bought it through Base44 (false).
false
Records to publish for the new domain.
Show child attributes
Show child attributes
[
{
"name": "em1234.mail.example.com",
"status": "pending",
"ttl": 300,
"type": "CNAME",
"value": "u1234567.wl123.sendgrid.net"
}
]
Was this page helpful?