Skip to main content
Deployment options: Self-hosted

WSO2 API Controller (APICTL)

The WSO2 API Controller (apictl) is the command-line tool of WSO2 API Manager. This allows you to move APIs, API Products, and Applications across API-M environments and to perform CI/CD operations. It can also be used to perform these same tasks on a Kubernetes deployment. Furthermore, it can be used with the Micro Integrator (WSO2 MI) for monitoring integration artifacts and performing management/administrative tasks from the command line.

Get Started​

Follow the steps given below to get started:

  1. Go to the WSO2 API Manager website -> Download -> Tooling, and download the API Controller.

  2. Extract the downloaded distribution and initialize apictl by executing the following command from your terminal.

    apictl init
  3. Add environments

    Execute the following command to add API-M or Micro Integrator servers:

    apictl add env <environment-name>

    Find out more about the apictl add env option in the APICTL Reference.

  4. Log in

    Execute the following command to log in to the required server environment. You are prompted to enter the username and password.

    apictl login <environment-name>

    Alternatively, you can pass the user name and password in a single command:

    note

    If you are on Windows, you must always log in with the following command.

    apictl login <environment-name> -u <username> -p <password>

    To logout from apictl, use the following command:

    apictl logout <environment-name>

Once you are logged in, you can use the available options and commands.

APICTL Reference​

You can execute the following command to see the available sub commands:

apictl

Listed below are all the apictl commands available.

apictl global flags​

The following global flags can be used with all the apictl options and subcommands.

-h, --helpGet help for apictl commands and options.
-k, --insecureAllow connections to SSL endpoints without certifications.
--verboseEnable verbose mode.

apictl version​

Use the version option to get the version of the running apictl tool.

apictl version

apictl init​

Use init to initialize the CLI tool.

apictl init

apictl add​

Add a new environment (API-M or MI) and its related endpoints to the configuration file of apictl. This will connect apictl with the added environments.

  • Usage

    apictl add [option] [argument] [flag]
  • Option

    envSpecifies that a new environment is being added.
  • Argument

    environment nameEnter the name of given to the environment.
  • Flags

    --apimUse this flag to add an API-M environment.
    --registrationIf the --apim flag is not used, use this flag to specify the API-M server url.
    --publisherIf the --apim flag is not used, use this flag to specify the API-M Publisher url.
    --devportalIf the --apim flag is not used, use this flag to specify the API-M Developer Portal url.
    --adminIf the --apim flag is not used, use this flag to specify the API-M Admin Portal url.
    --tokenIf the --apim flag is not used, use this flag to specify the API-M Token url.
    --miUse this flag to add a Micro Integrator environment.
    --environmentThis flag is mandatory when passing an environment.
    -eThis flag is mandatory when passing an environment.

apictl login​

Log in to an API Manager environment using credentials.

  • Usage

    apictl login [argument] [global-flags]
  • Arguments

    environmentSpecify the name of the environment to which you want to log in.
  • Flags

    -u, --username stringUsername to login.
    -p, ---password stringThe login password.
    --password-stdin Get the login password from stdin.

apictl logout​

Log out from an API Manager environment.

  • Usage

    apictl logout [argument] [global-flags]
  • Arguments

    environmentLog in to the API-M runtime instance.

apictl get​

Displays a list containing all the APIs, all the API Products, all the MCP Servers, applications of a specific user, all the environments or log levels of APIs or MCP Servers.

  • Usage

    apictl get [option] [argument] [flag] [argument]
  • Options

    envsDisplay the list of environments.
    apisDisplay a list of APIs in an environment.
    api-productsDisplay a list of API Products in an environment.
    mcp-serversDisplay a list of MCP Servers in an environment.
    appsDisplay a list of Applications in an environment specific to an owner.
    api-revisionsDisplay a list of Revisions for the API.
    mcp-server-revisionsDisplay a list of Revisions for the MCP Server.
    keysGenerate access token to invoke the API or API product.
    api-loggingDisplay log level of the API or APIs.
    mcp-server-loggingDisplay log level of the MCP Server or MCP Servers.
    correlation-loggingDisplay a list of correlation logging components available.
  • Argument

    environment nameEnter the name of given to the environment.
  • Flags

    -eUse this flag to specify from which environment to get the APIs, API products, or APPs.
    --environmentUse this flag to specify from which environment to get the APIs, API products, or APPs.

