CLI
The nullplatform CLI allows you to:
- Manage your nullplatform resources directly from the command line.
- Interact with the nullplatform API.
- Work with your CI/CD pipelines and automate workflows.
Installation
-
To install or update the latest version of the nullplatform CLI:
curl https://cli.nullplatform.com/install.sh | sh💡 Check the latest version using
np --version. -
(Not recommended) To install a previous version, run:
curl https://cli.nullplatform.com/install.sh | VERSION=<n.n.n> shReplace
<n.n.n>with the desired version number, for example1.2.3.
Authentication
Before using the CLI, you need to authenticate using either an API key or an access token.
API keys
You can generate a personal or machine API key to use with the CLI. This is a persistent authentication method that can be used to generate access tokens.
-
Use an API key as a flag:
np [command] --api-key your_api_key -
Or export it as an environment variable:
export NULLPLATFORM_API_KEY=your_api_key_here
For more info on API keys, see Manage API keys.
Access token
You can also authenticate using a personal access token.
-
As with API keys, you can use an access token as a flag:
np [command] --access-token your_access_token -
Or export it as an environment variable:
export NP_TOKEN=your_access_token
How do I get an access token?
To retrieve your personal access token:
- Log in to nullplatform.
- Click your user menu (the circle with your initials/user avatar) in the top-right corner.
- From the dropdown menu, select Copy personal access token.
Alternatively, you can use the legacy Chrome extension to retrieve the token.
How to use the CLI
Check out our API reference, where you'll find CLI examples for every supported endpoint. Simply search for the endpoint you need to see an example for.
Use np --help to get information on all available commands.
Below is a full example for reference:
# Using environment variable authentication
export NULLPLATFORM_API_KEY=your_api_key_here
np account create --body '{ "name": "mocked-name-1", "slug": "mocked-slug-1", "organization_id": 123, "repository_prefix": "mocked-prefix-1", repository_provider": "github", "status": "active"
}'
# Or using command-line flag
np account create --body '{ "name": "mocked-name-1", "slug": "mocked-slug-1", "organization_id": 123, "repository_prefix": "mocked-prefix-1", repository_provider": "github", "status": "active"
}' --format json --access-token your_access_token
# Example response:
{
"id": 515151,
"name": "mocked-name-1",
"nrn": "organization=123",
"organization_id": 123,
"repository_prefix": "mocked-prefix-1",
"repository_provider": "github",
"slug": "mocked-slug-1",
"status": "active"
}