Learn how to use Anypoint CLI commands for Anypoint Platform accounts, API Manager, CloudHub applications, design center projects, and exchange assets.
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.
Credentials File
Create a directory called .anypoint in the ~/ directory for Linux and OSx, or C:\Users\USERNAME \ in Windows.
Navigate to your .anypoint directory and create a blank file named credentials with the following structure:
Anypoint CLI Commands for Anypoint Platform Accounts
Show account detailsaccount user describe:
> account user describe
┌───────────────┬─────────────────────────────────────────────────────────────────┐
│ Id │ ac6935be-404f-4c7e-ae41-b92ccc4de926 │
├───────────────┼─────────────────────────────────────────────────────────────────┤
│ User name │ mulejun221231XXXX │
├───────────────┼─────────────────────────────────────────────────────────────────┤
│ Full name │ Shyam Raj Prasad │
├───────────────┼─────────────────────────────────────────────────────────────────┤
│ Email │ masteringmule@gmail.com │
├───────────────┼─────────────────────────────────────────────────────────────────┤
│ Created │ 8 days ago │
└───────────────┴─────────────────────────────────────────────────────────────────┘
Lists business groups account business-group list:
> account business-group list
┌────────────────────────────────────────┬───────────────┬────────────────────────────────────────┐
│ Name │ Type │ Id │
├────────────────────────────────────────┼───────────────┼────────────────────────────────────────┤
│ tricon │ Master │ 605578bb-09f3-4947-877a-60aac32601e2 │
└────────────────────────────────────────┴───────────────┴────────────────────────────────────────┘
Show details of a business group account business-group describe:
> account environment list
┌────────────────────────────────────────┬────────────────────────────────────────┬──────────┐
│ Name │ Id │ Sandbox │
├────────────────────────────────────────┼────────────────────────────────────────┼──────────┤
│ Design │ 284d3b65-0ebf-49c1-a3cd-05890ec614c6 │ Y │
├────────────────────────────────────────┼────────────────────────────────────────┼──────────┤
│ dev │ ddb79dc5-c0a4-434a-9866-abef600d34d7 │ Y │
├────────────────────────────────────────┼────────────────────────────────────────┼──────────┤
│ dzone │ fb45b4b7-f4a3-4c63-9224-87c1ca61dcb8 │ N │
└────────────────────────────────────────┴────────────────────────────────────────┴──────────┘
Create a new environment account environment create <name> --type <environmentType>:
> account environment create dzone --type production
OK
Delete an environment account environment delete <name>:
> account environment delete dzone
OK
Shows details of an environment account environment describe <name>:
> account environment describe dev
┌────────────────────┬────────────────────────────────────────────────────────────┐
│ ID │ ddb79dc5-c0a4-434a-9866-abef600d34d7 │
├────────────────────┼────────────────────────────────────────────────────────────┤
│ Name │ dev │
├────────────────────┼────────────────────────────────────────────────────────────┤
│ Organization ID │ 605578bb-09f3-4947-877a-60aac32601e2 │
├────────────────────┼────────────────────────────────────────────────────────────┤
│ Production │ N │
├────────────────────┼────────────────────────────────────────────────────────────┤
│ Type │ sandbox │
├────────────────────┼────────────────────────────────────────────────────────────┤
│ Client ID │ 85747746894144139b07f988011128c2 │
└────────────────────┴────────────────────────────────────────────────────────────┘
Anypoint CLI Commands for Environments and Business Groups
Make specified environment activeuse environment <name>:
> use environment dev
Switched to environment "dev"
Make specified business-group active use business-group <name>:
> use business-group tricon
Switched to business group "tricon" (environment "Design")
Anypoint CLI Commands for API Manager
Create an API instance alert api-mgr alert add [options] <apiInstanceId> <name>:
> api-mgr alert add --severity Warning --type request-count --operator gt --threshold 250 --periods 1 --duration 15 --durationUnit minutes --email masteringmule@gmail.com 17866168 requst-count-warning
Created new alert with ID "67470491-XXXX-XXXX-XXXX-fd4c1d095c4d" in API ID "17866168"
List alerts for an API instance api-mgr alert list [options] <apiInstanceId>:
> api-mgr alert list 17866168
┌──────────────────────────────────────┬──────────────────────┬───────────────────┬───────────────┬─────────┬──────────┬────────────┐
│ ID │ Name │ Type │ Updated │ Enabled │ Severity │ Recipients │
├──────────────────────────────────────┼──────────────────────┼───────────────────┼───────────────┼─────────┼──────────┼────────────┤
│ 67470491-32fe-4397-abcb-fd4c1d095c4d │ requst-count-warning │ api-request-count │ 3 minutes ago │ No │ Warning │ 1 │
├──────────────────────────────────────┼──────────────────────┼───────────────────┼───────────────┼─────────┼──────────┼────────────┤
│ 57fb93c5-0059-4789-9c1a-9dccb366da2c │ test │ api-request-count │ 4 minutes ago │ No │ Warning │ 1 │
Change the asset version for an API instance by choosing a new version from Exchange api-mgr api change-specification [options] <apiInstanceId> <assetVersion>:
> api-mgr api change-specification 17866168 1.0.1
API instance "17866168" asset version changed to "1.0.1"
Classify an API instance in a given environment api-mgr api classify [options] <destEnvName> <apiInstanceId>:
> api-mgr api classify dev 17866168
Error: The API with id 17866168 has already been classified
Delete an API api-mgr api delete [options] <apiInstanceId>:
> api-mgr api delete 17809267
API deleted
Deploy an API to CloudHub, hybrid server, or Runtime Fabric. This command is only supported for endpoints with proxy api-mgr api deploy [options] <apiInstanceId>.
Deprecate an API instance api-mgr api deprecate [options] <apiInstanceId>:
> api-mgr api deprecate 17866312
API instance with ID "17866312" deprecated
Show details of an API api-mgr api describe [options] <apiInstanceId>:
> api-mgr api describe 17866168
┌──────────────────────────────┬────────────────────────────────────────────────────────────┐
│ ID │ 17866168 │
├──────────────────────────────┼────────────────────────────────────────────────────────────┤
│ Instance Label │ │
├──────────────────────────────┼────────────────────────────────────────────────────────────┤
│ Asset ID │ american-flights-api │
├──────────────────────────────┼────────────────────────────────────────────────────────────┤
│ Asset Version │ 1.0.1 │
├──────────────────────────────┼────────────────────────────────────────────────────────────┤
│ Deprecated │ N │
├──────────────────────────────┼────────────────────────────────────────────────────────────┤
│ Tags │ │
├──────────────────────────────┼────────────────────────────────────────────────────────────┤
│ Product Version │ v2.0 │
├──────────────────────────────┼────────────────────────────────────────────────────────────┤
│ Is Public │ N │
├──────────────────────────────┼────────────────────────────────────────────────────────────┤
│ Environment ID │ 091f7c52-XXXX-XXXX-XXXX-c7b71f782a5c │
├──────────────────────────────┼────────────────────────────────────────────────────────────┤
│ Last Active │ a minute ago │
├──────────────────────────────┼────────────────────────────────────────────────────────────┤
│ Endpoint URI │ │
├──────────────────────────────┼────────────────────────────────────────────────────────────┤
│ Mule 4 or above │ Y │
├──────────────────────────────┼────────────────────────────────────────────────────────────┤
│ Deployment Type │ CH │
├──────────────────────────────┼────────────────────────────────────────────────────────────┤
│ Type │ RAML/OAS │
└──────────────────────────────┴────────────────────────────────────────────────────────────┘
Download the API proxy ZIP file to a local directory api-mgr api download-proxy [options] <apiInstanceId> <targetPath>:
> api-mgr api download-proxy 17866316 /users/shyamrajprasad/mule
Downloading API Proxy to /users/shyamrajprasad/mule
API Proxy downloaded to /users/shyamrajprasad/mule/american_flights_api-v2_0-v2_0_17866316.jar
Edit an API instance api-mgr api edit [options] <apiInstanceId>:
> api-mgr api edit 17866312 --scheme http
Edited API with ID: 17866312
List all APIs in API Manager 2.x api-mgr api list [options]:
> api-mgr api list
┌──────────────────────┬─────────────┬───────────────┬──────────────────────┬─────────────────┬────────────────┬────────────┬────────┐
│ Asset ID │ Instance ID │ Asset Version │ Exchange Asset Name │ Product Version │ Instance Label │ Deprecated │ Public │
├──────────────────────┼─────────────┼───────────────┼──────────────────────┼─────────────────┼────────────────┼────────────┼────────┤
│ american-flights-api │ 17831973 │ 1.0.0 │ american-flights-api │ v2.0 │ │ N │ N │
├──────────────────────┼─────────────┼───────────────┼──────────────────────┼─────────────────┼────────────────┼────────────┼────────┤
│ check-in-papi │ 17809267 │ 1.0.0 │ check-in-papi │ v1 │ │ N │ N │
└──────────────────────┴─────────────┴───────────────┴──────────────────────┴─────────────────┴────────────────┴────────────┴────────┘
Manage a new API, API version, or new API instance with an asset from Exchange api-mgr api manage [options] <assetId> <assetVersion>:
> api-mgr api manage --type raml check-in-papi 1.0.0
Created new API with ID: 17866336
Promote an API instance from the source environment api-mgr api promote [options] <apiInstanceId> <sourceEnvId>:
> api-mgr api promote 17866168 091f7c52-e27e-45e7-a920-c7b71f782a5c
API with ID "17866168" promoted from "091f7c52-e27e-45e7-a920-c7b71f782a5c" to "dev"
Redeploy an API to CloudHub, Hybrid server, or Runtime Fabric api-mgr api redeploy [options] <apiInstanceId>.
Undeprecate an API instance api-mgr api undeprecate [options] <apiInstanceId>:
> api-mgr api undeprecate 17866312
API instance with ID "17866312" undeprecated
Delete a given API contract api-mgr contract delete [options] <apiInstanceId> <clientId>:
List all contracts to a given API instance api-mgr contract list [options] <apiInstanceId> [searchText]:
> api-mgr contract list 17866168
┌──────────────────────────────┬──────────────────────────────────┬────────────────────┬────────────────────┬──────────┬────────────────────┐
│ Application │ Client ID │ Current SLA tier │ Requested SLA tier │ Status │ Updated │
├──────────────────────────────┼──────────────────────────────────┼────────────────────┼────────────────────┼──────────┼────────────────────┤
│ american api │ 7d963ac9a8b24a65aedd75ff222d0af7 │ silver │ N/A │ APPROVED │ a few seconds ago │
├──────────────────────────────┼──────────────────────────────────┼────────────────────┼────────────────────┼──────────┼────────────────────┤
│ test │ cc2dd7b0ec1248e38a9d9f19a596b115 │ silver │ N/A │ APPROVED │ a minute ago │
Apply a policy to a given API instance api-mgr policy apply [options] <apiInstanceId> <policyId>.
Disable policy from a given API instance api-mgr policy disable [options] <apiInstanceId> <policyId>:
> api-mgr policy disable 17866168 2862724
Policy with ID "2862724" disabled in API with ID "17866168".
Edit the policy configuration of a given API instance api-mgr policy edit [options] <apiInstanceId> <policyId>:
> api-mgr policy edit -c '{"loggingConfiguration": [{"itemName":"Default configuration","itemData":{"message":"#[attributes]","level":"INFO","firstSection":true,"secondSection":false}}]}' 17866168 2862725
Policy with ID "2862725" edited.
Enable a policy on a given API instance api-mgr policy enable [options] <apiInstanceId> <policyId>:
> api-mgr policy enable 17866168 2862724
Policy with ID "2862724" enabled in API with ID "17866168".
List policies api-mgr policy list [options] [apiInstanceId]:
Remove a policy from a given API instance api-mgr policy remove [options] <apiInstanceId> <policyId>:
> api-mgr policy remove 17866168 2862724
Policy with ID "2862724" removed from API with ID "17866168"
Create an SLA tier api-mgr tier add [options] <apiInstanceId>:
> api-mgr tier add --autoApprove true --name silver --description silver --limit true,100,min 17866168
Created SLA Tier with ID "1224161"
Copy an SLA tier from the source to a target API Instance api-mgr tier copy [options] <sourceAPIInstanceId> <targetAPIInstanceId>:
> api-mgr tier copy 17866168 17866316
Copying tiers from API ID "17866168" to API ID "17866316"
- Copying source tier "Test"
Delete an SLA tier from an API instance api-mgr tier delete [options] <apiInstanceId> <tierId>:
> api-mgr tier delete 17866168 1224136
Deleted SLA tier with ID "1224136" from API with ID "17866168"
List the SLA tiers of an API instance api-mgr tier list [options] <apiInstanceId> [searchText]:
> api-mgr tier list 17866168
┌──────────────────────────────┬─────────┬────────┬──────────────┬────────┬──────────┬──────────────┐
│ Name │ ID │ Limits │ Applications │ Status │ Approval │ Updated │
├──────────────────────────────┼─────────┼────────┼──────────────┼────────┼──────────┼──────────────┤
│ Test │ 1224136 │ 1 │ 0 │ ACTIVE │ Auto │ a minute ago │
└──────────────────────────────┴─────────┴────────┴──────────────┴────────┴──────────┴──────────────┘
Anypoint CLI Commands for CloudHub Applications
Lists all alerts in the environment runtime-mgr cloudhub-alert list [options]:
> runtime-mgr cloudhub-alert list
┌───────────┬──────────────────────────────────────┬──────┬──────────┬───────────────────────────┬──────────────────────┬─────────┬───────────────────┐
│ Name │ ID │ Type │ Severity │ Source │ Source Type │ Enabled │ Updated │
├───────────┼──────────────────────────────────────┼──────┼──────────┼───────────────────────────┼──────────────────────┼─────────┼───────────────────┤
│ CPU usage │ b0ae4033-f843-4079-9215-6f9ff5e5616e │ cpu │ INFO │ american-flights-api-2905 │ cloudhub-application │ Yes │ a few seconds ago │
└───────────┴──────────────────────────────────────┴──────┴──────────┴───────────────────────────┴──────────────────────┴─────────┴───────────────────┘
Describe the history of the alarm runtime-mgr cloudhub-alert-history describe [options] <name>:
> runtime-mgr cloudhub-alert-history describe "CPU usage"
This alert has no history
List all applications in the environment runtime-mgr cloudhub-application list [options]:
> runtime-mgr cloudhub-application list
┌────────────────────────────────────────┬──────────────────┬──────────────────┬──────────────────┐
│ Application │ Status │ vCores │ Updated │
├────────────────────────────────────────┼──────────────────┼──────────────────┼──────────────────┤
│ hello-world-12-05 │ STARTED │ 0.1 vCores * 1 │ 18 days ago │
│ Hello World.jar │ │ │ │
├────────────────────────────────────────┼──────────────────┼──────────────────┼──────────────────┤
│ testing4321 │ STARTED │ 0.1 vCores * 1 │ 7 days ago │
│ testing-1.0.0-SNAPSHOT-mule-applica… │ │ │ │
├────────────────────────────────────────┼──────────────────┼──────────────────┼──────────────────┤
│ american-flights-api-2905 │ STARTED │ 0.1 vCores * 1 │ 19 hours ago │
│ american-flights-api-1.0.0-SNAPSHOT… │ │ │ │
├────────────────────────────────────────┼──────────────────┼──────────────────┼──────────────────┤
│ american-flights-proxy-1234 │ STARTED │ 0.1 vCores * 1 │ 11 hours ago │
│ american-flights-proxy-1234-api-gat… │ │ │ │
Show application details runtime-mgr cloudhub-application describe [options] <name>:
> runtime-mgr cloudhub-application describe hello-world-12-05
┌──────────────────────────────┬────────────────────────────────────────────────────────────────┐
│ Domain │ hello-world-12-05.us-e2.cloudhub.io │
├──────────────────────────────┼────────────────────────────────────────────────────────────────┤
│ Status │ STARTED │
├──────────────────────────────┼────────────────────────────────────────────────────────────────┤
│ Updated │ 18 days ago │
├──────────────────────────────┼────────────────────────────────────────────────────────────────┤
│ Runtime │ 4.4.0 │
├──────────────────────────────┼────────────────────────────────────────────────────────────────┤
│ File name │ Hello World.jar │
├──────────────────────────────┼────────────────────────────────────────────────────────────────┤
│ Region │ us-east-2 │
├──────────────────────────────┼────────────────────────────────────────────────────────────────┤
│ Persistent queues │ false │
├──────────────────────────────┼────────────────────────────────────────────────────────────────┤
│ Persistent queues encrypted │ false │
├──────────────────────────────┼────────────────────────────────────────────────────────────────┤
│ Static IPs enabled │ false │
├──────────────────────────────┼────────────────────────────────────────────────────────────────┤
│ Monitoring │ Enabled. Will auto restart when not responding │
├──────────────────────────────┼────────────────────────────────────────────────────────────────┤
│ Workers │ 0.1 vCores * 1 │
│ │ IP: 18.189.182.154, STARTED │
├──────────────────────────────┼────────────────────────────────────────────────────────────────┤
│ Properties │ anypoint.platform.config.analytics.agent.enabled = true
Show raw application JSON response runtime-mgr cloudhub-application describe-json [options] <name>:
List all Design Center projects designcenter project list [options] [searchText]:
> designcenter project list
┌────────────────────────────────────────┬──────────┬──────────────────────┬──────────────────┬───────────────┐
│ ID │ Version │ Name │ Type │ Created │
├────────────────────────────────────────┼──────────┼──────────────────────┼──────────────────┼───────────────┤
│ 5e4103d7-76c2-41f0-8a67-a059f65c9632 │ 1.0 │ american-flights-api │ raml │ 15 days ago │
├────────────────────────────────────────┼──────────┼──────────────────────┼──────────────────┼───────────────┤
│ 621c8888-bb8e-4ced-bdf6-d63bf5e3fa67 │ 1.0 │ test │ Mule Application │ 24 days ago │
├────────────────────────────────────────┼──────────┼──────────────────────┼──────────────────┼───────────────┤
│ 938ff273-9606-4185-ae92-7abeffc6a7af │ 1.0 │ check-in-papi │ raml │ 25 days ago │
└────────────────────────────────────────┴──────────┴──────────────────────┴──────────────────┴───────────────┘
Anypoint CLI Commands for Exchange Assets
Upload an Exchange asset exchange asset upload [options] <assetIdentifier> [filePath]:
List all pages for a given assetexchange asset page list <assetIdentifier>:
> exchange asset page list covid-data-tracking-api/1.0.0 covid
Getting asset pages list
┌──────┬──────┐
│ Name │ Path │
├──────┼──────┤
│ home │ home │
├──────┼──────┤
│ Test │ Test │
└──────┴──────┘
> exchange asset copy --targetOrganizationId f16989ac-84c0-4868-90a6-45a5ee100d04 covid-data-tracking-api/1.0.0 covid-data-tracking-api/1.0.6
Copying asset from "covid-data-tracking-api/1.0.0" to "covid-data-tracking-api/1.0.6"
Downloading source asset data
Copying source asset data to target
Delete an asset from Exchange exchange asset delete [options] <assetIdentifier>:
Show a given asset’s information exchange asset describe <assetIdentifier>:
> exchange asset describe covid-data-tracking-api/1.0.0
┌──────────────────────────────┬────────────────────────────────────────────────────────────────┐
│ Name │ covid-data-tracking-api │
├──────────────────────────────┼────────────────────────────────────────────────────────────────┤
│ Changed │ a minute ago │
├──────────────────────────────┼────────────────────────────────────────────────────────────────┤
│ Status │ published │
├──────────────────────────────┼────────────────────────────────────────────────────────────────┤
│ Type │ rest-api │
├──────────────────────────────┼────────────────────────────────────────────────────────────────┤
│ API Version │ v1 │
├──────────────────────────────┼────────────────────────────────────────────────────────────────┤
│ Asset Versions │ 1.0.4, 1.0.2, 1.0.1, 1.0.0 │
├──────────────────────────────┼────────────────────────────────────────────────────────────────┤
│ API Versions │ v1 │
└──────────────────────────────┴────────────────────────────────────────────────────────────────┘
Upload a resource to an asset portal exchange asset resource upload [options] <assetIdentifier> <filepath>:
> exchange asset resource upload covid-data-tracking-api/1.0.0 /users/shyamrajprasad/download/mulesoft.jpeg
Uploading resource...
Resource uploaded. To use, add the following markdown code in the desired page:

List published resources in the asset portal exchange asset resource list [options] <assetIdentifier>:
> exchange asset resource list covid-data-tracking-api/1.0.0
Getting asset resource list
The asset: "covid-data-tracking-api/1.0.0" does not have any published resource
Download resource from the asset portal exchange asset resource download [options] <assetIdentifier> <resourcePath> <filePath>:
Delete resources from the asset portalexchange asset resource delete [options] <assetIdentifier> <resourcePath>:
> exchange asset resource delete covid-data-tracking-api/1.0.0 mulesoft.jpeg
Deleting resource...
Error: DELETE /assets/139e1148-d888-487c-b041-6b6d9f38625f/covid-data-tracking-api/1.0.0/portal/draft/mulesoft.jpeg does not exist in the RAML for this application
Comments