Getting started with Flex CLI
This tutorial shows you how to get started with the Flex CLI. You will learn how to log in with your API key, how to use the help command and other basic commands.
- basic command line
- text editing
Table of Contents
Flex CLI (Command-line interface) is a tool for changing your marketplace's advanced configurations such as transaction processes and email templates.
For this tutorial you should have basic knowledge of command-line and how to run basic commands.
Now, let's get started!
Install Flex CLI
Flex CLI is distributed via npmjs. To install packages from npmjs, you will need to download and install Node.js development environment:
When you have installed Node.js and Yarn, type the following command to install Flex CLI:
yarn global add flex-cli
To verify that Flex CLI was successfully installed, run:
This command should show you the CLI version and list available commands.
Didn't work? Have a look at the Troubleshooting.
flex-cli help is the command to see the list of available commands:
In order to see subcommand help, pass the command as an argument for the
flex-cli help command. For example, let's see help for command
flex-cli help login
Get an API key
To log in you need to have a personal API key.
To get an API key, log in to Console go to Account > API keys.
After you've received your API key, you can log in
flex-cli login command. First, let's see help for the login
flex-cli help login
You can see that the command does not require any additional options. So let's run it:
The command will prompt you your API key.
After successful log in, you will be greeted by your admin email address.
Once logged in, you can work with any marketplace that you have been granted access to.
List processes and process versions
Now that you have successfully logged in and know how to use the
command, let's use CLI to list processes and process versions in your
The command to list processes is
process list. Let's see the help
flex-cli help process list
As you can see, the command requires
MARKETPLACE_ID option. You can
use either the long form
--marketplace <marketplace id here> or short
-m <marketplace id here>. You can find the Marketplace ID from
Flex Console on the
Build > General page.
Optionally the command takes
--process PROCESS NAME parameter to get
detailed information about a single process.
Let's list all the processes:
flex-cli process list -m my-test-marketplace
This command shows you a list of transaction processes in your marketplace.
In this tutorial, we installed Flex CLI, logged in using an API key and
tried some example commands. In addition, we familiarized ourselves with
help command that is the main source of documentation for the Flex
CLI. We also learned how to disable and enable the listing approval
functionality for our marketplace.
Now that we know how to list processes, the next this is to make a small change to the existing process.
flex-cli: command not found
If you're seeing
flex-cli: command not found error and you installed
Flex CLI with Yarn, you need to add
Yarn global bin path to the PATH environment variable.
yarn global binto see the global bin path
- Add it to PATH environment variable
- Restart command line
For a step-by-step guide with screenshots, have a look at this blog post: 'yarn global add' command does not work on Windows
- Open your shell configuration file. If you are using zsh, it will
export PATH="$(yarn global bin):$PATH"to the config file.
- Restart terminal