Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
---
title: "CLI quickstart"
sidebarTitle: "Quickstart"
description: "Get started with the Infisical CLI."
---
import InstallCli from "/snippets/cli/install-cli.mdx";
import LogIn from "/snippets/cli/local-development/log-in.mdx";
Every Infisical product that has a CLI workflow starts the same way: install the CLI, log in, and check that the CLI can reach your Infisical instance. This page covers those steps, then links to the command reference.
<Tip>
If you prefer to learn by watching, follow along with our [video walkthrough of the Infisical CLI](https://www.youtube.com/watch?v=WQz6BCygORA).
</Tip>
## Prerequisites
- An Infisical account on [Infisical Cloud](https://app.infisical.com) or on a [self-hosted instance](/self-hosting/overview)
## Step 1: Install the CLI
Install the CLI with the package manager for your operating system.
<InstallCli />
Check that the installation worked:
```bash
infisical --version
```
## Step 2: Log in
Log in with your own account when you run the CLI yourself, such as on your laptop during local development. Log in as a [machine identity](/documentation/platform/identities/machine-identities) when the CLI runs without you, such as in a CI/CD pipeline, a container, a scheduled job, or a script on a shared server.
<Note>
If your Infisical instance is behind a service that requires its own headers, such as Cloudflare Access, [ set those up first](/cli/faq#how-do-i-use-custom-headers-with-the-infisical-cli).
</Note>
<Tabs>
<Tab title="Your own account">
<LogIn />
The CLI saves the instance you select with your login, so later commands use it without asking again.
</Tab>
<Tab title="Machine identity">
<Steps>
<Step>
Follow the [Universal Auth guide](/documentation/platform/identities/universal-auth) to create a machine identity and get a **Client ID** and **Client Secret** for it.
</Step>
<Step>
If you use EU Cloud, a dedicated instance, or a self-hosted instance, set `INFISICAL_DOMAIN` to the address of your instance. A machine identity login doesn't save the instance, so without `INFISICAL_DOMAIN` every command goes to US Cloud (`https://app.infisical.com`).
<CodeGroup>
```bash macOS/Linux
export INFISICAL_DOMAIN="https://your-domain.infisical.com"
```
```powershell Windows (PowerShell)
setx INFISICAL_DOMAIN "https://your-domain.infisical.com"
```
</CodeGroup>
On Windows, `setx` saves the variable for new sessions only, so restart PowerShell before you run the next command.
To set the instance another way, such as with the `--domain` flag or in `.infisical.yaml`, see [Set the Infisical instance](/cli/project-config#set-the-infisical-instance).
</Step>
<Step>
Log in with the client ID and client secret, and store the access token in the `INFISICAL_TOKEN` environment variable:
```bash
export INFISICAL_TOKEN=$(infisical login --method=universal-auth --client-id=<identity-client-id> --client-secret=<identity-client-secret> --silent --plain)
```
`--plain` prints only the token, and `--silent` hides update and tip messages, so the command's output is just the token. The CLI reads `INFISICAL_TOKEN` automatically, so every later command in the same shell is authenticated.
</Step>
</Steps>
</Tab>
</Tabs>
## Step 3: Check that you're logged in
```bash
infisical login status
```
The CLI asks your Infisical instance whether your login is valid. If it is, the output starts with the account or machine identity you're logged in as, followed by the instance the CLI connected to:
```text
✓ Authenticated as <your-email-or-identity-name>
- Domain: https://app.infisical.com
```
The lines after `Domain` include when your login expires and which organization it belongs to. If the output says `You are not authenticated`, log in again. If it says `Failed to authenticate`, check that the `Domain` line shows your instance, then log in again.
<Check>
You successfully installed and logged into the Infisical CLI.
</Check>
## Next steps
Now that you've installed the CLI and logged in, you can start using its commands.
<Card title="Command reference" icon="square-terminal" href="/cli/reference" horizontal>
See every CLI command, with its arguments, flags, and examples
</Card>