Set up Kobiton Command Line Interface

Learn how to set up Kobiton Command Line Interface (CLI).

Before you start

  • Obtain the username and API key from a Kobiton Enterprise account.

  • Ensure Private or Local devices are available in the Kobiton Portal. Public devices are not supported.

  • Contact Kobiton Support for the link to download the CLI package. The package is available for the below platforms:

    • macOS - ARM64 (for Macs with Apple silicon)

    • Linux - x64

    • Windows - x64

Setup and authentication

  • macOS or Linux

  • Windows

Open a terminal window on the machine.

Navigate to the directory of the downloaded CLI package.

Extract the downloaded package to create the kobiton executable file.

tar -zxvf kobiton-cli.<platform>.<version>.tgz

Export the following environment variables for authentication using the command export <VARIABLE_NAME>=<VALUE>

  • KOBITON_PORTAL: the Server URL of the Kobiton Portal without /wd/hub.

    • Example: if the Server URL is https://api.kobiton.com/wd/hub, then use https://api.kobiton.com

  • KOBITON_USER: the Kobiton username

  • KOBITON_API_KEY: the Kobiton API Key

Examples
# Check the actual server URL of your Kobiton Portal
export KOBITON_PORTAL=https://api.kobiton.com
# Obtain the below from the Profile and Settings page of the Kobiton Portal
export KOBITON_USER=johndoe
export KOBITON_API_KEY=be99***0-c*df-4224-aed6-907****92d0

Put the export commands for the above variables in a .env file, then run source <env-filename> to export all variables.

Example
# The below assumes that all required export variable commands are in the file variables.env
source variables.env

Open the location of the downloaded CLI package in File Explorer.

Right-click the kobiton-cli.win-x64.<version>.zip package and select Extract All…​, then choose Extract. This results in a folder with the file kobiton.exe.

Open Powershell, then navigate to the location of the kobiton.exe file.

Export the following environment variables for authentication using the command $env:<VARIABLE_NAME>="<VALUE>" in Powershell.

  • KOBITON_PORTAL: the API URL of the Kobiton Portal

    • Example: if the Server URL is https://api.kobiton.com/wd/hub, then use https://api.kobiton.com

  • KOBITON_USER: the Kobiton username

  • KOBITON_API_KEY: the Kobiton API Key

Cloud/Hybrid
# Check the actual server URL of your Kobiton Portal
$env:KOBITON_PORTAL = "https://api.kobiton.com"
# Obtain the below from the Profile and Settings page of the Kobiton Portal
$env:KOBITON_USER = "johndoe"
$env:KOBITON_API_KEY = "be99***0-c*df-4224-aed6-907****92d0"

For Command Prompt (cmd.exe), use the below command instead to set environment variables:

set KOBITON_PORTAL=https://api.kobiton.com
set KOBITON_USER=johndoe
set KOBITON_API_KEY=be99***0-c*df-4224-aed6-907****92d0

After the CLI has been set up for the appropriate platform, run the below command from the same location as the kobiton file to check if the variables are valid and the CLI is working:

  • macOS, Linux, Windows - Powershell

  • Windows - Command Prompt

./kobiton device list --private
kobiton device list --private

If the device list is returned without any error, then the CLI is set up and ready for use.

If there is any error, follow the troubleshooting guide to resolve the issue.

Add environment variables to shell initialization script (optional)

  • macOS or Linux

  • Windows - Command Prompt

  • Windows - PowerShell

These commands can be added to your shell initialization script to persist the variables across shell sessions. Refer to external resources for help locating your shell configuration file (e.g., .bashrc, .zshrc, .bash_profile).

It is possible to also update the PATH environment variable to include the kobiton location.

# Export authentication variables
export KOBITON_PORTAL=<PORTAL_URL>
export KOBITON_USER=<USERNAME>
export KOBITON_API_KEY=<API_KEY>
# Add kobiton executable path to PATH
export PATH=$PATH:<PATH_TO_KOBITON>

Exit the current shell instance, and launch a new one to apply the changes.

Run these commands to set the permanent environment variables for shell instances. You can also update the PATH variable to include the tool directories if needed.

REM Run the below to export authentication variables
setx KOBITON_PORTAL=<PORTAL_URL>
setx KOBITON_USER=<USERNAME>
setx KOBITON_API_KEY=<API_KEY>
REM Run the below to add kobiton executable path to PATH
setx PATH "%PATH%;<PATH_TO_KOBITON>"

Exit the current shell instance, and launch a new one to apply the changes.

Run these commands to set the permanent environment variables for shell instances. You can also update the PATH variable to include the tool directories if needed.

# Run the below to export authentication variables
[System.Environment]::SetEnvironmentVariable("KOBITON_PORTAL","<PORTAL_URL>","User")
[System.Environment]::SetEnvironmentVariable("KOBITON_USER","<USERNAME>","User")
[System.Environment]::SetEnvironmentVariable("KOBITON_API_KEY","<API_KEY>","User")
# Run the below to add kobiton executable path to PATH
[System.Environment]::SetEnvironmentVariable("PATH",$env:PATH + ";<PATH_TO_KOBITON>","User")

Exit the current shell instance, and launch a new one to apply the changes.

Next steps

Start using Kobiton CLI.