Zaroz
Zaroz Cloud v2 concepts

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

TerminalCode
curl -sS "$ZAROZ_API/service-instances/$SERVICE/capabilities" -H "$AUTH"

TypeScript

TypeScriptCode
const { body: caps } = await call("GET", `/service-instances/${SERVICE}/capabilities`); console.log(caps.map((c: any) => c.capability)); // e.g. ["log_stream", "metrics", "source", "deployments"]

Python

Code
_, caps = call("GET", f"/service-instances/{SERVICE}/capabilities") print([c["capability"] for c in caps]) # e.g. ["log_stream", "metrics", "source", "deployments"]

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:

ScopeReaches
Whole organizationthe permissions on everything the organization owns
One projectthe 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_tied tokens (the default) are revoked when the creator leaves; organization_owned tokens 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:

PermissionAllows
services.readevery non-secret read of a service
services.managechange the service: environment, backups, files, firewall, and also everything services.deploy does
services.deployCI deploys: set the source and create deployments, nothing else
services.powerstart, stop, restart
services.consolelogs stream, command console, SSH
services.files.readbrowse and download files
services.external_access.manageopen and close public ports
services.schedules.manageschedules
services.databases.readbrowse 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.

Last modified on