Deploy keys
A deploy key lets a tool act on one deployment, limited to the actions you allow. A preview deploy key belongs to a project, and creates preview deployments in it.
my-appproject
Previewspreview deploy key
proddeployment
Cideploy key
- allows
- deployment:deploy
Convex.Functions makes its own short-lived key for each push, so you need Convex.DeployKey only for something that keeps a key, such as CI outside Alchemy.
Create a deploy key
Section titled “Create a deploy key”const key = yield* Convex.DeployKey("Deploy", { deployment: prod, allowedActions: ["deployment:deploy"],});key.value is Redacted. Convex shows a key only when it’s created, so Alchemy keeps it in state. Changing any prop replaces the key.
Create a preview key
Section titled “Create a preview key”A preview key belongs to a project, and creates previews:
const key = yield* Convex.PreviewDeployKey("Previews", { project });Use it with the Convex CLI:
CONVEX_DEPLOY_KEY=... pnpm convex deploy --preview-create my-branchCONVEX_DEPLOY_KEY=... bun convex deploy --preview-create my-branchCONVEX_DEPLOY_KEY=... npx convex deploy --preview-create my-branchCONVEX_DEPLOY_KEY=... yarn convex deploy --preview-create my-branchAdopt a key
Section titled “Adopt a key”Convex can’t show an existing key, so adopting one deletes it and creates a new one with the same name. Anything using the old value stops working.