Skip to content

Getting started with the CLI

By the end of this page you’ll have the CLI installed, a profile configured, and your first commands running.

  • A Prefactor account with at least one environment

macOS or Linux:

Terminal window
curl -fsSL https://raw.githubusercontent.com/prefactordev/typescript-sdk/main/scripts/install.sh | bash

Windows (PowerShell):

Terminal window
irm https://raw.githubusercontent.com/prefactordev/typescript-sdk/main/scripts/install.ps1 | iex

The binary installs to ~/.prefactor/bin/prefactor on macOS/Linux or %USERPROFILE%\.prefactor\bin\prefactor.exe on Windows. The installer prints the PATH change needed if the bin directory isn’t already on your path.

Terminal window
prefactor login

This opens a browser to the Prefactor login page. After authenticating, copy your API token and paste it at the prompt. Credentials save to the default profile automatically.

Select which profile a command uses with --profile <name>.

Terminal window
# Verify access
prefactor accounts list
# List environments for your account
prefactor environments list --account_id <account_id>
# List agents in an environment
prefactor agents list --environment_id <environment_id>

prefactor accounts list should return your account. If you see an authentication error, run prefactor login again.

  • Configuration — config file format, resolution order, and environment variables
  • API tokens — create and manage the tokens your profiles use