Skip to content

🪪 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

Type declarations

ts
class SubAccounts {
  readonly apiKeys: SubAccountsApiKeys;
  readonly smtpPasswords: SubAccountsSmtpPasswords;
  readonly limits: SubAccountsLimits;
  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 getUsage (handle: string): Promise<SubAccountsUsageResponse>;
}
ts
class SubAccountsApiKeys {
  constructor (private mailchannels: MailChannelsClient);
  async create (handle: string): Promise<SubAccountsApiKeysCreateResponse>;
  async list (handle: string, options?: SubAccountsApiKeysListOptions): Promise<SubAccountsApiKeysListResponse>;
  async delete (handle: string, id: number): Promise<SuccessResponse>;
}
ts
class SubAccountsSmtpPasswords {
  constructor (private mailchannels: MailChannelsClient);
  async create (handle: string): Promise<SubAccountsSmtpPasswordsCreateResponse>;
  async list (handle: string): Promise<SubAccountsSmtpPasswordsListResponse>;
  async delete (handle: string, id: number): Promise<SuccessResponse>;
}
ts
class SubAccountsLimits {
  constructor (private mailchannels: MailChannelsClient);
  async get (handle: string): Promise<SubAccountsLimitsGetResponse>;
  async set (handle: string, options: SubAccountsLimitsSetOptions): Promise<SuccessResponse>;
  async delete (handle: string): Promise<SuccessResponse>;
}
All type declarations

Response type declarations

ts
interface ErrorResponse {
  message: string;
  statusCode: number | null;
  type: ErrorType;
  response: Record<string, unknown> | null;
}
ts
type DataResponse<T> = {
  data: T;
  error: null;
} | {
  data: null;
  error: ErrorResponse;
};
ts
interface SuccessResponse {
  success: boolean;
  error: ErrorResponse | null;
}

Sub-Accounts type declarations

ts
interface SubAccount {
  companyName: string;
  enabled: boolean;
  handle: string;
}
ts
type SubAccountsCreateResponse = DataResponse<SubAccount>;
ts
interface SubAccountsListOptions {
  limit?: number;
  offset?: number;
}
ts
type SubAccountsListResponse = DataResponse<SubAccount[]>;

Usage type declarations

ts
interface SubAccountsUsage {
  endDate?: string;
  startDate?: string;
  total: number;
  monthlyLimit: number;
}
ts
type SubAccountsUsageResponse = DataResponse<SubAccountsUsage>;

API Keys type declarations

ts
interface SubAccountsApiKey {
  id: number;
  key: string;
}
ts
type SubAccountsApiKeysCreateResponse = DataResponse<SubAccountsApiKey>;
ts
type SubAccountsApiKeysListResponse = DataResponse<SubAccountsApiKey[]>;

SMTP Passwords type declarations

ts
interface SubAccountsSmtpPassword {
  enabled: boolean;
  id: number;
  smtpPassword: string;
}
ts
type SubAccountsSmtpPasswordsCreateResponse = DataResponse<SubAccountsSmtpPassword>;
ts
type SubAccountsSmtpPasswordsListResponse = DataResponse<SubAccountsSmtpPassword[]>;

Limits type declaration

ts
interface SubAccountsLimit {
  sends: number;
}
ts
type SubAccountsLimitsGetResponse = DataResponse<SubAccountsLimit>;

Source

SourcePlaygroundDocsTests

Changelog

  • v1.3.0 on Jul 10, 2026

    • 527667b feat(sub-accounts): add monthly limit field to usage response
  • v1.1.0 on Jun 15, 2026

    • f2c3ef0 fix(sub-accounts): include missing query in API keys list request
    • 8aa0ebb refactor(types): rename sub-accounts types and deprecate aliases
    • 2638b9e refactor: subAccounts into sub-classes and deprecate methods
    • 5a34b8a fix: encode path params in all api requests
    • b2cf377 refactor: restructure modules into module directories
  • v1.0.0 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

Released under the MIT License.