Docs Menu

Docs HomeLaunch & Manage MongoDBMongoDB CLI

mongocli iam organizations apiKeys accessLists create

On this page

  • Syntax
  • Options
  • Inherited Options
  • Output
  • Examples

Create an IP access list entry for your API Key.

To view possible values for the apiKey option, run mongocli organizations apiKeys list.

To use this command, you must authenticate with a user account or an API key with the Read Write role.

Command Syntax
mongocli iam organizations apiKeys accessLists create [options]
Name
Type
Required
Description
--apiKey
string
true
Unique 24-digit ID that identifies your API key.
--cidr
strings
false
Access list entry in CIDR notation to be added for your API key. To add more than one entry, you can specify each entry with a separate cidr flag or specify all the entries as a comma-separated list using one cidr flag. You can't set both cidr and ip in the same command.
-h, --help
false
help for create
--ip
strings
false
IP address to add to the access list for your API key. To add more than one IP address, specify each address with a separate ip flag or specify all addresses as a comma-separated list using one ip flag. You can't set both ip and cidr in the same command.
--orgId
string
false
Organization ID to use. This option overrides the settings in the configuration file or environment variable.
-o, --output
string
false
Output format. Valid values are json, json-path, go-template, or go-template-file. To see the full output, use the -o json option.
Name
Type
Required
Description
-P, --profile
string
false
Name of the profile to use from your configuration file. To learn about profiles for MongoCLI, see https://dochub.mongodb.org/core/atlas-cli-configuration-file.

If the command succeeds, the CLI returns output similar to the following sample. Values in brackets represent your values.

Created new access list entry(s).
# Create access list entries for two IP addresses for the API key with the ID 5f24084d8dbffa3ad3f21234 in the organization with the ID 5a1b39eec902201990f12345:
mongocli organizations apiKeys accessLists create --apiKey 5f24084d8dbffa3ad3f21234 --cidr 192.0.2.0/24,198.51.100.0/24 --orgId 5a1b39eec902201990f12345 --output json
←  mongocli iam organizations apiKeys accessListsmongocli iam organizations apiKeys accessLists delete →