Navigation

mongocli iam organization apikey list

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

mongocli iam organization|organizations|org|orgs apiKey|apiKeys|apikeys list|ls
[ --orgId <organization-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?
--orgId
string

Unique identifier of the organization whose API keys you want to list.

If specified, this value overrides any organization ID stored in your profile or environment variable.

If omitted, your profile must contain the organization ID.

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 DESCRIPTION PUBLIC KEY PRIVATE KEY
<key-id-1> <key-description-1> <public-key-1> <private-key-1>
<key-id-2> <key-description-2> <public-key-2> <private-key-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 an organization using the default profile, which contains credentials and the organization ID. The output is returned in the default format.

mongocli iam organization apikey list

The previous command prints the following to the terminal.

ID DESCRIPTION PUBLIC KEY PRIVATE KEY
5e3b8aa3c1234019903c9fce User1 Key abcdefgh ********-****-****-123468e0b5be
5e7cb26fc567801990298a2a User2 Key ijklmnop ********-****-****-322d7d5e1234
Give Feedback