Navigation

mongocli ops-manager agents apikey list

The agents apikey list command retrieves all agent API keys for the specified Ops Manager project.

You must have at least GROUP_READ_ONLY privileges for a project to retrieve agent API keys for that project.

mongocli ops-manager|om agents apikey|apikeys list|ls
[ --output|-o <output-format> ]
[ --profile|-P <profile-name> ]
[ --projectId <id-of-project> ]
Option
Type
Description
Required?
--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.

Note

After creating an agent API key, subsequent requests return only the last four characters of the key in clear text. The response replaces the key's other characters with asterisks.

ID KEY DESCRIPTION CREATED AT
<agent-key-1-id> <redacted-agent-key-1> <agent-key-1-description> <timestamp>
<agent-key-2-id> <redacted-agent-key-2> <agent-key-2-description> <timestamp>

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 retrieves agent API keys 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 list

The previous command prints the following to the terminal.

Note

After creating an agent API key, subsequent requests return only the last four characters of the key in clear text. The response replaces the key's other characters with asterisks.

ID KEY DESCRIPTION CREATED AT
5f1f3a04c902201990f5388a ****************************39fe Initial API Key 1595881988159
5f1f39ffc902201990f5387d ****************************8b87 Public API generated group agent api key 1595881983276
Give Feedback