Skip to main content
POST
/
api
/
sending-domains
Create Sending Domain
curl --request POST \
  --url https://api.embedreach.com/api/sending-domains \
  --header 'Content-Type: application/json' \
  --data '
{
  "apexDomain": "<string>",
  "subdomain": "<string>",
  "userPart": "<string>",
  "emailFromName": "<string>",
  "emailReplyTo": "<string>",
  "makeDefaultWhenVerified": true
}
'
import requests

url = "https://api.embedreach.com/api/sending-domains"

payload = {
"apexDomain": "<string>",
"subdomain": "<string>",
"userPart": "<string>",
"emailFromName": "<string>",
"emailReplyTo": "<string>",
"makeDefaultWhenVerified": True
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
apexDomain: '<string>',
subdomain: '<string>',
userPart: '<string>',
emailFromName: '<string>',
emailReplyTo: '<string>',
makeDefaultWhenVerified: true
})
};

fetch('https://api.embedreach.com/api/sending-domains', 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://api.embedreach.com/api/sending-domains",
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([
'apexDomain' => '<string>',
'subdomain' => '<string>',
'userPart' => '<string>',
'emailFromName' => '<string>',
'emailReplyTo' => '<string>',
'makeDefaultWhenVerified' => true
]),
CURLOPT_HTTPHEADER => [
"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://api.embedreach.com/api/sending-domains"

payload := strings.NewReader("{\n \"apexDomain\": \"<string>\",\n \"subdomain\": \"<string>\",\n \"userPart\": \"<string>\",\n \"emailFromName\": \"<string>\",\n \"emailReplyTo\": \"<string>\",\n \"makeDefaultWhenVerified\": true\n}")

req, _ := http.NewRequest("POST", url, payload)

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://api.embedreach.com/api/sending-domains")
.header("Content-Type", "application/json")
.body("{\n \"apexDomain\": \"<string>\",\n \"subdomain\": \"<string>\",\n \"userPart\": \"<string>\",\n \"emailFromName\": \"<string>\",\n \"emailReplyTo\": \"<string>\",\n \"makeDefaultWhenVerified\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.embedreach.com/api/sending-domains")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"apexDomain\": \"<string>\",\n \"subdomain\": \"<string>\",\n \"userPart\": \"<string>\",\n \"emailFromName\": \"<string>\",\n \"emailReplyTo\": \"<string>\",\n \"makeDefaultWhenVerified\": true\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "message": "<string>",
  "data": {
    "id": "<string>",
    "dnsRecords": [
      {
        "host": "<string>",
        "value": "<string>",
        "ttl": 123
      }
    ]
  }
}
{
"message": "<string>",
"success": false,
"errors": [
"<string>"
]
}

Headers

reach-tenant-id
string

If using a platform scoped JWT, you can pass in a header to impersonate a specific tenant to impersonate the request as.

Body

application/json
apexDomain
string
required

The apex domain the tenant owns (e.g. acme.com)

subdomain
string
required

The subdomain label mail will send from (e.g. send)

userPart
string
required

The local-part mail sends from (e.g. hello)

Required string length: 1 - 64
Pattern: ^[A-Za-z0-9!#$%&'*+\/=?^_`\{\|\}~\-]+(?:\.[A-Za-z0-9!#$%&'*+\/=?^_`\{\|\}~\-]+)*$
emailFromName
string
required

The display name shown in the recipient inbox (e.g. Acme Landscaping)

Minimum string length: 1
emailReplyTo
string
required

The reply-to email address for sent mail

Pattern: ^[^\s@]+@[^\s@]+\.[^\s@]+$
makeDefaultWhenVerified
boolean

Once verified, make this domain's sender the business default and re-point live sends. Defaults to true for BYO domains when omitted.

Response

Status 201 response

success
boolean
required
message
string
data
object