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

mongocli iam organization apikey whitelist list

On this page

  • Syntax
  • Arguments
  • Options
  • Output
  • Examples

The iam organization apikey whitelist list command retrieves information on all whitelist entries for the specified API key.

mongocli iam organization|organizations|org|orgs apiKey|apiKeys|apikeys whitelist|whitelists list|ls <api-key-id>
[ --limit <items-per-page> ]
[ --orgId <organization-id> ]
[ --output|-o <output-format> ]
[ --page <page-number>]
[ --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?
--limit
integer
Number of items per page, up to a maximum of 500. Defaults to 100 if omitted.
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
--page
integer
Page number (1-based). Defaults to 1 if not specified.
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.

IP ADDRESS CIDR BLOCK CREATED AT
<ip-address-1> <cidr-block-1> <date>
<ip-address-2> <cidr-block-2> <date>

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 lists 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 ls 5f4ed27ec90220199065b4bb

The previous command lists the whitelist entry and prints the following to the terminal.

IP ADDRESS CIDR BLOCK CREATED AT
198.51.100.0 198.51.100.0/24 2020-07-31T12:02:28Z
192.0.2.0 192.0.2.0/24 2020-07-31T12:02:34Z

The following command lists the whitelist entries for an API key using the myOM profile, which contains credentials and specifies the Ops Manager service. The output is returned in JSON format.

mongocli iam org apikey whitelist ls 5f4ed27ec90220199065b4bb --orgId 5a1b39eec902201990f12345 --output json

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

{
"results": [
{
"cidrBlock": "198.51.100.0/24",
"created": "2020-09-01T23:30:51Z",
"ipAddress": "198.51.100.0",
"links": [
{
"rel": "self",
"href": "http://example.mongodb.com/api/public/v1.0/orgs/523f39ffc902201990f53874/apiKeys/5f4ed27ec90220199065b4bb/whitelist/198.51.100.0"
}
]
}
],
"links": [
{
"rel": "self",
"href": "http://example.mongodb.com/api/public/v1.0/orgs/523f39ffc902201990f53874/apiKeys/5f4ed27ec90220199065b4bb/whitelist?pageNum=1\u0026itemsPerPage=100"
}
],
"totalCount": 1
}

Back

Create a Whitelist Entry for an Organization API Key