mongocli iam organization apikey describe
The iam organization apikey describe
command provides details about
the specified organization API key.
Syntax
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.
Arguments
Argument | Type | Description | Required? |
---|---|---|---|
<api-key-id> | string | Unique identifier for this organization API key. | yes |
Options
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:
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 |
Output
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:
Examples
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" } ]