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

mongocli iam organization apikey describe

On this page

  • Syntax
  • Arguments
  • Options
  • Output
  • Examples

The iam organization apikey describe command provides details about the specified organization API key.

mongocli iam organization|organizations|org|orgs apiKey|apiKeys|apikeys describe <api-key-id>
[ --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.

Argument
Type
Description
Required?
<api-key-id>
string
Unique identifier for this organization API key.
yes
Option
Type
Description
Required?
--orgId
string

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

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 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> <key-description> <public-key> <private-key>

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 describes an organization API key using the default profile, which contains credentials and the organization ID. The output is returned in the default format.

mongocli iam organization apikey describe 5e3b8aa3c1234019903c9fce

The previous command prints the following to the terminal.

ID DESCRIPTION PUBLIC KEY PRIVATE KEY
5e3b8aa3c1234019903c9fce User1 Key abcdefgh ********-****-****-123468e0b5be

The following command describes an API key using the myOM profile, which contains credentials. The output is returned in JSON format.

mongocli iam organization apikey describe 5e3b8aa3c1234019903c9fce --orgId 5a1b39eec902201990f12345 -P myOM --output json

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

[
{
"id": "5e3b8aa3c1234019903c9fce",
"desc": "User1 Key",
"roles": [
{
"orgId": "5e429f2e12345c6eac4d59c9",
"roleName": "ORG_OWNER"
}
],
"privateKey": "********-****-****-123468e0b5be",
"publicKey": "abcdefgh"
}
]

Back

List Organization API Keys