Docs Menu

Docs HomeAtlas App Services

Realm CLI

On this page

  • Overview
  • Installation
  • Authentication
  • Generate an API Key
  • Authenticate with an API Key
  • Options
  • Commands

The Atlas App Services Command Line Interface (realm-cli) allows you to programmatically manage your App Services Apps. With realm-cli, you can create or update Apps from a local directory as well as export existing applications to a local directory.


Check your CLI version

This page is a quickstart for version 2 of realm-cli. If you need documentation for version 1 of realm-cli, see: Realm CLI v1. To check your CLI version, use: realm-cli --version. To upgrade your global install to the latest version, use: npm upgrade -g mongodb-realm-cli.

Realm CLI is available on npm. To install version 2 of the Realm CLI on your system, ensure that you have Node.js installed and then run the following command in your shell:

npm install -g mongodb-realm-cli

To use the Realm CLI, you must authenticate. To authenticate, you must generate an API Key.


The MongoDB Cloud Access Manager allows you to manage access to your project for users, teams, and API Keys. Use the Project Access Manager by clicking the Project Access tab on the access manager dropdown on your screen's top left-hand side.

Click Access Manager
click to enlarge

Project Users can log in using the Realm CLI tool with a Project API Key. Create a project API Key by clicking the grey Create API Key button on the right-hand side of the Project Access Manager.

Click Access Manager
click to enlarge

Clicking this button navigates you to the "Create API Key" screen. Set a description for your key.

For write access, the CLI requires an API key with "Project Owner" permissions. For read-only access, you can use "Project Read Only". Use the Project Permissions dropdown to select the appropriate permissions for your use case.

Click next to continue configuring your key details.

Click Access Manager
click to enlarge

Copy your Public and Private keys to a safe location for later use. For security, the Private Key will not be visible again after initialization. Another security feature is the API Access List. Creating an API Access List entry ensures that API calls originate from permitted IPs.

The IP Address of the user who will be using the API Key is required to use the key. Click the Add Access List Entry button. Type in the IP Address or click the Use Current IP Address button and click save. Finally, click the done button on your screen's lower right-hand to finish setting up your API key.

Click Access Manager
click to enlarge

Using your newly created public and private key, log in by running the command below.

realm-cli login --api-key="<my api key>" --private-api-key="<my private api key>"

You should see the following result:

you have successfully logged in as <your public key>

Use "realm-cli [command] --help" for information on a specific command

Specify your profile (Default value: "default") (default "default")
Enable/Disable CLI usage tracking for your current profile (Default value: "on"; Allowed values: "on", "off")
-o, --output-target
Write CLI output to the specified filepath
-f, --output-format
Set the CLI output format (Default value: <blank>; Allowed values: <blank>, "json")
Disable all CLI output styling (e.g. colors, font styles, etc.)
-y, --yes
Automatically proceed through CLI commands by agreeing to any required user prompts
-h, --help
help for realm-cli
←  realm-cli accessList →
Share Feedback
© 2023 MongoDB, Inc.


  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2023 MongoDB, Inc.