apictl import​

Import an API, API product, MCP Server, or application to a specific environment.

  • Usage

    apictl import [option] [argument] [flag] [argument]
  • Subcommands

    apiSpecify an API to import.
    api-productSpecify an API product to import.
    mcp-serverSpecify an MCP Server to import.
    appSpecify an application to import.
  • Flags

    -fUse this flag to specify file path of the API, API product, or App.

apictl export​

Export APIs, API Products, MCP Servers, and Applications of a specific user in the specified environment.

  • Usage

    apictl export [option] [argument] [flag] [argument]
  • Options

    apiSpecifies the API to export.
    apisSpecifies the APIs to export.
    api-productSpecify an API product to export.
    mcp-serverSpecify an MCP Server to export.
    appSpecify an application to export.
  • Flags

    -nName of the API, API product, or APP to export.
    -vThe version of the API you are exporting.
    -rThe user role that is assigned.
    -eThe environment from which the APIs, API product, or App is being exported.

apictl delete​

Delete APIs, API Products, MCP Servers, and Applications of a specific user in the specified environment.

  • Usage

    apictl delete [option] [argument] [flag] [argument]
  • Options

    apiSpecifies the API to delete.
    api-productSpecify an API product to delete.
    mcp-serverSpecify an MCP Server to delete.
    appSpecify an application to delete.
  • Flags

    -nName of the API, API product, or APP to delete.
    -vThe version of the API you are deleting.
    -rThe user role that is assigned.
    -eThe environment from which the APIs, API product, or App is being deleted.

apictl change-status​

Change the lifecycle status of an API, API Product, or MCP Server in an environment

  • Usage

    apictl change-status [option] [argument] [flag] [argument]
  • Options

    apiSpecifies the API for which you want to change the status.
    mcp-serverSpecifies the MCP Server for which you want to change the status.
  • Flags

    -aThe new status that should apply to the API.
    -nThe name of the API for which the new status should apply.
    -vThe version of the API you are deleting.
    -rThe user role that is assigned.
    -eThe environment from which the APIs, API product, or App is being deleted.

apictl bundle​

Archive API, Application, or API Product projects to a zip format. The bundle name will have the project name and version.

  • Usage

    apictl bundle [flag] [argument]
  • Flags

    -sThe source of the API, or API project directory that should be bundled and archived.
    --sourceThe source of the API, or API product directory that should be bundled and archived.
    --dThe destination where the bundled ZIP file of the API/API product director is saved.
    --destinationThe destination where the bundled ZIP file of the API/API product director is saved.

apictl set​

Set configuration parameters. You can use one of the following flags.

  • Usage

    apictl set [flag] [argument]
  • Flags

    --http-request-timeoutSpecify the request timeout in milliseconds.
    --tls-renegotiation-modeSpecify the regeneration mode: never, once, or freely.
    --export-directoryThe directory path where APIs should be saved. The directory path must be an existing folder.
    --vcs-deletion-enabledEnable/Disable project deletion via vcs.
    --vcs-config-pathThe directory path to the custom vcs configuration file.
    --vcs-deployment-repo-pathThe directory path to the deployment repo for vcs.
    --vcs-source-repo-pathThe directory path to the source repo for vcs.

Use api-logging option to set the log level of the API.

apictl set api-logging [flag] [argument]

Use mcp-server-logging option to set the log level of the MCP Server.

apictl set mcp-server-logging [flag] [argument]

Use correlation-logging option to set the correlation configs for a correlation logging component.

apictl set correlation-logging [flag] [argument]

apictl k8s​

