Service accounts
A service account is a principal that belongs to an organization rather than to a person. Use one for automation that should outlive whoever set it up: a hub, a pipeline, a long-running agent. Its tokens keep working when the owner or admin who minted them leaves the org or is demoted.
A service account is written {org}/{name}, for example acme/hub-x. Its name
follows the same naming rules as a graph (formerly called a repo) and is unique among the org’s service
accounts. A service account and a graph may share a name; every command
that takes a service account says so.
What a service account is
Section titled “What a service account is”- It can’t sign in. It has no login and no email anyone can use. It acts only through the personal access tokens minted for it.
- It isn’t a person in the org. It never appears among the org’s members, and nobody can invite it or add it as a member.
- It holds a role in its org,
vieweroreditor, never owner or admin. That role, together with any grants the account has been given, is the most any of its tokens can do. The limit is live: demote the account or revoke one of its grants, and its tokens lose that access at their next request. - It belongs to one org. It can’t be invited into another org.
- Two permissions govern it, both on its org and both granted by
org:configure:org:service-accounts-manageto create, list, view, re-role, disable, enable and delete it, andorg:service-accounts-mintto mint, list, view and revoke its tokens. Owners and admins holdorg:configurethrough their role; a member whose scope override grantsorg:configureon the org holds both too. A personal access token needsorg:configureon that org as well, since a token never exceeds the member it acts for.
Create one
Section titled “Create one”wh org service-account create acme hub-x --role viewer -d "Hub X reader"wh org service-account list acmewh org service-account view acme hub-xThe role is required; nothing defaults to editor. In the TypeScript SDK the
same operations are client.org.serviceAccounts.create|list|get|setRole|disable|enable|delete,
each taking a plain object such as { orgName: 'acme', name: 'hub-x' }. In
the Python SDK they are client.org.service_accounts.create|list|get|set_role|disable|enable|delete,
each taking keyword arguments such as org_name='acme', name='hub-x'.
Mint its tokens
Section titled “Mint its tokens”Add --service-account to the usual wh token verbs:
wh token create --service-account acme/hub-x --name hub-x-toolset \ --scope acme/markets=repo:read --expires 90dwh token list --service-account acme/hub-xwh token get --service-account acme/hub-x --name hub-x-toolsetwh token revoke --service-account acme/hub-x --name hub-x-toolset--scope(or--scopes-json) is required, and every scope names a resource: the org (acme=repo:read) or a graph (acme/markets=repo:read). A service account’s token never silently gets the account’s whole role.- The scopes you request must be within both the service account’s access and your own. An admin whose access is narrowed can’t mint past it; if your access to any graph in the org is narrowed, scope the token per graph rather than org-wide.
- Graphs in another org work differently. If the account has a grant on one, you can mint a token for it even though your own access doesn’t reach that graph: the account’s grant sets the limit there instead. The token’s restrictions must fit inside that grant, as described in Graphs you reach through a grant. If you mint with a personal access token rather than a signed-in session, the service-account token also can’t exceed that personal access token.
- Expiry limits are the same as for any token: 30 days by default, 365 at most.
--committer-identityfollows the usual identity-use rules, with the service account as the owner, so it can bind the account’s own Identity.getandlistshow who minted each token. Listing and revoking work while the account is disabled, so you can clean up.
In the TypeScript SDK, pass serviceAccount: 'acme/hub-x' to
client.token.create, { serviceAccount } as the second argument to
client.token.get and client.token.revoke, and list with
client.token.listForServiceAccount('acme/hub-x'). In the Python SDK, include
"serviceAccount": "acme/hub-x" in the mapping passed to client.token.create,
pass service_account='acme/hub-x' to client.token.get and
client.token.revoke, and list with
client.token.list_for_service_account('acme/hub-x').
A token minted for a service account can mint shorter-lived child tokens with
the plain wh token create, as any token can. A child is bounded by its
parent and is revoked with it.
Its Identity
Section titled “Its Identity”By default, writes made with a service account’s tokens show the service account in history, not the person who minted the token. WarmHub creates a public Identity for the account automatically — the same way it creates one for a person when they first sign in. That Identity is what appears in attribution: graph history, audit records, and anywhere else a write is traced back to its author.
To see which Identity a token writes as, run wh doctor (look for the
Identity: line) or call client.auth.whoami() in the SDK. Both show the
account’s public identity as it appears on writes. For the underlying details
of how Identities and wrefs work, see the identity
docs.
- Disabling or deleting the account leaves its Identity in place, so earlier writes still show who made them.
- The Identity’s display name is derived from the account’s unique identifier,
visible in the output of
wh org service-account view. The account’s org and name are not published on it.
Lifecycle
Section titled “Lifecycle”| Action | Effect on its tokens |
|---|---|
wh org service-account set-role acme hub-x --role editor | Widen or narrow at the next request |
wh org service-account disable acme hub-x | Rejected until the account is enabled |
wh org service-account enable acme hub-x | Work again |
wh org service-account delete acme hub-x | Revoked |
| Archive the org | Every service account in it is disabled |
| Unarchive the org | Accounts stay disabled until someone with org:service-accounts-manage enables each one |
Deleting a service account keeps its history: commits and token records still point at it. The name becomes free for a new service account, which gets a new unique identifier and inherits nothing from the old one, including its tokens.
In an archived org you can still list, view and delete service accounts, and list or revoke their tokens. Creating, enabling, disabling, changing a role and minting are refused.
Follow changes with webhooks
Section titled “Follow changes with webhooks”Owners and admins can subscribe an org webhook to service-account changes:
wh sub create sa-audit --org acme --event org.service_account_created \ --webhook-url https://example.com/hooks/warmhubThe events are org.service_account_created, org.service_account_role_changed,
org.service_account_disabled (also sent once per account when the org is
archived), org.service_account_enabled and org.service_account_deleted.
Creating a service account does not send org.member_added. See
organization activity subscriptions
for the payload.