curl --request POST \
--url https://app.base44.com/api/apps/{app_id}/custom-email-domains/replace \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--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 = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', '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 => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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("Authorization", "Bearer <token>")
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("Authorization", "Bearer <token>")
.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["Authorization"] = 'Bearer <token>'
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 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--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 = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', '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 => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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("Authorization", "Bearer <token>")
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("Authorization", "Bearer <token>")
.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["Authorization"] = 'Bearer <token>'
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 access token, sent as Authorization: Bearer <token>. Each operation lists the permission it needs: read_only or full_access. A full-access token can call every operation. A read-only token can call only the operations that list read_only; anything else returns 403 read_only_credential_route_not_allowed.
Scopes
Headers
Body
Request to replace email domain with a new one.
Response
The new domain's setup started. The old one keeps sending until it verifies.
Response for replacing email domain.
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"
Was this page helpful?