Email API sub-accounts give each of your customers their own AhaSend account, with its own domains, API keys and sending. You see usage and cost for each customer through the API, and you pay one invoice.
A sub-account is a full AhaSend account under your parent account. Other providers call them subaccounts or subusers. Sub-accounts are for SaaS platforms, agencies, resellers, cloud and hosting providers and managed service providers that send email for their customers. Do you only send your own email? Then one account with several domains is the simpler fit.
Own domains and sending
Each customer gets their own sending domains and their own sending activity.
Own API keys
A sub-account's API key works on every regular API v2 endpoint: domains, messages, webhooks, routes and more.
Own webhooks and routes
Each customer has their own webhooks for email events and their own routes for inbound email.
Own members and suppressions
Each customer has their own team members and their own suppression list.
Usage and cost per customer
One API call gives you this billing period's message volume and allocated cost for your parent account and for each active sub-account. Use it to bill each customer for what they send.
Message volume per customer
See how many emails each sub-account sent in the current billing period, next to your parent account.
Allocated cost per customer
Each sub-account's cost is its share of your invoice, split by message volume. It is not what the customer would pay on a plan of its own.
Deliveries and bounces per customer
Each sub-account's own statistics show its delivered emails and its bounces.
One invoice
Every sub-account's emails count on your plan. You pay one invoice, with no charge per sub-account.
Removed sub-accounts in one total
Usage from sub-accounts you removed this period stays on your invoice and shows as one total.
Read it with a scoped key
A parent API key with the sub-accounts:usage scope can read usage and cost. See the usage endpoint in the docs.
Create the sub-account, then its first API key. The secret key is shown only once.
✓
Install dependencies
$ npm install @ahasend/sdk
import { AhaSendClient } from "@ahasend/sdk";// A parent API key with sub-accounts:write and sub-account-api-keys:writeconst parent = new AhaSendClient({ apiKey: process.env.AHASEND_API_KEY!, accountId: process.env.AHASEND_ACCOUNT_ID!,});// 1. Create the sub-accountconst child = await parent.subAccounts.create( { name: "Acme Subsidiary", website: "acme.example.com" }, { idempotencyKey: "subacct-20240101-acme" },);// 2. Create its first API key (the secret is shown only once)const key = await parent.subAccounts.apiKeys.create( child.id, { label: "Bootstrap key", scopes: ["domains:read", "domains:write", "messages:send:all"], }, { idempotencyKey: "child-bootstrap-key-20240101-acme" },);// 3. Use the new key with the sub-account's ID on the regular API v2 endpointsconst customer = new AhaSendClient({ apiKey: key.secret_key, accountId: child.id,});
Message volume per sub-account for the billing period
Allocated cost per sub-account, to bill each customer back
Usage of removed sub-accounts kept as one total
An optional monthly sending cap on each sub-account
Usage and cost through the API, with a scoped key
Where your data lives
Your customers' email stays in Europe
Message data is stored in the EU, in Germany and Finland, and AhaSend is ISO 27001 certified. If you process data for your own customers, our DPA makes AhaSend your sub-processor.
AhaSend does. One API call returns the message volume and the allocated cost of each sub-account for the current billing period. Each sub-account's own statistics also show its delivered emails and its bounces. So you get a cost for each customer, and you can bill them back.