List method 🪪 Sub-Accounts
Retrieves all sub-accounts associated with the parent account.
Usage
ts
import { MailChannelsClient, SubAccounts } from 'mailchannels-sdk'
const mailchannels = new MailChannelsClient('your-api-key')
const subAccounts = new SubAccounts(mailchannels)
const { data, error } = await subAccounts.list()ts
import { MailChannels } from 'mailchannels-sdk'
const mailchannels = new MailChannels('your-api-key')
const { data, error } = await mailchannels.subAccounts.list()Params
optionsSubAccountsListOptionsoptional: List sub-accounts options.limitnumberoptional: The number of sub-accounts to return. Possible values are 1 to 1000.offsetnumberoptional: The offset number to start returning sub-accounts from.
TIP
If no options are provided, the default limit is
1000and the offset is0.
Response
dataSubAccountsAccount[] | nullnullablecompanyNamestringguaranteed: The name of the company associated with the sub-account.enabledbooleanguaranteed: If the sub-account is enabled.handlestringguaranteed: The handle for the sub-account.
errorErrorResponse | nullnullable: Error information if the operation failed.messagestringguaranteed: A human-readable description of the error.statusCodenumber | nullnullable: The HTTP status code from the API, ornullif the error is not related to an HTTP request. This field is intended for diagnostic use only and should not be relied upon.typestringguaranteed: A string identifier for the type of error. This field is intended for diagnostic use only and should not be relied upon.
Type declarations
Signature
ts
async function list (options?: SubAccountsListOptions): Promise<SubAccountsListResponse>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;
};Account type declarations
ts
interface SubAccountsAccount {
companyName: string;
enabled: boolean;
handle: string;
}ts
interface SubAccountsListOptions {
limit?: number;
offset?: number;
}ts
type SubAccountsListResponse = DataResponse<SubAccountsAccount[]>;Source
Source • Playground • Docs • Tests