How a sub-account works
- Its own keys and results. A sub-account key submits and reads tasks, batches and
monitors like any other key, and sees only its own work. A task created with Acme’s key
returns
404to Globex’s key and to your own keys. - Your credits. Its tasks are charged to your balance. A sub-account has no balance, so its
keys get
403 SUB_ACCOUNT_FORBIDDENfromGET /v1/creditsandGET /v1/usage. - Your capacity. Your plan’s or contract’s concurrency limit covers your own tasks and
every sub-account’s together, so sub-accounts never add capacity.
GET /v1/async/statuscounts that shared queue for you, and a sub-account’s key gets403 SUB_ACCOUNT_FORBIDDENfrom it. - Your monitor limits. The
monitorslimit inGET /v1/monitors/capabilitiescounts your monitors and every sub-account’s together, and thepromptsandtasksPerRunlimits apply to a sub-account’s monitors as they do to yours. - Its own limits.
monthlyCreditLimitcaps what it can be charged in a UTC calendar month.concurrencyLimitcaps its queued and running tasks inside your limit. Both are optional. - One level. A sub-account cannot have sub-accounts. Alert emails for its monitors go to your account’s admins.
Who can manage sub-accounts
Call the/v1/sub-accounts endpoints with one of your own API keys that has no engine scope
and no daily credit limit. Any other key gets 403 SUB_ACCOUNT_FORBIDDEN, because a
restricted key could otherwise issue keys without its own restrictions. A sub-account’s own
keys get the same error.
Create a sub-account and a key
201:
Any other field returns
400 VALIDATION_ERROR, so a misspelled limit never leaves a
customer uncapped.
Then issue the sub-account a key:
name (1–64 characters, default
default), allowedTaskTypes, dailyCreditLimit and expiresAt (5 minutes to 2 years
ahead). Send no body for a key with no restrictions.
A sub-account can hold up to 5 active keys; revoked and expired keys do not count. A sixth
returns 409 KEY_LIMIT. Revoke one first.
Your customer’s key works on every endpoint like any other key:
Manage keys
GET /v1/sub-accounts/{id}/keys lists every key the sub-account has had, newest first,
including revoked and expired ones. Check revokedAt and expiresAt to find the active
keys.
DELETE /v1/sub-accounts/{id}/keys/{keyId} revokes a key and returns
{"success": true, "data": {"revoked": "<keyId>"}}. A key that is already revoked, or not
the sub-account’s, returns 404 NOT_FOUND.
Limits
Only the sub-account that reached its own limit is refused; your other customers keep
running. A raised limit applies to the next request.
retryAfterSec counts to the start of the next UTC month, when the monthly count starts
over. See Credits and limits for the account-wide limits.
Check a sub-account now
GET /v1/sub-accounts/{id} returns the sub-account with this month’s usage and
activeTasks, the number of its tasks queued or running right now. Compare it with
concurrencyLimit to see how close the customer is to its cap.
usage, credits and tasks are what was charged this
UTC month, and reservedCredits is held by tasks still running.
Usage and billing
Every charge also appears on your own billing ledger; these endpoints split it by customer. Failed tasks are never charged and never count. Credit amounts carry up to two decimals.GET /v1/sub-accountslists your sub-accounts, oldest first, each with this month’susage. Page withlimit(default 100, at most 1,000) and passnextCursorback ascursor.GET /v1/sub-accounts/usagetotals each sub-account over a range of UTC dates.GET /v1/sub-accounts/{id}/usagegives one sub-account’s charges per day and engine.
from and to as YYYY-MM-DD, inclusive. from defaults to the
first of the current UTC month and to to today; a range spans at most 366 days.
All sub-accounts
One sub-account
creditsandtasksat the top are the totals ofdays.dayshas one row per UTC date and engine that had a charge, ordered by date, thentaskType. Days without charges have no row.taskType: "OTHER"is a charge that is not a task, such as a monitor’s competitor read. It adds credits but notasks.
Suspend and resume
- Its keys return
401within five seconds. - Its monitors stop running, and batch items that have not started end as
API_KEY_INACTIVE. - Tasks already queued or running finish and are charged.
{"status": "active"} restores its keys and monitors. Each monitor runs once when it comes
back rather than catching up on missed runs. The same PATCH changes name, externalId,
monthlyCreditLimit and concurrencyLimit; null removes a limit or the externalId. A
sub-account cannot be deleted; suspend it instead.