Node.js
import { MailChannels } from "mailchannels-sdk";
const { PARENT_API_KEY } = process.env;
if (!PARENT_API_KEY) throw new Error("Set PARENT_API_KEY (a parent-account API key) before running");
const mailchannels = new MailChannels(PARENT_API_KEY);
const { data, error } = await mailchannels.subAccounts.list();
if (error) {
console.error("List sub-accounts failed:", error);
process.exit(1);
}
console.log(data);import os
import sys
import mailchannels
parent_api_key = os.environ.get("PARENT_API_KEY")
if not parent_api_key:
sys.exit("Set PARENT_API_KEY (a parent-account API key) before running")
mailchannels.api_key = parent_api_key
# Retrieve all sub-accounts for the parent account.
response = mailchannels.SubAccounts.list()
print(response)<?php
require_once __DIR__ . '/vendor/autoload.php';
use MailChannels\Client;
$parent_api_key = getenv('PARENT_API_KEY') or exit("Error: PARENT_API_KEY is not set\n");
$client = new Client(apiKey: $parent_api_key);
$response = $client->subAccounts->list();
print_r($response->toArray());curl --request GET \
--url https://api.mailchannels.net/tx/v1/sub-account \
--header 'X-Api-Key: <x-api-key>'[
{
"enabled": true,
"handle": "<string>",
"company_name": "<string>"
}
]{
"errors": [
"<string>"
]
}Retrieve Sub-accounts
Retrieves all sub-accounts associated with the parent account. The response is paginated with a default limit of 1000 sub-accounts per page and an offset of 0.
GET
/
sub-account
Node.js
import { MailChannels } from "mailchannels-sdk";
const { PARENT_API_KEY } = process.env;
if (!PARENT_API_KEY) throw new Error("Set PARENT_API_KEY (a parent-account API key) before running");
const mailchannels = new MailChannels(PARENT_API_KEY);
const { data, error } = await mailchannels.subAccounts.list();
if (error) {
console.error("List sub-accounts failed:", error);
process.exit(1);
}
console.log(data);import os
import sys
import mailchannels
parent_api_key = os.environ.get("PARENT_API_KEY")
if not parent_api_key:
sys.exit("Set PARENT_API_KEY (a parent-account API key) before running")
mailchannels.api_key = parent_api_key
# Retrieve all sub-accounts for the parent account.
response = mailchannels.SubAccounts.list()
print(response)<?php
require_once __DIR__ . '/vendor/autoload.php';
use MailChannels\Client;
$parent_api_key = getenv('PARENT_API_KEY') or exit("Error: PARENT_API_KEY is not set\n");
$client = new Client(apiKey: $parent_api_key);
$response = $client->subAccounts->list();
print_r($response->toArray());curl --request GET \
--url https://api.mailchannels.net/tx/v1/sub-account \
--header 'X-Api-Key: <x-api-key>'[
{
"enabled": true,
"handle": "<string>",
"company_name": "<string>"
}
]{
"errors": [
"<string>"
]
}Headers
Query Parameters
The maximum number of sub-accounts to return. The default is 1000.
Required range:
1 <= x <= 1000The number of sub-accounts to skip before returning results. The default is 0.
Required range:
x >= 0Was this page helpful?

