Skip to main content
POST
/
account
/
subaccount
/
Create Sub-Account
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": "FoxHole"
}
'
import requests

url = "https://api.sendpost.io/api/v1/account/subaccount/"

payload = { "name": "FoxHole" }
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: 'FoxHole'})
};

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' => 'FoxHole'
]),
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\": \"FoxHole\"\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\": \"FoxHole\"\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\": \"FoxHole\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": 50441,
  "apiKey": "pR0YIuxYSbVwmQi2Y8Qs",
  "name": "API",
  "labels": [],
  "smtpAuths": [
    {
      "id": 117,
      "username": "default@117.sendpost.io",
      "password": "default@117.sendpost.io",
      "created": 1567512491588004000,
      "updated": 1567512491588004000
    }
  ],
  "type": 1,
  "isPlus": false,
  "created": 1733844681120384500,
  "created_by": {
    "id": 117,
    "isVerified": true,
    "isForbidden": false,
    "firebaseUID": "1234567890",
    "email": "raj@piedpiper.com",
    "name": "Raj",
    "url": "https://www.sendpost.io/logo.png",
    "companyName": "SendPost",
    "onboardQAnswered": true,
    "phoneNumber": "+919876543210",
    "notesColor": "#000000",
    "created": 1567512491588004000
  },
  "updated_by": {
    "id": 117,
    "isVerified": true,
    "isForbidden": false,
    "firebaseUID": "1234567890",
    "email": "raj@piedpiper.com",
    "name": "Raj",
    "url": "https://www.sendpost.io/logo.png",
    "companyName": "SendPost",
    "onboardQAnswered": true,
    "phoneNumber": "+919876543210",
    "notesColor": "#000000",
    "created": 1567512491588004000
  },
  "blocked": false,
  "blocked_at": 0,
  "block_reason": "",
  "hb_exempt": false,
  "generate_weekly_report": false,
  "handlers": []
}

Authorizations

X-Account-ApiKey
string
header
required

This api key can be used for all account level operations

Body

application/json
name
string

Name for the new sub-account.

Example:

"FoxHole"

Response

Sub-account successfully created.

id
integer

Unique ID for the sub-account.

Example:

50441

apiKey
string

API key for the sub-account.

Example:

"pR0YIuxYSbVwmQi2Y8Qs"

name
string

Name of the sub-account.

Example:

"API"

labels
string[]

Labels associated with the sub-account

Example:
[]
smtpAuths
object[]

SMTP Auths associated with the sub-account

type
enum<integer>

Type of the sub-account

Available options:
0,
1
Example:

1

isPlus
boolean

Indicates whether the sub-account is a Plus sub-account

Example:

false

created
integer

UNIX epoch nano timestamp when the sub-account was created.

Example:

1733844681120384500

created_by
object | null

Member who created the sub-account

updated_by
object | null

Member who updated the sub-account

blocked
boolean

Indicates whether the sub-account is blocked

Example:

false

blocked_at
integer

UNIX epoch nano timestamp when the sub-account was blocked (0 if not blocked)

Example:

0

block_reason
string

Reason for blocking the sub-account

Example:

""

hb_exempt
boolean

Indicates whether the sub-account is exempt from hard bounce tracking

Example:

false

generate_weekly_report
boolean

Indicates whether weekly reports are generated for this sub-account

Example:

false

handlers
string[]

Handlers associated with the sub-account

Example:
[]