Skip to Content
Open Beta — managed Kubernetes, DNS & more are live.
💻

Install and sign in to the Patrii CLI

Updated 2026-11-20
On this page

Install and sign in to the Patrii CLI

The Patrii CLI, patrii, lets you manage your projects and resources from a terminal or a script, with the same rights you have in the console.

The CLI is a Python package named patrii-cli. It talks only to the Patrii Cloud API, so every command maps to something you can also do in the console, and it follows your project roles.

You can sign in with your email and password (plus your MFA code when it is enabled), with single sign-on in your browser, or, for scripts and pipelines, with an application credential that needs no interactive sign-in.

Key concepts

Profile — A saved set of credentials and defaults. Use several profiles to keep accounts or projects apart.

Application credential — A project-scoped ID and secret for automation; see Projects and Access.

Output format — Results print as a table by default; --output json or --output yaml suit scripts.

Before you start

  • Python 3.12 or later and pip.
  • A Patrii Cloud account, and an SSH key pair on your computer: the CLI encrypts the credentials it stores with your SSH public key.

Step by step

  1. Install the package

    Install patrii-cli with pip, ideally in a virtual environment, then check that patrii --version answers.

  2. Save your credentials

    Run patrii config init. It asks for the API URL (keep the default), your email, password and project, and stores them encrypted with your SSH key.

  3. Sign in
    • Run patrii auth login. When MFA is enabled, add --mfa-code or set PATRII_MFA_CODE.
    • Prefer patrii auth sso-login when your organization signs in with SSO: it prints a verification link and opens your browser.
  4. Pick the project and format

    Commands use your default project. Switch it with patrii project switch, or override it for one command with the global --project option. Global options go right after patrii.

  5. Automate with an application credential

    In a pipeline, export PATRII_APP_CREDENTIAL_ID and PATRII_APP_CREDENTIAL_SECRET; the CLI then signs in with them and needs no saved password or MFA code.

Examples

Install and check
python3 -m venv ~/.venvs/patrii
source ~/.venvs/patrii/bin/activate
pip install ./patrii-cli    # folder containing the package
patrii --version
Save credentials and sign in
patrii config init
patrii auth login --mfa-code 123456
patrii auth whoami
Sign in with SSO
patrii auth sso-login
Global options: project and output format
patrii project list
patrii --project <project-id> server list
patrii --output json server list
Use an application credential in a pipeline
patrii auth app-credential create --name ci-deploy
# store the secret now, it is shown only once
export PATRII_APP_CREDENTIAL_ID=<credential-id>
export PATRII_APP_CREDENTIAL_SECRET=<credential-secret>
patrii server list
Keep several accounts apart with profiles
patrii auth login --profile staging
patrii auth use staging
patrii auth list

Limits & specifications

Global options (before the command):

OptionEffect
--project, -pRun the command in another project than your default.
--output, -otable (default), json or yaml.
--region, -rOverride the default region.
--profileUse a named profile for this command.
--debugPrint request details to troubleshoot.

Best practices

  • Use an application credential, never your own password, in CI and scripts, and give it an expiry date.
  • Use --output json when a script reads the result.

FAQ

Can I use the CLI with Terraform credentials?
Yes, the same application credential works for both, but the variable names differ: the CLI reads PATRII_APP_CREDENTIAL_ID and PATRII_APP_CREDENTIAL_SECRET, while the Terraform provider reads PATRII_APPLICATION_CREDENTIAL_ID and PATRII_APPLICATION_CREDENTIAL_SECRET.
Where is the full list of commands?
Run patrii --help, then --help on any group or command, for example patrii server create --help.

Learn more

Everything you can do here in the console is also available through the Patrii Cloud API for automation and scripting.

Was this article helpful?
Thank you for your feedback. Still stuck? Contact us