Teams, tokens and zones
Everything in Better Stack lives in a team: monitors, heartbeats, schedules, status pages, sources, dashboards, error-tracking applications and Cloud servers. Teams belong to your organization, and a team’s id, such as t123, is in Better Stack’s URLs.
- global tokenreaches →acme
- Cloud tokenreaches →Cloud
A token decides what Alchemy can reach
Section titled “A token decides what Alchemy can reach”A global API token, from Global tokens, works with every product. When it can reach several teams, set the team id in your profile (or teamId on a resource) to say which one.
A team API token, from Team-based tokens, works only with the product it was created for (Better Stack’s provider docs):
| Token | Reaches | Namespaces here |
|---|---|---|
| Incidents | uptime monitoring, on-call, status pages, team members and roles | Incidents |
| Telemetry | sources, collectors, dashboards, metrics and error tracking | Telemetry, Errors |
| Cloud | servers, networking, storage, managed services and Kubernetes | Cloud |
| Global | everything above, plus teams | all five, including Account |
A team token used for another product’s resource is refused with a 401, though the token itself is valid. A profile holds one token, so a Stack that declares a server and the monitor that checks it needs a global token.
Sign in with a profile
Section titled “Sign in with a profile”Store the token in a profile:
bun alchemy profile edit --add BetterStackpnpm alchemy profile edit --add BetterStacknpx alchemy profile edit --add BetterStackSee Setup for every field.
One profile per team
Section titled “One profile per team”The stage decides what is deployed; the profile decides where it goes. Give production its own team and its own token, in its own profile:
bun alchemy profile create prodbun alchemy profile edit --profile prod --add BetterStackbun alchemy deploy --stage prod --profile prodpnpm alchemy profile create prodpnpm alchemy profile edit --profile prod --add BetterStackpnpm alchemy deploy --stage prod --profile prodnpx alchemy profile create prodnpx alchemy profile edit --profile prod --add BetterStacknpx alchemy deploy --stage prod --profile prodMany stages can share the development team, each with its own resources.
Team and zone on a resource
Section titled “Team and zone on a resource”The profile’s team and zone are defaults. A resource can name its own; changing either replaces it:
export const Health = BetterStack.Incidents.Monitor("Health", { url: "https://api.example.com/health", monitorType: "status", teamId: "t123",});Cloud resources live in one availability zone, such as us-west-2a, and each zone has its own API host (us-west-2a.betterstackcloud.com). Alchemy records the zone a resource was created in and always addresses it there, whatever the profile says later.
export const Box = BetterStack.Cloud.Server("Box", { serverType: "AM1", image: "ubuntu-26-04", availabilityZone: "us-west-2a",});Access narrower than yours
Section titled “Access narrower than yours”Better Stack has no IAM and no API to create scoped tokens, so a running Service gets the narrowest credential each product has:
| A Service binds | It receives | What it can do |
|---|---|---|
a Telemetry.Source |
the source’s ingest token and host | write into that one source |
an Incidents.Heartbeat |
the heartbeat’s secret URL | ping that one heartbeat |
an Errors.Application |
the application’s DSN | report events into that one application |
Anything that calls the management API from a running Service (incidents, queries, releases) takes an API token you pass explicitly, never your deploy credentials. Prefer a team token of the right product over a global one. See Watching your services.
With CI=true, Alchemy reads BETTERSTACK_API_TOKEN, and optionally BETTERSTACK_TEAM_ID and BETTERSTACK_AVAILABILITY_ZONE, from the environment instead of a profile. See CI and Secrets.