Managing APIs in a Kubernetes API-M environment.

  • Usage

    apictl k8s [subcommand] [option] [argument] [flag] [argument]
  • Subcommands

    add apiAdd an API to the kubernetes cluster.
    update apiUpdate an API to the kubernetes cluster
    delete apiDelete resources related to kubernetes.
    genGenerate deployment directory for K8S operator.
  • Flags

    -nThe name of the API that should be added or updated in the K8s environment.
    -fTHe file path to the Swagger resource.
    --namespace=[value]The namespace associated with the API that should be added or updated in the K8s environment.

apictl aws​

AWS API Gateway related commands such as init. Be sure to install and configure the AWS CLI before executing the aws init command. See the AWS documentation for more information.

  • Usage

    apictl aws [subcommand] [flag] [argument]
  • Subcommands

    initInitialize an API project for an AWS API.
  • Flags

    -nThe name of the API project that should be initialized.
    -sThe stage of the environment.
    --stageThe stage of the environment.

apictl vcs​

Checks status and deploys projects to the specified environment. To use this command, 'git' must be installed in the system.'

  • Usage

    apictl vcs [subcommand] [flag] [argument]
  • Subcommands

    initInitializes a GIT repository with API Controller.
    deployDeploys projects to the specified environment.
    statusShows the list of projects that are ready to deploy.
  • Flags

    -eThe environment to which a project should be deployed.

apictl undeploy​

Undeploy an API/API Product/MCP Server revision that is available in the specified environment from the specified gateway.

  • Usage

    apictl undeploy [option] [argument] [flag] [argument]
  • Options

    apiSpecifies the API to be undeployed.
    mcp-serverSpecifies the MCP Server to be undeployed.
  • Flags

    -nName of the API, API product, or APP to undeploy.
    -vThe version of the API you are undeploying.
    -rThe user role that is assigned.
    -rev....
    -gThe APIs matching the listed labels are undeployed.
    -eThe environment from which the API is being undeployed.

apictl mi​

Use this command to manage Micro Integrator artifacts. You can get, add, update, delete, activate, and deactivate integration artifacts and logs.

  • Usage

    apictl mi [subcommand] [option] [argument] [global-flag]
  • Subcommands

    loginLogin to a Micro Integrator.
    logoutLogout from a Micro Integrator.
    getGet information about artifacts deployed in a Micro Integrator instance.
    addAdd new users or loggers to a Micro Integrator instance.
    deleteDelete users from a Micro Integrator instance.
    updateUpdate log level of Loggers in a Micro Integrator instance.
    activateActivate artifacts deployed in a Micro Integrator instance.
    deactivateDeactivate artifacts deployed in a Micro Integrator instance.
  • Options

    apisGet details of APIs deployed in the Micro Integrator.
    connectorsGet details of integration connectors deployed in the Micro Integrator.
    data-servicesGet details of data services deployed in the Micro Integrator.
    mi get endpointsGet details of endpoints deployed in the Micro Integrator.
    inbound-endpointsGet details of inbound endpoints deployed in the Micro Integrator.
    local-entriesGet details of local entries deployed in the Micro Integrator.
    message-processorsUse this option with the get or activate subcommands to get details or to activate the status.
    message-storesGet details of message stores deployed in the Micro Integrator.
    proxy-servicesGet details of proxy services deployed in the Micro Integrator.
    tasksGet details of scheduled tasks deployed in the Micro Integrator.
    templatesGet details of templates deployed in the Micro Integrator.
    log-levelsUse this option with the mi get, mi add, or mi update commands to manage loggers in the Micro Integrator environment.

apictl secret​

Encrypt secrets for use with WSO2 API Manager using symmetric or asymmetric encryption.

  • Usage

    apictl secret [subcommand] [argument]
  • Subcommands

    initInitializes the keystore used for asymmetric encryption or the encryption key used for symmetric encryption. Use the optional symmetric argument to explicitly select symmetric mode.
    createEncrypts secrets using the initialized encryption key, or the initialized keystore. Use the optional symmetric argument to explicitly select symmetric mode.