Your submission was sent successfully! Close

You have successfully unsubscribed! Close

The Landscape API

Landscape’s API lets you perform many Landscape tasks from the command line or a shell script, or a Python module. You can also use the API in HTTPS calls.

The preferred means to install Landscape API is via snap:

sudo snap install --classic landscape-api

If installing Landscape API as a snap is not possible, it can be installed via apt:

sudo add-apt-repository ppa:landscape/landscape-api
sudo apt-get update
sudo apt-get install landscape-api

Once the landscape-api command is installed you can get help on all Landscape API commands by typing:

landscape-api -h

Before you use Landscape API, you must retrieve your API credentials from the Landscape dashboard. Specifically, you will need to retrieve the API access key and API secret key. To do so, click on your account name in the upper right corner of the Landscape dashboard. The keys can be passed as command-line options, but it’s easier to export them as a shell variable with commands like:

export LANDSCAPE_API_KEY="<API access key>"
export LANDSCAPE_API_SECRET="<API secret key>"
export LANDSCAPE_API_URI="https://<landscape-hostname>/api/"

If you use a custom Certificate Authority (CA), you also need to export the path to your certificate:

export LANDSCAPE_API_SSL_CA_FILE="/path/to/ca/file"

Last updated 29 days ago. Help improve this document in the forum.