Docs Menu
Docs Home
/ /
MongoDB Command Line Interface
/ / /

mongocli iam user invite

On this page

  • Permissions Required
  • Syntax
  • Options
  • Output
  • Example

The mongocli iam user invite command invites the specified users to join the specified organization or project. You can also invite users to:

The user must accept your invitation to join the project or organization.

The following tables shows the roles you must have to invite users to your MongoDB service organization or project:

MongoDB Service
Organization
Project

Atlas

Cloud Manager

Ops Manager

mongocli iam user invite
--country <country-code-of-user>
--email <email-address-of-user>
--firstName <first-name-of-user>
--lastName <last-name-of-user>
[ --mobile <mobile-number-of-user> ]
[ --orgRole <org-role-of-user> ]
[ --output|-o <output-format> ]
--password <password-of-user>
[ --profile|-P <profile-name> ]
[ projectRole <project-role-of-user> ]
--username <username-of-user>

Note

Use -h or --help to view the command-line help for this command.

Option
Type
Description
Required?
--country
string
  • yes for Atlas

  • yes for Cloud Manager

  • no for Ops Manager

--email
string
Email address of the user.
yes
--firstName
string
First name of the user.
yes
--lastName
string
Last name of the user.
yes
--mobile
string
Mobile telephone number of the user.
no
--orgRole
string

Name of the organization role to assign to the user. For the list of valid organization roles for your MongoDB service, see:

If omitted, user is granted the following role for your MongoDB service:

no
--output, -o
string

Command output format. Valid values are:

  • json for output in JSON format

  • go-template for custom output using the Go template

  • go-template-file for custom output specified using Go template file

If omitted, the command returns output in the default format.

no
--password
string
Password of the user.
yes
--profile, -P
string
Name of the profile that contains the access information. If omitted, uses the default profile.
no
--projectRole
string

Name of the project role to assign to the user. For the list of valid project roles for your MongoDB service, see:

If omitted, user is granted the following role for your MongoDB service:

no
--username
string
Username of the user. Value must be a valid email address.
yes

The command prints the following to the terminal if the command succeeds. If the command prints an error, see Troubleshooting for recommended solutions.

The user '<username>' has been invited.
Invited users do not have access to the project until they accept the invitation.

The above default output is a subset of the fields returned by this command. For the complete list of JSON fields returned by the command, see the API reference for your MongoDB service:

The following command invites a new user to an Ops Manager organization. It uses the default profile for accessing Ops Manager.

mongocli iam users invite --username john.doe@example.com --password changeMe --email john.doe@example.com --firstName john --lastName doe

The previous command prints the following in the default format to the terminal.

The user 'john.doe@example.com' has been invited.
Invited users do not have access to the project until they accept the
invitation.

The following command invites a new user to an Atlas organization. It uses the default profile for accessing Atlas.

mongocli iam users invite --username john.doe@example.com --password changeMe --email john.doe@example.com --firstName john --lastName doe --country US -o json

The previous command prints the following in the default format to the terminal.

{
"emailAddress": "john.doe@example.com",
"firstName": "john",
"id": "5f71e5255afec75a3d0f96dc",
"lastName": "doe",
"roles": [],
"username": "john.doe@example.com",
"mobileNumber": "",
"password": "",
"country": "US"
}

Back

Users