cURL
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
}Domain
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
POST
/
subaccount
/
domain
cURL
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
Body
application/json
Request body for adding a new sending domain
Response
201 - application/json
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.
Was this page helpful?