Navigation

mongocli ops-manager agents apikey create

The agents apikey create command creates one agent API key for the specified Ops Manager project.

You must have GROUP_OWNER privileges for a project to create an agent API key for that project.

mongocli ops-manager|om agents apikey|apikeys create
-- desc <description of the agent API key>
[ --output|-o <output-format> ]
[ --profile|-P <profile-name> ]
[ --projectId <id-of-project> ]
Option
Type
Description
Required?
--desc
string
Description of the agent API key.
yes
--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 the Go template file

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

no
--profile, -P
string
Name of the profile where the public and private keys for the project are saved. If omitted, uses the default profile. To learn more about creating a profile, see Configure the MongoDB CLI.
no
--projectId
string

Unique identifier of the project. If omitted, uses the project ID in the profile or environment variable.

no

If the command succeeds, it returns the following output in the default format. If the command returns errors, see Troubleshooting for recommended solutions.

Warning

MongoDB CLI returns the agent API key only once. After running this command, immediately copy, save, and secure the agent API key.

API Key '<agent-api-key>' created.

The 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 Public API reference for your MongoDB service:

The following command creates one agent API key for a project using the default profile, which contains credentials and the project ID. The output is returned in the default format.

mongocli om agents apikey create --desc agentKey

The previous command prints the following to the terminal.

Warning

MongoDB CLI returns the agent API key only once. After running this command, immediately copy, save, and secure the agent API key.

API Key '5f4944e7c90220199059813f0cf83079032a0f7f9538a2f69562a93a' created.
Give Feedback