Skip to main content
AhaSend CLI sub-account commands let Platform Partners manage child accounts and their API keys from a parent account.

Prerequisites

Use a full parent-account API key with the matching sub-account scopes: sub-accounts:read, sub-accounts:write, sub-accounts:delete, sub-accounts:suspend (also for unpause-domain) and sub-accounts:usage, and for keys sub-account-api-keys:read, sub-account-api-keys:write and sub-account-api-keys:delete. Sub-accounts are available to Platform Partners; contact sales about access. The shell examples need Bash and jq.

Create and Manage a Test Sub-Account

The examples that use $TEST_SUBACCOUNT_ID make one Bash script: this one, the first one in Manage a Test Sub-Account API Key and the one in Delete the Test Sub-Account. Save them in that order. The script stops if creation fails, and only updates or deletes the test account it creates. The other examples use placeholders: replace YOUR_RESOURCE_ID with a sub-account ID and YOUR_KEY_ID with the ID of one of its API keys.
--website takes a domain, such as example.com. An http or https URL also works: the command sends only its host, in lowercase. --output json prints the API’s response, so jq reads the new sub-account’s id from it. Usage allocated_cost is a proportional share of the parent’s pooled invoice, not standalone pricing. A monthly credit of 0 means no cap. suspend asks for confirmation unless you pass --force; a script needs it. pause is an alias of suspend, and resume and unpause are aliases of unsuspend. A suspension that AhaSend started can only be lifted by AhaSend support.

Manage a Test Sub-Account API Key

Continue with the sub-account created above. Store the one-time secret_key securely if an application needs it; this test keeps only the key ID.
subaccounts apikeys is an alias of subaccounts api-keys. A sub-account’s key cannot have the sub-accounts: or sub-account-api-keys: scopes; asking for one fails with exit code 4 before any request. A scope ending in {domain} takes one of the sub-account’s domains, such as messages:send:{example.com}. --scope and --ip-allow-list can be repeated, and each splits on commas. To limit a key to one network, or to allow it from any IP again:

Unpause a Sub-Account Domain

AhaSend pauses a domain, for example when too many of its recent emails bounced. To let a sub-account’s domain send again:
Unpausing a domain that is not paused changes nothing and prints the domain. A change can take some minutes to apply to new email.

Delete the Test Sub-Account

After the preceding create-first workflow, remove only its test account:
Deletion is a soft delete: the sub-account can no longer be used and leaves list results, but AhaSend keeps its historical data. Current billing-period usage still belongs to the parent invoice. Without --force, the command asks for confirmation; answer y or yes.

Command Flags

These flags come from the CLI’s --help. All commands also accept the global flags. List commands page as Lists and Pagination describes.

subaccounts api-keys create

The secret is shown once, in every output format, and cannot be read again. Within 5 minutes, a retry with the same idempotency key returns the original key with its secret.

subaccounts api-keys delete

subaccounts api-keys get

No command-specific flags. Table and plain output show the secret as [HIDDEN].

subaccounts api-keys list

subaccounts api-keys update

Give at least one flag. --scope replaces all scopes: to add one, list the existing scopes and the new one.

subaccounts create

subaccounts delete

subaccounts get

No command-specific flags.

subaccounts list

subaccounts suspend

Alias: pause.

subaccounts unpause-domain

No command-specific flags.

subaccounts unsuspend

Aliases: resume, unpause. No command-specific flags.

subaccounts update

Only the flags you give change, and at least one is needed. --monthly-credit 0 is sent as 0.

subaccounts usage

No command-specific flags.