Navigation

mongocli iam organization apikey delete

The iam organization apikey delete command deletes the specified organization API key. You must confirm the operation when you run this command without the --force option.

mongocli iam organization|organizations|org|orgs apiKey|apiKeys|apikeys delete|rm <api-key-id>
[ --force ]
[ --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?
--force
Flag that indicates that the API key can be deleted without requiring confirmation.
no
--orgId
string

Unique identifier of the organization of the API key you want to delete.

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.

? Are you sure you want to delete: <api-key-id> Yes
API Key '<api-key-id>' deleted

The following command deletes an organization API key with confirmation. The command uses the default profile, which contains credentials and the organization ID, and returns the output in the default format.

mongocli iam org apikey delete 5f3d8790c9022019903c1234

The previous command prints the following to the terminal.

? Are you sure you want to delete: 5f3d8790c9022019903c1234 Yes
API Key '5f3d8790c9022019903c1234' deleted
Give Feedback