🪪 Sub-Accounts module Email API
Manage your sub-accounts associated with your MailChannels account.
IMPORTANT
Sub-accounts are only available to parent accounts on 100K and higher plans.
Methods
- Create Sub-account
- List Sub-accounts
- Delete Sub-account
- Suspend Sub-account
- Activate Sub-account
- Create API Key
- Delete API Key
- List API Keys
- Create SMTP Password
- List SMTP Passwords
- Delete SMTP Password
- Get Limit
- Set Limit
- Delete Limit
- Get Usage
Type declarations
ts
class SubAccounts {
constructor (protected mailchannels: MailChannelsClient);
async create (companyName: string, handle?: string): Promise<SubAccountsCreateResponse>;
async list (options?: SubAccountsListOptions): Promise<SubAccountsListResponse>;
async delete (handle: string): Promise<SuccessResponse>;
async suspend (handle: string): Promise<SuccessResponse>;
async activate (handle: string): Promise<SuccessResponse>;
async createApiKey (handle: string): Promise<SubAccountsCreateApiKeyResponse>;
async listApiKeys (handle: string, options?: SubAccountsListApiKeyOptions): Promise<SubAccountsListApiKeyResponse>;
async deleteApiKey (handle: string, id: number): Promise<SuccessResponse>;
async createSmtpPassword (handle: string): Promise<SubAccountsCreateSmtpPasswordResponse>;
async listSmtpPasswords (handle: string): Promise<SubAccountsListSmtpPasswordResponse>;
async deleteSmtpPassword (handle: string, id: number): Promise<SuccessResponse>;
async getLimit (handle: string): Promise<SubAccountsLimitResponse>;
async setLimit (handle: string, limit: SubAccountsLimit): Promise<SuccessResponse>;
async deleteLimit (handle: string): Promise<SuccessResponse>;
async getUsage (handle: string): Promise<SubAccountsUsageResponse>;
}All type declarations
Response type declarations
ts
interface ErrorResponse {
message: string;
statusCode: number | null;
type: ErrorType;
}ts
type DataResponse<T> = {
data: T;
error: null;
} | {
data: null;
error: ErrorResponse;
};ts
interface SuccessResponse {
success: boolean;
error: ErrorResponse | null;
}Account type declarations
ts
interface SubAccountsAccount {
companyName: string;
enabled: boolean;
handle: string;
}ts
type SubAccountsCreateResponse = DataResponse<SubAccountsAccount>;ts
interface SubAccountsListOptions {
limit?: number;
offset?: number;
}ts
type SubAccountsListResponse = DataResponse<SubAccountsAccount[]>;API Key type declarations
ts
interface SubAccountsApiKey {
id: number;
key: string;
}ts
type SubAccountsCreateApiKeyResponse = DataResponse<SubAccountsApiKey>;ts
type SubAccountsListApiKeyResponse = DataResponse<SubAccountsApiKey[]>;SMTP Password type declarations
ts
interface SubAccountsSmtpPassword {
enabled: boolean;
id: number;
smtpPassword: string;
}ts
type SubAccountsCreateSmtpPasswordResponse = DataResponse<SubAccountsSmtpPassword>;ts
type SubAccountsListSmtpPasswordResponse = DataResponse<SubAccountsSmtpPassword[]>;Limit type declaration
ts
interface SubAccountsLimit {
sends: number;
}ts
type SubAccountsLimitResponse = DataResponse<SubAccountsLimit>;Usage type declarations
ts
interface SubAccountsUsage {
endDate?: string;
startDate?: string;
total: number;
}ts
type SubAccountsUsageResponse = DataResponse<SubAccountsUsage>;Source
Source • Playground • Docs • Tests
Changelog
Unreleased on May 26, 2026
f49c49f— feat(errors): introduce error type keys
v0.8.0 on May 23, 2026
ab66dc1— refactor: split internal utils into focused modules