Navigation

mongocli iam project apikey list

The iam project apikey list command lists the API keys for the specified project.

You must have GROUP_USER_ADMIN privileges to list API keys for the project.

mongocli iam project|projects apiKey|apiKeys|apikeys list|ls
[ --projectId <project-id> ]
[ --output|-o <output-format> ]
[ --profile|-P <profile-name> ]
Note

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

Option
Type
Description
Required?
--projectId
string

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

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 the Go template file

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

no
--profile, -P
string

Name of the profile where your credentials are saved.

If omitted, uses the default profile. To learn more about creating a profile, see Configure the MongoDB CLI.

no

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

ID PUBLIC KEY DESCRIPTION
<key-id-1> <public-key-1> <key-description-1>
<key-id-2> <public-key-2> <key-description-2>

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 the 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 iam project apikey list

The previous command prints the following to the terminal.

ID PUBLIC KEY DESCRIPTION
5f4578684b4afb5e8cd44ee9 mkoztppy Project Owner
5f469ea0f2c5937c5cdb1081 hdlvegpx External Read-Only
Give Feedback