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

mongocli iam organization apikey whitelist delete

On this page

  • Syntax
  • Arguments
  • Options
  • Output
  • Examples

The iam organization apikey whitelist delete command deletes a whitelist entry for the specified 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 whitelist|whitelists delete|rm <whitelist-entry>
[ --apiKey <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?
<whitelist-entry>
string
The IP or CIDR address. If the entry includes a subnet mask, such as 192.0.2.0/24, use the URL-encoded value %2F for the forward slash /.
yes
Option
Type
Description
Required?
--apikey
string
Unique identifier of the API key.
yes
--force
Flag that indicates that the API key can be deleted without requiring confirmation.
no
--orgId
string

Unique identifier of the organization to which the target API key belongs.

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.

You must have credentials with the Organization Owner role to list an API key for the organization.

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

no

If the command succeeds, it prints the following output to the terminal. If the command returns errors, see Troubleshooting for recommended solutions.

Whitelist entry '<whitelist-entry>' deleted

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 deletes the whitelist entries for an API key using the default profile, which contains credentials, the organization ID, and specifies the Atlas service. The output is returned in the default format.

mongocli iam org apikey whitelist rm 192.0.2.0 --apiKey 5f4ed27ec90220199065b4bb

The previous command prints the following output to the terminal.

? Are you sure you want to delete: 192.0.2.0 Yes
Whitelist entry '192.0.2.0' deleted

The following command deletes a whitelist entry for an API key without confirmation. The command uses the myOM profile, which contains credentials and specifies the Ops Manager service. The output is returned in JSON format.

mongocli iam org apikey whitelist rm 192.0.2.0 --apiKey 5f4ed27ec90220199065b4bb --orgId 5a1b39eec902201990f12345 -P myOM --output json

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

Whitelist entry '192.0.2.0' deleted

Back

List Whitelist Entries for an Organization API Key