curl --request POST \
--url https://api.sendpost.io/api/v1/account/subaccount/ \
--header 'Content-Type: application/json' \
--header 'X-Account-ApiKey: <api-key>' \
--data '
{
"name": "Marketing - Production"
}
'import requests
url = "https://api.sendpost.io/api/v1/account/subaccount/"
payload = { "name": "Marketing - Production" }
headers = {
"X-Account-ApiKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Account-ApiKey': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Marketing - Production'})
};
fetch('https://api.sendpost.io/api/v1/account/subaccount/', 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/account/subaccount/",
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' => 'Marketing - Production'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Account-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/account/subaccount/"
payload := strings.NewReader("{\n \"name\": \"Marketing - Production\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Account-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/account/subaccount/")
.header("X-Account-ApiKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Marketing - Production\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sendpost.io/api/v1/account/subaccount/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Account-ApiKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Marketing - Production\"\n}"
response = http.request(request)
puts response.read_body{
"id": 50441,
"accountId": 4021,
"name": "Transactional - Production",
"apiKey": "pR0YIuxYSbVwmQi2Y8Qs",
"type": 1,
"isPlus": false,
"labels": [],
"blocked": false,
"created": 1704067200000000000
}Create Sub-Account
Create a new sub-account to segment your email sending. Each sub-account gets its own API key, suppression list, and statistics.
What You Get:
- Unique
X-SubAccount-ApiKeyfor authentication - Isolated email statistics
- Separate suppression management
- Independent domain configuration
- Optional SMTP credentials
Naming Best Practices:
- Use descriptive names:
Transactional_Orders,Marketing_Newsletter - Include environment:
Production_Alerts,Staging_Tests - For multi-tenant:
Client_CompanyName
Use Cases:
- New application or microservice needing email
- Onboarding a new client in multi-tenant setup
- Creating isolated testing environment
- Separating email streams for analytics
curl --request POST \
--url https://api.sendpost.io/api/v1/account/subaccount/ \
--header 'Content-Type: application/json' \
--header 'X-Account-ApiKey: <api-key>' \
--data '
{
"name": "Marketing - Production"
}
'import requests
url = "https://api.sendpost.io/api/v1/account/subaccount/"
payload = { "name": "Marketing - Production" }
headers = {
"X-Account-ApiKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Account-ApiKey': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Marketing - Production'})
};
fetch('https://api.sendpost.io/api/v1/account/subaccount/', 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/account/subaccount/",
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' => 'Marketing - Production'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Account-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/account/subaccount/"
payload := strings.NewReader("{\n \"name\": \"Marketing - Production\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Account-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/account/subaccount/")
.header("X-Account-ApiKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Marketing - Production\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sendpost.io/api/v1/account/subaccount/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Account-ApiKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Marketing - Production\"\n}"
response = http.request(request)
puts response.read_body{
"id": 50441,
"accountId": 4021,
"name": "Transactional - Production",
"apiKey": "pR0YIuxYSbVwmQi2Y8Qs",
"type": 1,
"isPlus": false,
"labels": [],
"blocked": false,
"created": 1704067200000000000
}Authorizations
This api key can be used for all account level operations
Body
Request body for creating a new sub-account
Display name for the new sub-account. Must be unique within your account. Use descriptive names like "Marketing - Production" or "Customer: Acme Corp"
1 - 100"Marketing - Production"
Response
Sub-account created successfully with API key.
A sub-account represents an isolated sending environment within your main account.
Use cases for sub-accounts:
- Separate transactional vs marketing emails
- Multi-tenant applications (one sub-account per customer)
- Different products or business units
- Development, staging, and production environments
Each sub-account has:
- Its own API key for sending
- Separate domains and sender verification
- Independent suppression list
- Isolated statistics and reporting
Unique identifier for the sub-account
50441
Identifier of the parent account this sub-account belongs to
4021
Display name for the sub-account. Must be unique within your account. Use descriptive names.
100"Transactional - Production"
API key for this sub-account. Use this as the X-SubAccount-ApiKey header
when making API calls for this sub-account (sending emails, managing domains, etc.).
Security: Treat this like a password. Rotate if compromised.
"pR0YIuxYSbVwmQi2Y8Qs"
Type of sub-account:
0= Default (the primary sub-account created with your account)1= Custom (additional sub-accounts you create)
Note: The default sub-account cannot be deleted.
0, 1 1
Whether this sub-account belongs to a SendX Plus customer. SendX Plus is a premium tier that provides enhanced features and support.
false
Custom labels for organizing and filtering sub-accounts
Show child attributes
Show child attributes
Whether the sub-account is blocked from sending. A blocked sub-account cannot send emails. Common reasons:
- High bounce/spam rates
- Billing issues
- Policy violations
- Manual suspension by administrator
false
UNIX epoch timestamp in nanoseconds when the sub-account was created
1704067200000000000
Was this page helpful?