Skip to content

Configure the CLI

The CLI authenticates with Nextmv Cloud through profiles. There are two authentication types:

  • PKCE (recommended): No permanent secret is stored locally. Uses a browser-based login flow.
  • API key: Uses a long-lived API key stored in your configuration.

Alternatively, you can run the configuration wizard with the nextmv configuration create command, and it will guide you through configuring your CLI.

nextmv configuration create

Configure with PKCE

To configure the CLI with PKCE run the following command:

nextmv configuration create --auth-type pkce

Then log in through your browser with the nextmv auth login command:

nextmv auth login

The token will get refreshed automatically until a fresh login is required. CLI will prompt you to log in again when necessary.

You are not required to log out, but you may use the nextmv auth logout command to log out of your account at any time.

nextmv auth logout

Please note that after logging out, you don't need to create the configuration for PKCE again, but you do need to log in again with the nextmv auth login command.

Configure with an API key

To configure the CLI with an API key run the following command:

nextmv configuration create --api-key "<YOUR_NEXTMV_API_KEY>"

You can also use the NEXTMV_API_KEY environment variable to override the API key that is stored in the configuration. When both the NEXTMV_API_KEY environment variable and a profile is specified with the --profile option, the environment variable takes precedence.

Profiles

Create a profile

When configuring through PKCE or an API key, you can store the configuration under a profile. To achieve this, pass the --profile option when using the nextmv configuration create command with a name for your profile. When a profile is not specified, it is saved under the default profile.

For example, to create a profile named dashing-rabbit, you may run the following command according to the configuration type you are creating:

nextmv configuration create --auth-type pkce --profile dashing-rabbit
nextmv configuration create --api-key "<YOUR_NEXTMV_API_KEY>" --profile dashing-rabit

List profiles

You may list all profiles, and their corresponding configuration, with the nextmv configuration list command:

nextmv configuration list
┏━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓
 Profile name    Type     Session  API Key   Endpoint            ┡━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩
 Default         api_key          89****31  api.cloud.nextmv.io ├────────────────┼─────────┼─────────┼──────────┼─────────────────────┤
 bunny-p         api_key          nx****94  api.cloud.nextmv.io  foo             api_key          ***       api.cloud.nextmv.io  off-sims-teams  api_key          0a****6d  api.cloud.nextmv.io  pkce            pkce     default  Not set   api.cloud.nextmv.io  prod1           api_key          nx****23  api.cloud.nextmv.io  staging         api_key          dd****d2  api.cloud.nextmv.io └────────────────┴─────────┴─────────┴──────────┴─────────────────────┘

Use a profile

To use a profile, simply pass the --profile option with the name of your saved profile to any command that supports profiles. Here are two examples for creating and pushing applications.

nextmv cloud app create --app-id "<YOUR_APP_ID>" --profile dashing-rabbit
nextmv cloud app push --app-id "<YOUR_APP_ID>" --profile dashing-rabbit

You can use the NEXTMV_PROFILE environment variable to select a stored profile. The environment variable will override the --profile option, if both are present.

Delete a profile

To delete a profile, use the nextmv configuration delete command specifying the profile you intend to delete.

nextmv configuration delete --profile dashing-rabbit

Behind a proxy

If you're behind a corporate proxy or TLS-inspecting firewall, use the --system-certs flag to trust your operating system's certificate store.

Install with system certs:

uv tool install --system-certs nextmv

Create any profile type with system certs (works for both PKCE and API key):

nextmv configuration create --system-certs

When writing Python scripts that use the Nextmv Python SDK behind a proxy:

export NEXTMV_SYSTEM_CERTS=true