curl -X POST "https://api.sendpost.io/api/v1/subaccount/domain" \
-H "accept: application/json" \
-H "X-SubAccount-ApiKey: <subaccount_api_key>" \
-d '{"name": "example.com"}'import requests
url = "https://api.sendpost.io/api/v1/subaccount/domain"
headers = {
"accept": "application/json",
"X-SubAccount-ApiKey": "<subaccount_api_key>"
}
data = {"name": "example.com"}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const options = {
method: 'POST',
headers: {'X-SubAccount-ApiKey': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'piedpiper.com'})
};
fetch('https://api.sendpost.io/api/v1/subaccount/domain', 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.sendpost.io/api/v1/subaccount/domain",
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([
'name' => 'piedpiper.com'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-SubAccount-ApiKey: <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://api.sendpost.io/api/v1/subaccount/domain"
payload := strings.NewReader("{\n \"name\": \"piedpiper.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-SubAccount-ApiKey", "<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://api.sendpost.io/api/v1/subaccount/domain")
.header("X-SubAccount-ApiKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"piedpiper.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sendpost.io/api/v1/subaccount/domain")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-SubAccount-ApiKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"piedpiper.com\"\n}"
response = http.request(request)
puts response.read_body{
"id": 117,
"name": "piedpiper.com",
"dkim": {
"host": "sp-dkim._domainkey.piedpiper.com",
"type": "TXT",
"textValue": "v=DKIM1;k=rsa;p=MIGfMA0GCSqGSIb3D..."
},
"returnPath": {
"host": "sp-bounces.piedpiper.com",
"type": "CNAME",
"textValue": "sp.sendpost.email"
},
"track": {
"host": "track.piedpiper.com",
"type": "CNAME",
"textValue": "api.sendpost.io"
},
"dmarc": {
"host": "_dmarc.piedpiper.com",
"type": "TXT",
"textValue": "v=DMARC1; p=quarantine; rua=mailto:dmarc@piedpiper.com"
},
"dkimVerified": true,
"dmarcVerified": true,
"returnPathVerified": true,
"trackVerified": true,
"verified": true,
"domainRegisteredDate": "2014-04-12",
"created": 1704067200000000000
}Create Domain
Register a new sending domain with SendPost. After creation, you’ll receive DNS records that must be configured with your DNS provider before you can send emails.
Domain Setup Process:
- Call this endpoint with your domain name
- Copy the returned DNS records (DKIM, Return-Path, Track, DMARC)
- Add records to your DNS provider (GoDaddy, Cloudflare, Route53, etc.)
- Wait for DNS propagation (typically 15 minutes to 48 hours)
- Verification happens automatically, or trigger manual verification
DNS Records Explained:
| Record | Purpose | Required |
|---|---|---|
| DKIM | Cryptographically signs emails to prove authenticity | Yes |
| Return-Path | Routes bounce notifications through SendPost | Recommended |
| Track | Enables click tracking with your domain | Optional |
| DMARC | Adds additional authentication layer | Recommended |
Best Practices:
- Use a subdomain like
mail.yourdomain.comfor sending - Keep your root domain for your website
- Configure all records for best deliverability
curl -X POST "https://api.sendpost.io/api/v1/subaccount/domain" \
-H "accept: application/json" \
-H "X-SubAccount-ApiKey: <subaccount_api_key>" \
-d '{"name": "example.com"}'import requests
url = "https://api.sendpost.io/api/v1/subaccount/domain"
headers = {
"accept": "application/json",
"X-SubAccount-ApiKey": "<subaccount_api_key>"
}
data = {"name": "example.com"}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const options = {
method: 'POST',
headers: {'X-SubAccount-ApiKey': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'piedpiper.com'})
};
fetch('https://api.sendpost.io/api/v1/subaccount/domain', 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.sendpost.io/api/v1/subaccount/domain",
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([
'name' => 'piedpiper.com'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-SubAccount-ApiKey: <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://api.sendpost.io/api/v1/subaccount/domain"
payload := strings.NewReader("{\n \"name\": \"piedpiper.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-SubAccount-ApiKey", "<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://api.sendpost.io/api/v1/subaccount/domain")
.header("X-SubAccount-ApiKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"piedpiper.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sendpost.io/api/v1/subaccount/domain")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-SubAccount-ApiKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"piedpiper.com\"\n}"
response = http.request(request)
puts response.read_body{
"id": 117,
"name": "piedpiper.com",
"dkim": {
"host": "sp-dkim._domainkey.piedpiper.com",
"type": "TXT",
"textValue": "v=DKIM1;k=rsa;p=MIGfMA0GCSqGSIb3D..."
},
"returnPath": {
"host": "sp-bounces.piedpiper.com",
"type": "CNAME",
"textValue": "sp.sendpost.email"
},
"track": {
"host": "track.piedpiper.com",
"type": "CNAME",
"textValue": "api.sendpost.io"
},
"dmarc": {
"host": "_dmarc.piedpiper.com",
"type": "TXT",
"textValue": "v=DMARC1; p=quarantine; rua=mailto:dmarc@piedpiper.com"
},
"dkimVerified": true,
"dmarcVerified": true,
"returnPathVerified": true,
"trackVerified": true,
"verified": true,
"domainRegisteredDate": "2014-04-12",
"created": 1704067200000000000
}Authorizations
This api key can be used only for sub account level operations
Body
Request body for adding a new sending domain
The domain name to add for sending emails. Must be a valid domain you own and can configure DNS records for. Example: piedpiper.com (not subdomain like mail.piedpiper.com)
^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9](?:\.[a-zA-Z]{2,})+$"piedpiper.com"
Response
Successful response
A sending domain configured for email delivery. Domains must be verified via DNS records before they can be used for sending. SendPost requires DKIM authentication and recommends configuring Return-Path, DMARC, and tracking records for optimal deliverability.
Unique identifier for the domain
117
The domain name (e.g., "example.com"). This is the domain portion of your sending email addresses.
"piedpiper.com"
Auto-detected DNS provider for this domain (e.g. "cloudflare", "other"), used to tailor DNS-setup instructions. Read-only.
"cloudflare"
DKIM (DomainKeys Identified Mail) DNS record configuration. DKIM cryptographically signs your emails to verify they haven't been tampered with. This is REQUIRED for sending emails.
Show child attributes
Show child attributes
Return-Path (bounce handling) DNS record configuration. Configuring this allows bounce notifications to be properly routed through SendPost. RECOMMENDED for better deliverability.
Show child attributes
Show child attributes
Tracking domain DNS record configuration. When configured, click tracking links use your domain instead of SendPost's domain. RECOMMENDED for brand consistency and improved click-through rates.
Show child attributes
Show child attributes
DMARC (Domain-based Message Authentication, Reporting & Conformance) DNS record. DMARC builds on DKIM and SPF to provide email authentication and reporting. RECOMMENDED for enterprise senders.
Show child attributes
Show child attributes
Whether the DKIM DNS record has been verified successfully
true
Whether the DMARC DNS record has been verified successfully
false
Whether the Return-Path DNS record has been verified successfully
true
Whether the tracking domain DNS record has been verified successfully
true
Overall verification status. True only if DKIM is verified (minimum requirement). For full verification, configure all DNS records.
true
Date when this domain was originally registered (from WHOIS). Newer domains may have lower sender reputation initially.
"1995-08-14"
UNIX epoch timestamp in nanoseconds when the domain was added to SendPost
1704067200000000000
Detailed reason if DKIM verification failed (empty if verified or not attempted)
"DNS record not found. Please add the TXT record to your DNS provider."
Detailed reason if DMARC verification failed
""
Detailed reason if tracking domain verification failed
""
Detailed reason if Return-Path verification failed
""
Was this page helpful?