---
schema_version: "1"
id: 280520988344569344ccb96d7529032815a90727968b4b46e83dee4ed28779c9
title: Anypoint CLI 3.x
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/anypoint-cli/3.x/index.md
canonical_url: https://docs.mulesoft.com/anypoint-cli/3.x/
source_site: docs.mulesoft.com
content_type: documentation
content_hash: b0afd8829d109d97f29c75e1f5a9a763cb406cacb7246ae8418c8a8ec0a705ad
description: MuleSoft Documentation Site
release: 3.x
latest: false
---
---
product: Anypoint CLI
version: 3.x
---

# Anypoint CLI 3.x

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Anypoint Platform provides a scripting and command-line tool for both Anypoint Platform and Anypoint
Platform Private Cloud Edition (Anypoint Platform PCE). The command-line interface (CLI) supports
both the interactive shell and standard CLI modes and works with:

- [Anypoint Exchange](https://docs.mulesoft.com/exchange/)

- [Anypoint DataGraph](https://docs.mulesoft.com/datagraph/)

- [Access management](https://docs.mulesoft.com/access-management/)

- [Anypoint Runtime Manager](https://docs.mulesoft.com/runtime-manager/)

- [API Governance](https://docs.mulesoft.com/api-governance/)

  Use Runtime Manager to manage Mule applications deployed to CloudHub (hosted by MuleSoft) and
  locally hosted Mule servers.

- [VPCs](https://docs.mulesoft.com/cloudhub/virtual-private-cloud)

- [CloudHub Load Balancers](https://docs.mulesoft.com/cloudhub/cloudhub-dedicated-load-balancer)

- [API Manager 2.x (Crowd Release)](https://docs.mulesoft.com/api-manager/latest/)

- [Design Center](https://docs.mulesoft.com/design-center/)

## Prerequisites

- Download and install NodeJS and npm (node package manager) on your system.

  Minimum versions required are:

- Node.js LTS version 18.0.0 and later

- npm 6.14.8

  See the [NodeJS download page](https://nodejs.org/en/download/).

- Download and install the Git version management on your system.

  See the [Git download site](https://git-scm.com/downloads).

> [!NOTE] Depending on the configuration of your system, you might need to run these commands using
> administrator credentials.

## Installation

```text
$ npm install -g anypoint-cli@latest
```

> [!NOTE] Depending on the configuration of your system, you might need to run these commands using
> administrator credentials.

## Authentication

You can configure Anypoint CLI authentication with username and password, client ID and client
secret, or a bearer token. At least one method is required.

> [!NOTE] As a part of Multi-factor authentication (MFA) enablement for all users, starting October
> 2022, the only way to use Anypoint CLI will be through
> [Connected Apps](https://docs.mulesoft.com/access-management/connected-apps-overview).

### Username and Password

If you don’t log in using single sign-on (SSO), you can use your username and password to log into
the CLI directly.

<table><colgroup><col> <col></colgroup><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td><div><div><p><code>username</code></p></div></div></td><td><div><div><p>Your Anypoint Platform username</p></div><div><p>You can also pass this value using the environment variable <code>export ANYPOINT_USERNAME=&lt;name&gt;</code>.</p></div></div></td></tr><tr><td><div><div><p><code>password</code></p></div></div></td><td><div><div><p>Your Anypoint Platform password</p></div><div><p>You can also pass this value using the environment variable <code>export ANYPOINT_PASSWORD=&lt;pwd&gt;</code>.</p></div></div></td></tr></tbody></table>

For information about logging in using SSO, see
[About Identity Management](https://docs.mulesoft.com/access-management/external-identity).

### Client ID and Client Secret

You can configure a Connected App with the `client_credentials` grant type to use with the CLI.

<table><colgroup><col> <col></colgroup><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td><div><div><p><code>client_id</code></p></div></div></td><td><div><div><p>The ID of the Connected App</p></div><div><p>You can also pass this value using the environment variable <code>export ANYPOINT_CLIENT_ID=&lt;client_id&gt;</code>.</p></div></div></td></tr><tr><td><div><div><p><code>client_secret</code></p></div></div></td><td><div><div><p>The client secret of the Connected App</p></div><div><p>You can also pass this value using the environment variable <code>export ANYPOINT_CLIENT_SECRET=&lt;client_secret&gt;</code>.</p></div></div></td></tr></tbody></table>

For more information about Connected Apps, see
[Connected Apps](https://docs.mulesoft.com/access-management/connected-apps-overview).

### Bearer Token

If you have already generated a bearer token, you can pass it to the CLI directly. When you provide
a bearer token, the CLI ignores any provided user or client credentials.

<table><colgroup><col> <col></colgroup><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td><div><div><p><code>bearer</code></p></div></div></td><td><div><div><p>A bearer token for the Anypoint Platform</p></div><div><p>Your CLI session expires when the bearer token expires.</p></div></div></td></tr></tbody></table>

For information about generating a bearer token, see
[How to generate your Authorization Bearer token for Anypoint Platform](https://help.salesforce.com/s/articleView?id=001115323&type=1).

## Optional Arguments

The Anypoint CLI takes the following optional arguments:

<table><colgroup><col> <col></colgroup><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td><div><div><p><code>organization</code></p></div></div></td><td><div><div><p>Your organization or sub-organization (business group) within Anypoint Platform. You can specify the root organization name or the name of a specific business group.</p></div><div><p>You can also pass this value using the environment variable <code>export ANYPOINT_ORG=&lt;name&gt;</code>.</p></div></div></td></tr><tr><td><div><div><p><code>environment</code></p></div></div></td><td><div><div><p>Your Anypoint Platform environment</p></div><div><p>You can also pass this value using the environment variable <code>export ANYPOINT_ENV=&lt;name&gt;</code>.</p></div></div></td></tr><tr><td><div><div><p><code>host</code></p></div></div></td><td><div><div><p>The host of your Anypoint Platform Installation<br>By default, this value points to <code>anypoint.mulesoft.com</code>.<br></p></div><div><ul><li><p>If you are using Anypoint Platform PCE, pass the address where you are hosting the platform.</p></li><li><p>If you are using Anypoint Platform EU Cloud, pass your EU control plane address.</p></li></ul></div><div><p>You can also pass this value using a dedicated environment variable <code>ANYPOINT_HOST=&lt;name&gt;</code>.</p></div></div></td></tr></tbody></table>

## Usage

Keep the following in mind while using the Anypoint CLI:

1.  Environment variables override credentials file parameters and command-line parameters override
    environment variables.  
    If you don’t pass a command-line parameter, the default profile properties are used.

2.  If not specified, the default environment is production.

3.  Your Anypoint session expires based on the **Default session timeout** configured in your
    Organization settings.

    For information about your Organization settings, see
    [Manage Root Organization Settings](https://docs.mulesoft.com/access-management/managing-business-groups#manage-root-organization-settings).

4.  The Anypoint CLI works with autocomplete.

    You can start typing the name of the command or parameter and press Tab for autocomplete or
    press Tab+Tab for a list of options.

### Credentials File

The recommended way of passing these options to your Anypoint Platform CLI installation is using the
`credentials` file located inside the `~/.anypoint` directory, which is not automatically created
during installation. Follow these steps to create your credentials file:

1.  Create a directory called `.anypoint` in the `~/` directory for Linux and OSx, or
    `C:\Users\USERNAME \` in Windows.

2.  Navigate to your `.anypoint` directory and create a blank file named `credentials` with the
    following structure:

    ```text
    {
     "default": {
      "username": "yourAnypointUserName",
      "password": "yourAnypointPassword",
      "organization": "",
      "environment": "",
      "host": ""
     },
     "otherProfile": {
      "username": "",
      "password": "",
      "organization": "",
      "environment": "",
      "host": ""
     },
     "connAppProfile": {
      "client_id": "",
      "client_secret": "",
      "organization": "",
      "environment": "",
      "host": ""
     }
    }
    ```

    Note that the `default` profile is used unless the `ANYPOINT_PROFILE` environment variable is
    set:

    ```text
    > export ANYPOINT_PROFILE="otherProfile"
    > anypoint-cli
    ```

Then run the `anypoint-cli` command without any options:

```text
> anypoint-cli
```

### Dedicated Environment Variables

If you choose to pass the credentials when running `anypoint-cli`, pass both parameters as
environment variables: `ANYPOINT_USERNAME` and `ANYPOINT_PASSWORD`.

```text
> export ANYPOINT_USERNAME="username"
> export ANYPOINT_PASSWORD="password"
> anypoint-cli
```

### CLI Options

If you pass only your username, the Anypoint CLI prompts for your password.

```text
> anypoint-cli --username="user"
Password: ****
```

### Pass Commands

After setting up a proper way to access Anypoint Platform from the CLI, you can start passing
commands.  
See [Anypoint Platform CLI 3.x List of Commands](https://docs.mulesoft.com/anypoint-cli/3.x/anypoint-platform-cli-commands) for instructions on
how to use them.

### Use Anypoint CLI Through a Network Proxy

To use the Anypoint CLI through a proxy server, configure the `HTTP_PROXY` and `HTTPS_PROXY`
(uppercase) environment variables with the hostname or IP addresses of your proxy servers.

Depending on your operating system, use the following commands:

- Linux, macOS, or Unix

  `$ export HTTP_PROXY=http://_proxy-server_:80`

  or

  `$ export HTTPS_PROXY=https://_proxy-server_:443`

- Windows

  `> set HTTP_PROXY=http://_proxy-server_:80`

  or

  `> set HTTPS_PROXY=https//_proxy-server_:443`

If the proxy server requires authentication, use these commands:

- Linux, macOS, or Unix

  `$ export HTTP_PROXY=http://_username_:_password_@_proxy-server_:80`

  or

  `$ export HTTPS_PROXY=https://_username_:_password_@_proxy-server_:443`

- Windows

  `> set HTTP_PROXY=http://_username_:_password_@_proxy-server_:80`

  or

  `> set HTTPS_PROXY=https://_username_:_password_@_proxy-server_:443`

## Notes

- To improve the Anypoint CLI experience, we gather anonymized usage data. You can opt out by
  setting `collectMetrics` to false in the `credentials` file.

## See Also

- [Anypoint Platform CLI List of Commands](https://docs.mulesoft.com/anypoint-cli/3.x/anypoint-platform-cli-commands)
