> For the complete documentation index, see llms.txt.
Skip to main content

Check out Port for yourself ➜ 

Install and configure

Choose an installation method, then authenticate so you can call the Port API from the shell or CI.

Install​

Install the Port CLI in one of the following ways:

npm install -g @port-labs/port-cli
port --version

After installing, verify with port --version.

Experimental CLI

If you previously installed the experimental CLI (@port-experimental/port-cli), uninstall it first:

npm uninstall -g @port-experimental/port-cli

Authenticate​

You can authenticate with a short-lived user token (browser login) or with machine credentials (client_id and client_secret). Machine credentials do not expire, so they are less secure than a user token. Prefer browser login for interactive use, and machine credentials for CI and scripts.

Most commands work with either method. Browser login stores an OAuth token in ~/.port/creds.json.

port auth login

This opens a browser, generates a short-lived token, and lets you act on behalf of your user. Use port auth login --region when you need to pick EU or US.

After you authenticate, try a simple read or export to confirm the CLI can reach your organization, for example:

port api call /blueprints
port api blueprints list
port export --output backup.tar.gz

Configuration reference​

When the same setting is provided in more than one place, the CLI uses this order (highest wins): CLI args > env vars > config file > defaults.

For example, --api-url on the command overrides PORT_API_URL, which overrides api_url in ~/.port/config.yaml.

The CLI also loads ~/.port/.env (and a .env file in the current directory) at startup. Existing shell environment variables are not overridden.

Configuration file​

You can define multiple organizations in ~/.port/config.yaml:

default_org: production

organizations:
production:
client_id: production-client-id
client_secret: production-client-secret
api_url: https://api.getport.io/v1

staging:
client_id: staging-client-id
client_secret: staging-client-secret
api_url: https://api.getport.io/v1

Environment variables​

VariablePurpose
PORT_CLIENT_IDPort API client ID.
PORT_CLIENT_SECRETPort API client secret.
PORT_API_URLPort API URL (optional; default https://api.getport.io/v1).
PORT_CONFIG_FILEPath to the config file.
PORT_DEFAULT_ORGDefault organization name.
PORT_DEBUGEnable debug mode.

Coding agents​

Copy your client ID and client secret into an environment the agent can read (working-directory .env or ~/.port/.env), then ask the agent to install @port-labs/port-cli and run port. For cloud agents, add the same values as workspace or run secrets.

Next steps​