Capabilities and API tokens
The word capability is used for two different things in Zaroz. They are related but not the same.
Service capabilities: what a service can do
Each service instance exposes a list of capabilities that its product offers and that its resources support: log_stream, metrics, files, source, deployments, environment, external_access, schedules, backups, custom_domain, and so on. The console builds its tabs from this list, and so can you:
curl
Code
TypeScript
Code
Python
Code
A product without deployments has no deployments tab and its deployments route answers 404. This is how one API serves a Minecraft server, a VPS and a Workload without special cases.
API tokens
There is one kind of customer API token: the organization API token. It carries a list of permissions, and a scope that says where they apply:
| Scope | Reaches |
|---|---|
| Whole organization | the permissions on everything the organization owns |
| One project | the permissions on the services and subscriptions of that project, and nothing else |
A token has no wildcard permissions and, by default, nothing: an empty list makes a token that can do nothing. Absence denies.
Rules that keep tokens safe:
- A token can never do more than the person or organization that made it can do right now: permissions are checked again on every request.
- You can only grant what you hold. The picker, and
GET /organizations/{id}/api-tokens/grantable-capabilities, show exactly what can go on a token for the lifetime and scope you chose. Staff-only permissions can never be put on it. - Every token expires: 1 to 365 days, 90 by default. There is no "never".
- A project token can only hold project-level permissions, and another project answers like a thing that does not exist.
- The secret is shown once and only its digest is stored. To change a token, Replace it: create the new one from the old one's settings, switch your integration, then revoke the old one. Revoke with
DELETE /organizations/{id}/api-tokens/{token_id}. membership_tiedtokens (the default) are revoked when the creator leaves;organization_ownedtokens outlive them.
Staff and resellers also have personal tokens, because their powers belong to a person. Customers do not.
The permissions that act on a service are named after the service:
| Permission | Allows |
|---|---|
services.read | every non-secret read of a service |
services.manage | change the service: environment, backups, files, firewall, and also everything services.deploy does |
services.deploy | CI deploys: set the source and create deployments, nothing else |
services.power | start, stop, restart |
services.console | logs stream, command console, SSH |
services.files.read | browse and download files |
services.external_access.manage | open and close public ports |
services.schedules.manage | schedules |
services.databases.read | browse attached databases |
For CI, see Deploy from CI: a project token with services.deploy. Code running inside a Workload should not use a token of yours at all: use a service principal. The full guide is Create and use an API token.
