Teams and tokens
Everything you create on Convex belongs to a team: its projects, their deployments, and the people who are members. The team has one plan and one bill, and nothing in one team can see another.
A team access token acts on the whole team. Narrower keys act on less: a deploy key on one deployment, a preview deploy key on one project’s previews.
Sign in with a profile
Section titled “Sign in with a profile”Alchemy reaches a team through a profile. Create a team access token in your team’s settings, then add Convex to your default profile and paste it:
pnpm alchemy profile edit --add Convexbun alchemy profile edit --add Convexnpx alchemy profile edit --add Convexyarn alchemy profile edit --add ConvexLeave the team ID blank: Alchemy reads it from the token. A token belongs to the person who created it, so Convex recommends creating it as a service account for anything shared, like CI.
See Setup.
Use one profile per team
Section titled “Use one profile per team”A stage decides what you deploy. A profile decides where. Give production its own team, with its own profile:
pnpm alchemy profile create prodpnpm alchemy profile edit --profile prod --add Convexpnpm alchemy deploy --stage prod --profile prodbun alchemy profile create prodbun alchemy profile edit --profile prod --add Convexbun alchemy deploy --stage prod --profile prodnpx alchemy profile create prodnpx alchemy profile edit --profile prod --add Convexnpx alchemy deploy --stage prod --profile prodyarn alchemy profile create prodyarn alchemy profile edit --profile prod --add Convexyarn alchemy deploy --stage prod --profile prodMany stages can share one team. Each gets its own preview deployment.
Access narrower than yours
Section titled “Access narrower than yours”Convex.Functions never pushes with your token. Each push creates a deploy key that may only push and manage environment variables, expires after two hours, and is deleted when the push ends.
Bindings that read a deployment’s data, usage or audit log from a Worker or Lambda get a deploy key too, limited to that one read. The bindings that run public functions need no key at all.
For anything else that needs to act on a deployment, declare a key with only the actions it needs:
const key = yield* Convex.DeployKey("Ci", { deployment, allowedActions: ["deployment:deploy"],});See Deploy keys.
When CONVEX_ACCESS_TOKEN is set, Alchemy signs in with it instead of a profile. In CI (CI=true) there are no profiles, so set it there. CONVEX_TEAM_ID is optional: a team token belongs to one team, so setting it only checks that the token is for the team you expect. See CI.
Values your functions read, like an API key, are covered in Environment variables.