Docs Menu

Docs HomeAtlas Command Line Interface

Atlas CLI Environment Variables

On this page

  • Precedence
  • Supported Environment Variables

For easier scripting, you can specify configuration settings by using environment variables.

  • When you run any command, each setting that you specify with an environment variable takes precedence over the profile stored in the configuration file.

  • When you run a command using the --projectId option, the command line option takes precedence over both the environment variable and the profile stored in the configuration file.

Important

Atlas CLI supports both MongoDB CLI environment variables and Atlas CLI environment variables. You can use either MongoDB CLI environment variables or Atlas CLI environment variables, but not both together.

The Atlas CLI supports the following environment variables:

Variable
Description
MONGODB_ATLAS_PUBLIC_API_KEY
Sets the public API key for commands that interact with Atlas.
MONGODB_ATLAS_PRIVATE_API_KEY
Sets the private API key for commands that interact with Atlas.
MONGODB_ATLAS_ORG_ID
Sets the organization ID for commands that require the --orgId option.
MONGODB_ATLAS_PROJECT_ID
Sets the project ID for commands that require the --projectId option.
MONGODB_ATLAS_OUTPUT

Sets the output fields and format. Valid values are:

Value
Output Format
Empty
default
Human-readable output that includes all fields that the Atlas CLI returns.
json
JSON output that includes all fields that the Atlas CLI returns.
json-path
JSON output that includes the fields that you specify.
go-template
Custom-formatted output that includes the fields that you specify in a Go template.
MONGODB_ATLAS_MONGOSH_PATH
The full path on your local system to the MongoDB Shell, mongosh.
MONGODB_ATLAS_SKIP_UPDATE_CHECK
When set to yes, the Atlas CLI does not prompt you to update to new versions.
MONGODB_ATLAS_ACCESS_TOKEN
String that grants access to your Atlas account. The access token is valid for 12 hours.
MONGODB_ATLAS_REFRESH_TOKEN
String that allows Atlas to automatically request a new access token when the current access token expires.
←  Save Connection SettingsMigrate to the Atlas CLI →

Specify your version