npx convex deployment
Manage deployments in your project.
Usage
npx convex deployment [options] [command]
Subcommands
npx convex deployment select— Select the deployment to use when running commandsnpx convex deployment create— Create a new deployment for a projectnpx convex deployment token— Manage access tokens
npx convex deployment select
Select the deployment to use when running commands.
The deployment will be used by all npx convex commands, except npx convex deploy. You can also run individual commands on another deployment by using the --deployment flag on that command.
- Select your personal cloud dev deployment in the current project:
npx convex deployment select dev - Select your local deployment:
npx convex deployment select local - Select a deployment in the same project by its reference:
npx convex deployment select dev/james - Select a deployment in another project in the same team:
npx convex deployment select some-project:dev/james - Select a deployment in a particular team/project:
npx convex deployment select some-team:some-project:dev/james
Usage
npx convex deployment select [options] <deployment>
Arguments
<deployment>The deployment to use
npx convex deployment create
Create a new deployment for a project.
- Create a dev deployment and select it:
npx convex deployment create dev/my-new-feature --type dev --select - Create a prod deployment named “staging”:
npx convex deployment create staging --type prod
Usage
npx convex deployment create [options] [reference]
Arguments
[reference]The reference for the new deployment, e.g.
stagingordev/my-feature. Uselocalto create a local deployment. You can specify a team and project withteam-slug:project-slug:ref(e.g.my-team:my-project:stagingormy-team:my-project:local). Can be omitted when using--default.
Options
--type <type>Deployment type
--region <region>Deployment region
--selectSelect the new deployment. This will update the Convex environment variables in .env.local. Subsequent
npx convexcommands will run against this deployment.--defaultMake the new deployment your default production deployment (used by
npx convex deploy) or your personal dev deployment.--expiration <value>When the deployment expires (e.g. "none", "in 7 days", "2026-04-01T00:00:00Z", or a UNIX timestamp in seconds or milliseconds)
npx convex deployment token
Create and delete access tokens. Currently supports deploy keys.
Usage
npx convex deployment token [options] [command]
npx convex deployment token create
Creates a deploy key that, when set as CONVEX_DEPLOY_KEY, scopes all commands to the target deployment.
- Print a new deploy key to stdout:
npx convex deployment token create my-token - Save a new deploy key in
.env.local:npx convex deployment token create my-token --save-env - Save a new deploy key in a custom env file:
npx convex deployment token create ci-token --save-env .env.production - Create a key for the project's prod:
npx convex deployment token create ci-token --deployment prod
Usage
npx convex deployment token create [options] <name>
Arguments
<name>Name for the new deploy key
Options
--save-env [path]Save the new key as CONVEX_DEPLOY_KEY in an env file instead of printing it. Defaults to .env.local.
--prodCreate a deploy key for this project's default production deployment.
--deployment <deployment>Create a deploy key for a specific deployment. Accepts:
- a deployment name (e.g. joyful-capybara-123)
- a deployment reference (e.g. dev/james, staging)
dev(for your personal dev deployment)prod(for your project’s default production deployment)local(for your local dev deployment). You can also select deployments in other projects withproject-slug:referenceorteam-slug:project-slug:reference.
npx convex deployment token delete
Delete an access token. Currently only deploy keys (deployment-scoped access tokens) are supported.
The positional <nameOrToken> can be the unique name of the deploy key (as passed to token create) or the deploy key value itself. The target deployment defaults to the currently-selected one; pass --deployment to target a different deployment.
- Delete by name:
npx convex deployment token delete my-token - Delete by value:
npx convex deployment token delete 'dev:happy-animal-123|ey...' - Target prod:
npx convex deployment token delete ci-token --deployment prod
Usage
npx convex deployment token delete [options] <nameOrToken>
Arguments
<nameOrToken>The unique name of the deploy key, or the deploy key value itself.
Options
--prodDelete a deploy key for this project's default production deployment.
--deployment <deployment>Delete a deploy key for a specific deployment. Accepts:
- a deployment name (e.g. joyful-capybara-123)
- a deployment reference (e.g. dev/james, staging)
dev(for your personal dev deployment)prod(for your project’s default production deployment)local(for your local dev deployment). You can also select deployments in other projects withproject-slug:referenceorteam-slug:project-slug:reference.