Skip to main content

Salable CLI: Your Gateway to Getting Started

There are many varied ways to interact with the Salable platform, each with their own sets of functionality and recommended uses. In this guide, we’re going to be looking at the Salable Command Line Interface (CLI) and exploring how it can help you.

What is it?

As mentioned above, the CLI is a way of interfacing with Salable and performing actions via a terminal (command line) interface. So, rather than using the web interface to, for example, create an API key - you can run the following command:

salable create api-key

Because the CLI gives you programmatic access to the Salable platform, it can also be utilised in a number of more “automated” usages - such as being a step in a CI/CD pipeline or being utilised as part of a Bash shell script.

How can I access it?

In order to get started with the Salable CLI, you need to install it:

npm install -g @salable/cli

Once that has finished installing, we now need to authenticate with the CLI so it knows which account/organisation it is acting on behalf of.

To start the process of authenticating run:

salable auth

A new tab will be opened in your default browser where you can sign in. Once you've done so, you will be prompted to return to the terminal.

From this point onwards, all commands will be ran against the account you have authenticated with.

What next?

Now we’ve covered what the CLI is for, how you might want to use it, how to install it, and how to authenticate - you may be wondering what next? The best reading you can undertake to harness the full power of the CLI is our dedicated CLI documentation.

If you’re not ready for that quite yet, let’s first take a look at some common CLI commands to get your feet wet.

If your account has multiple organisations associated with it, you can change which organisation you’re acting on behalf of through the CLI by running the following command and then choosing an org from the list:

salable switch organisation

Similarly, you can also switch which “mode” your account is currently in - “test” mode or “live” mode. This can be done with the following command:

salable switch mode

This, as with the organisation switching, means that any commands you execute via the CLI in the future will have the context of which “mode” you have selected. And don’t worry, you can run the same command again to change back at any time.

Now we have our account set up the way we want, let’s start taking a look at how we can interact with our products, plans, and licenses.

When it comes to products, we can create new ones, deprecate them, or list the existing ones associated with our accounts. Let’s take a look at listing!

salable list products

And, as you’d expect - you can do the same with plans:

salable list plans

And licenses:

salable list licenses

In Conclusion

You now know all you need to know in order to get started with the Salable CLI. As mentioned before, the best place to read further is our comprehensive CLI documentation.

Remember, the CLI is just one of many ways to interact with the Salable platform. We also have a dedicated Node SDK and REST API, which may be better suited to usages in your own application code.

Good luck and go build something awesome!