Skip to content

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.

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.

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.

A preview key belongs to a project, and creates previews:

const key = yield* Convex.PreviewDeployKey("Previews", { project });

Use it with the Convex CLI:

Terminal window
CONVEX_DEPLOY_KEY=... pnpm convex deploy --preview-create my-branch

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.