> ## Documentation Index
> Fetch the complete documentation index at: https://infisical.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI reference

> Every Infisical CLI command, with its flags and examples.

# CLI reference

Every Infisical CLI command, with its arguments, flags, and examples. Select a command or flag in a heading to jump to its details.

## [Global flags](#global-flags)

Every command accepts these flags.

Run the [Infisical Agent](https://infisical.com/docs/integrations/platforms/infisical-agent.md), a daemon that authenticates as a machine identity and renders secrets into files for your application to read. This command runs the agent in the foreground. To run the agent as a service that starts when the machine boots, use [infisical agent service install](https://infisical.com/docs/cli/reference.md#agent-service-install).

Everything is set in the YAML configuration file, including the auth method, sinks, templates, and the Infisical instance in `infisical.address`, which defaults to Infisical Cloud. The global `--domain` flag has no effect. To pass the configuration without a file, set `INFISICAL_AGENT_CONFIG_BASE64` to the base64-encoded YAML. It takes precedence over `--config`.

For a daemon that only manages certificates, use [infisical cert-manager agent](https://infisical.com/docs/cli/reference.md#cert-manager-agent).

Install, start, stop, or remove a service that runs the agent, so the agent starts when the machine boots and restarts if it crashes. Each command takes the service's name, which defaults to `infisical-agent`. To run several agents with different configs on one machine, install each agent with its own name.

* On Linux, you run the commands as root, and the service is a systemd service that logs to the systemd journal (`sudo journalctl -u <name>`)
* On Windows, you run the commands from a terminal opened with **Run as administrator**, and the service is a Windows service that logs to `%ProgramData%\Infisical\Agent\<name>.log` (errors also go to the Windows Event Log)

The commands don't run on macOS. `start`, `stop`, and `uninstall` only act on services that `install` created.

Install the agent as a service that starts when the machine boots. The command doesn't start the service, so run [infisical agent service start](https://infisical.com/docs/cli/reference.md#agent-service-start) next.

The service runs as root on Linux and as LocalSystem on Windows, so it runs its own copy of the config that only administrators can change. Relative paths in the copy still resolve from the directory of the original config. The copy is:

* `/etc/infisical/agents/<name>.service-config.yaml` on Linux
* `%ProgramFiles%\Infisical\Agent\<name>\service-config.yaml` on Windows, next to the service's own copy of `infisical.exe` (to upgrade the service, uninstall it and install it again)

To change the config, edit the original, then uninstall and install the service again. If you edit the copy instead, stop and start the service to apply the change, and also make the change in the original, because `uninstall` deletes the copy.

`install` refuses a config that:

* Sets `infisical.exit-after-auth: true`, which would make the agent exit after its first render
* Reads or writes files in `/home`, `/tmp`, or `/var/tmp` on Linux, because the service can't read `/home` and has its own private `/tmp` and `/var/tmp` (keep these files in a directory such as `/etc/infisical/agents`)

Start an agent service and wait until the agent has loaded its config. If the agent can't start, the command fails and prints where to find the agent's logs.

Stop an agent service and wait for the agent to exit. If the config sets `infisical.revoke-credentials-on-shutdown: true`, the agent revokes its credentials before it exits, which can take up to five minutes. The service starts again the next time the machine boots.

Stop an agent service and remove it, along with the service's copy of the config, so changes made only to the copy are lost. The original config and the agent's logs stay where they are.

Run the agent in the foreground, as [infisical agent](https://infisical.com/docs/cli/reference.md#agent) does, with relative paths in the config resolved from the config's directory. The systemd service that [infisical agent service install](https://infisical.com/docs/cli/reference.md#agent-service-install) creates runs this command. Unlike `infisical agent`, `agent start` ignores `INFISICAL_AGENT_CONFIG_BASE64`.

Run [Agent Vault](https://infisical.com/docs/documentation/platform/agent-vault/overview.md), which lets AI agents call services such as LLM providers, GitHub, and Slack without holding the credentials. A proxy adds the real credential to each request the agent sends. Run the proxy with [infisical agent-vault proxy](https://infisical.com/docs/cli/reference.md#agent-vault-proxy), usually where agent traffic leaves your network, and launch agents through it with [infisical agent-vault run](https://infisical.com/docs/cli/reference.md#agent-vault-run). Upload skills for those agents with [infisical agent-vault skills push](https://infisical.com/docs/cli/reference.md#agent-vault-skills-push).

`av` is an alias, so `infisical av run` works wherever `infisical agent-vault run` does. Agent Vault is a different product from the agent proxy that [infisical sm agent-proxy](https://infisical.com/docs/cli/reference.md#sm-agent-proxy) runs.

Run an Agent Vault [proxy](https://infisical.com/docs/documentation/platform/agent-vault/proxies.md) in the foreground. For each request, the proxy decides whether the agent's session allows the host and attaches the real credential on the way out, so the agent never holds a secret.

Start the proxy with its proxy token. You can run the proxy on as many machines as you need with the same token. Each time the proxy starts, it loads its settings and certificate authority from Infisical. If it can't reach Infisical, it retries for 60 seconds, then starts from the cache in `--data-dir` if there is one, or exits.

You set the proxy's traffic policy, exceptions, and poll interval in Infisical, not with flags.

Launch an agent with its HTTP traffic routed through an Agent Vault proxy.

The agent needs a [session](https://infisical.com/docs/documentation/platform/agent-vault/sessions). You can provide one in either of the following ways:

* Pass `--session-token` (or set [`INFISICAL_AGENT_VAULT_SESSION_TOKEN`](#agent-vault-run--env-infisical-agent-vault-session-token)), to use an existing session that already exists in Infisical
* Pass `--access-bundle` (or set [`INFISICAL_AGENT_VAULT_ACCESS_BUNDLE`](#agent-vault-run--env-infisical-agent-vault-access-bundle)), to create a session with that [access bundle](https://infisical.com/docs/documentation/platform/agent-vault/access-bundles.md)

> [!NOTE]
>
> The CLI gives flags precedence over environment variables. If you pass either a session token or access bundle as a flag, the CLI will ignore any session token or access bundle that you've set as an environment variable.

The command also needs the proxy's address. You can provide it either by passing `--proxy` or by setting [`INFISICAL_AGENT_VAULT_PROXY_ADDRESS`](#agent-vault-run--env-infisical-agent-vault-proxy-address).

The command starts the agent with `HTTP_PROXY` and `HTTPS_PROXY` set to the proxy's address, and sets the [variables that make the agent's HTTP clients trust the proxy's certificate](https://infisical.com/docs/documentation/platform/agent-vault/proxies.md#certificate-trust). The agent inherits the rest of your environment, and the command exits with the agent's exit code.

Before the agent starts, the command installs the [skills](https://infisical.com/docs/documentation/platform/agent-vault/skills.md) in the session's access bundle in `~/.agents/skills`, and links them for Claude Code and Hermes. To install the skills in another folder, pass `--skills-dir`, and to start the agent without them, pass `--no-skills`. The installed skills stay after the agent exits. To pick up skills that changed while the agent runs, restart the agent. For which folders the command links and replaces, see [How agents get skills](https://infisical.com/docs/documentation/platform/agent-vault/skills.md#how-agents-get-skills).

Manage the [skills](https://infisical.com/docs/documentation/platform/agent-vault/skills.md) that Agent Vault installs for agents. [infisical agent-vault skills push](https://infisical.com/docs/cli/reference.md#agent-vault-skills-push) adds a skill from a folder or publishes a new version of it.

Upload a skill folder to Agent Vault. Each command pushes one folder, and the `name` in the folder's `SKILL.md` decides which skill the folder updates:

* If no skill has that name, the command creates the skill
* If a skill has that name, the command publishes the folder as the skill's next version
* If the files match the skill's latest version, the command prints `unchanged` and doesn't create a version

The command skips hidden files and folders, such as `.DS_Store`, and refuses a folder that holds a symbolic link. To push as a machine identity from a script or CI, pass `--client-id` and `--client-secret`, or set `INFISICAL_TOKEN` to the identity's access token. The user or machine identity needs the Admin role in Agent Vault.

Set up a new self-hosted Infisical instance without the web UI, for [automated deployments](https://infisical.com/docs/self-hosting/guides/automated-bootstrapping.md). The command creates an admin user, an organization, and an instance admin machine identity, and prints the result as JSON, including the machine identity's access token. Bootstrapping works only once per instance.

The machine identity has the highest privileges on the instance. Treat its token as a root credential.

With `--output=k8-secret`, the command writes the result to a Kubernetes secret instead, creating it or updating it if it exists. It must run inside a Kubernetes pod whose service account can `get`, `create`, and `update` secrets in the namespace.

Manage certificates with the Infisical Agent. [infisical cert-manager agent](https://infisical.com/docs/cli/reference.md#cert-manager-agent) runs the agent in certificate management mode.

Run the Infisical Agent in [certificate management mode](https://infisical.com/docs/documentation/platform/pki/reference/infisical-agent.md). The agent authenticates as a machine identity, requests the certificates in its configuration, writes them to disk, and renews them before they expire. It runs until it gets `SIGINT`, `SIGTERM`, or `SIGQUIT`.

On restart, the agent reuses each certificate it already issued instead of requesting a new one. It tracks each certificate in a hidden state file next to it, named `.<certificate-file>.infisical-agent-state.json`. The agent issues a new certificate if that file is missing, the certificate files changed on disk, or the certificate's configuration changed. Certificates configured with `certificate-id`, `csr`, or `csr-path` aren't reused.

The configuration can't include secret templates. To render secrets as well, use [infisical agent](https://infisical.com/docs/cli/reference.md#agent). To pass the configuration without a file, set `INFISICAL_AGENT_CONFIG_BASE64` to the base64-encoded YAML.

Run an Infisical [gateway](https://infisical.com/docs/documentation/platform/gateways/overview.md), which lets Infisical reach resources in a private network, such as a database in a private subnet. A gateway either connects out to a relay, so it needs no inbound firewall rules, or listens for Infisical to connect to it directly. Run it in the foreground with [infisical gateway start](https://infisical.com/docs/cli/reference.md#gateway-start), or as a systemd service with [infisical gateway systemd install](https://infisical.com/docs/cli/reference.md#gateway-systemd-install).

Start a gateway in the foreground. A gateway authenticates in one of two ways.

With `--enroll-method`, the gateway authenticates as itself. With `token`, it exchanges a one-time enrollment token from Infisical for an access token on first start. With `aws`, `gcp`, or `kubernetes`, it proves its cloud identity on each start. It saves its credentials to `~/.infisical/gateways/<name>.conf`, or `/etc/infisical/gateways/<name>.conf` when run as root, so later starts need only the name.

With `--auth-method` or `--token`, the gateway logs in as a machine identity instead, using the same flags as [infisical login](https://infisical.com/docs/cli/reference.md#login).

Install or remove a systemd service that runs a gateway. Both commands run only on Linux, as root.

Install and enable a systemd service that runs the gateway. The service is named after the gateway, and its configuration is written to `/etc/infisical/gateways/<name>.conf`. Start it with `sudo systemctl start <name>`. Run the command as root on Linux.

Stop and remove a gateway's systemd service. Run the command as root on Linux.

Link the current directory to an Infisical project. The command lists the projects in your profile's organization and writes the one you choose to `.infisical.yaml`, so later commands in this directory and its subdirectories know which project to use. It needs a user login, and starts one if you have no profile.

If the current directory already has an `.infisical.yaml` or a legacy `.infisical.json`, the command asks before writing a new `.infisical.yaml`. The new file holds only the project ID, and the CLI reads it instead of the old file, so settings you added, such as the default environment, no longer apply. To keep those settings, edit the existing file instead of running `init`. See [project config](https://infisical.com/docs/cli/project-config.md) for the file format.

> [!NOTE]
>
> If you run `init` without a terminal, such as in CI or from a script, the command never prompts. It exits with an error unless you pass `--project-id`, and it doesn't replace an existing `.infisical.yaml` or legacy `.infisical.json`. To link a different project, edit `secrets-management.project-id` in `.infisical.yaml`, or `workspaceId` in a legacy `.infisical.json`.

Run a [KMIP](https://infisical.com/docs/documentation/platform/kms/kmip.md) server, which lets clients that use the Key Management Interoperability Protocol (KMIP) use Infisical as their key manager. Run it in the foreground with [infisical kmip start](https://infisical.com/docs/cli/reference.md#kmip-start), or as a systemd service with [infisical kmip systemd install](https://infisical.com/docs/cli/reference.md#kmip-systemd-install).

Start a KMIP server in the foreground. It authenticates to Infisical either by enrolling with `--enroll-method`, or as a machine identity with `--identity-client-id` and `--identity-client-secret`.

Install or remove a systemd service that runs a KMIP server. Both commands run only on Linux, as root.

Install and enable a systemd service that runs the KMIP server. Run the command as root on Linux.

Stop and remove the KMIP server's systemd service. Run the command as root on Linux.

Log in to Infisical. By default, `infisical login` opens a browser, and falls back to prompts in the terminal if the browser login fails. Pass `--interactive` to go straight to the prompts, or `--email`, `--password`, and `--organization-id` to log in with no prompts at all.

Without a terminal (when standard input isn't a TTY), the browser login waits for the browser to send the session back to the CLI, and doesn't offer to let you paste a token instead.

A user login is stored as a [profile](https://infisical.com/docs/cli/reference.md#profile): an account on an Infisical instance, plus the organization it uses. Without `--save-as` or `--profile`, the profile is named after the account and organization, such as `scott@example.com--acme-x4k2`. Credentials are kept in your system keyring; see [infisical vault](https://infisical.com/docs/cli/reference.md#vault) to store them elsewhere.

If you log in as a machine identity (any `--method` other than `user`), the CLI doesn't create a profile. It prints an access token, which later commands read from `--token` or `INFISICAL_TOKEN`.

For any instance other than US Cloud, pass `--domain` or set `INFISICAL_DOMAIN`.

Show whether the CLI is authenticated to Infisical and, when available, the organization the session is scoped to. It checks the session of the profile in effect, or a machine identity token set in the environment.

End a login session. The CLI removes the profile's stored credentials from this machine, and revokes its session on the server unless another profile still uses that session.

The command also deletes the secrets the CLI saved for offline use. Every profile on this machine shares them, so they're deleted even when other profiles stay logged in, and the CLI saves them again the next time a profile fetches secrets.

The profile itself is kept, so `infisical login --profile <name>` signs back in without setting it up again. To remove the profile, run [infisical profile delete](https://infisical.com/docs/cli/reference.md#profile-delete).

Without `--all` or `--profile`, the command logs out of the profile in effect. See [infisical profile](https://infisical.com/docs/cli/reference.md#profile) for how that profile is chosen.

Convert a legacy `.infisical.json` into `.infisical.yaml`. The command looks for the project config in the current directory, then in each parent directory. It writes `.infisical.yaml` next to the file it finds, copies every setting into it, and deletes `.infisical.json`.

If the project already uses `.infisical.yaml`, the command changes nothing. It warns you when a leftover `.infisical.json` sits in the same directory, because `.infisical.yaml` takes precedence and the old file is no longer read. See [Migrate to .infisical.yaml](https://infisical.com/docs/cli/project-config-migration.md) for the full steps.

List organizations, and change the one your profile uses.

The organization is a setting on your login profile, not a separate login. Run [infisical profile current](https://infisical.com/docs/cli/reference.md#profile-current) to see the profile and organization in effect, and pass `--org` to any command to use a different organization for that command only.

List the organizations that the current profile's account can use. The organization the profile uses is marked.

Change the current profile's organization. This is the same command as [infisical profile set-org](https://infisical.com/docs/cli/reference.md#profile-set-org).

To use a different organization for a single command, pass `--org` to that command instead. To keep a second organization available at the same time, give it its own profile with [infisical profile create](https://infisical.com/docs/cli/reference.md#profile-create).

Connect to databases, servers, Kubernetes clusters, and cloud accounts managed by [Infisical Privileged Access Management (PAM)](https://infisical.com/docs/documentation/platform/pam/overview.md) from your terminal. A gateway supplies each account's credential, so you never see it, and every session is recorded. Open one account for yourself with [infisical pam access](https://infisical.com/docs/cli/reference.md#pam-access), or give an AI agent brokered access with [infisical pam agentic access](https://infisical.com/docs/cli/reference.md#pam-agentic-access).

Open a session for one PAM account. The command runs as the user you logged in as with [infisical login](https://infisical.com/docs/cli/reference.md#login); it doesn't accept a machine identity. To open accounts for an agent, use [infisical pam agentic access](https://infisical.com/docs/cli/reference.md#pam-agentic-access).

SSH accounts connect you to a shell on the target. Pass a command after `--` to run only that command, or `--proxy` to start a local proxy instead. If no terminal is attached, the CLI starts the proxy instead of a shell.

For database, Redis, Snowflake, Kubernetes, GCP, Azure, and Windows accounts, the CLI starts a local proxy on `127.0.0.1` and prints how to connect to it. For AWS IAM accounts, the CLI writes temporary credentials to your AWS credentials file instead. The page for each [account type](https://infisical.com/docs/documentation/platform/pam/accounts/account-types) describes how to connect. A proxy runs until you press `Ctrl+C` or the session expires, and the CLI then restores anything it changed, such as your kubeconfig.

If the account requires approval, the CLI offers to submit an access request in an interactive terminal. If it requires MFA, the CLI has you complete MFA in your browser before it continues.

Run AI agents against PAM accounts. The agent reaches each account through a local proxy and never holds a credential. Start a run with [infisical pam agentic access](https://infisical.com/docs/cli/reference.md#pam-agentic-access), and see [AI agents](https://infisical.com/docs/documentation/platform/pam/ai-agents/overview.md) for how it works.

Start a local proxy for each PAM account you can launch, then start an AI agent with instructions for reaching them. Everything after `--` is the command that starts the agent. The `--` is required when that command has flags of its own.

The CLI gives each account its own port on `127.0.0.1`, and the agent connects through those ports without ever holding a credential. The CLI skips accounts that require MFA and accounts of [types agentic access doesn't support](https://infisical.com/docs/documentation/platform/pam/ai-agents/run.md#supported-account-types), and lists each skipped account with the reason. To open a skipped account, use [infisical pam access](https://infisical.com/docs/cli/reference.md#pam-access).

The CLI [adds instructions for reaching the accounts](https://infisical.com/docs/documentation/platform/pam/ai-agents/instructions.md) to the agent's system prompt or to a file such as `AGENTS.md`, depending on the agent. It runs the agent in an [OS sandbox](https://infisical.com/docs/documentation/platform/pam/ai-agents/run.md#sandbox), which stops the agent from reading your Infisical login. On a host without a sandbox, the command fails unless you pass `--no-sandbox`.

The run authenticates with `--token` when one is set, then as a machine identity when `--auth-method` is set, and otherwise as the user you logged in as with [infisical login](https://infisical.com/docs/cli/reference.md#login).

Manage login profiles. A profile is one login: an account on one instance, plus the organization it uses by default. Selecting a profile selects all three, so switching between organizations or instances never means logging in again.

Create your first profile with [infisical login](https://infisical.com/docs/cli/reference.md#login), one per extra organization with [infisical profile create](https://infisical.com/docs/cli/reference.md#profile-create), and one per extra account or instance with `infisical login --save-as <name>`.

A command uses the first of these that's set:

1. `--profile` on the command
2. The `INFISICAL_PROFILE` environment variable, set by [infisical profile pin](https://infisical.com/docs/cli/reference.md#profile-pin)
3. A directory bound with [infisical profile bind](https://infisical.com/docs/cli/reference.md#profile-bind)
4. The machine's default profile, set with [infisical profile use](https://infisical.com/docs/cli/reference.md#profile-use)

Bind a directory, and everything under it, to a profile. Commands run inside that directory select the profile with no flag or environment variable, so moving between projects moves between organizations.

If several parent directories are bound, the closest one applies. Bindings are stored in your CLI configuration, never in the repository. Remove one with [infisical profile unbind](https://infisical.com/docs/cli/reference.md#profile-unbind).

Create a profile for another organization without logging in again. The new profile reuses the account and instance you're signed in to, scoped to the organization you choose, so both organizations stay usable at the same time. Pass the organization with `--org`, or pick it when asked.

Creating a profile doesn't change which profile other terminals use. Pass `--pin` to start using it in this terminal, or `--use` to make it the default for the machine.

To add a different account, or an account on another instance, use `infisical login --save-as <name>` instead.

Show which profile the CLI uses in this terminal and directory, and why.

Delete a profile and its stored credentials. The CLI also revokes the profile's session on the server, unless another profile still uses that session.

List every login profile on this machine.

Pin the current terminal to a profile. Only this terminal changes: the default profile and every other terminal keep what they were using, so you can work in several organizations at once. Undo it with [infisical profile unpin](https://infisical.com/docs/cli/reference.md#profile-unpin).

The command prints an `export` statement for POSIX shells such as Bash and Zsh, so run it through `eval`. If you run it without `eval`, it prints the `eval` form and changes nothing. In PowerShell, set the variable directly with `$env:INFISICAL_PROFILE = 'acme'`. In scripts and CI, set `INFISICAL_PROFILE` or pass `--profile` instead.

Rename a profile. Its stored session, the default-profile setting, and directory bindings all follow the new name. Terminals pinned to the old name with [infisical profile pin](https://infisical.com/docs/cli/reference.md#profile-pin) keep pointing at it and need pinning again.

Change the current profile's organization. This is the same command as [infisical org switch](https://infisical.com/docs/cli/reference.md#org-switch).

To use a different organization for a single command, pass `--org` to that command instead. To keep a second organization available at the same time, give it its own profile with [infisical profile create](https://infisical.com/docs/cli/reference.md#profile-create).

Remove a directory's profile binding.

Remove the current terminal's profile pin, so it falls back to a bound directory or the default profile.

The command prints an `unset` statement, so run it through `eval`. If you run it without `eval`, it prints the `eval` form and changes nothing. In PowerShell, run `Remove-Item Env:INFISICAL_PROFILE` instead.

Make a profile the default for this machine. Commands use the default when nothing more specific applies. To choose a profile for one terminal, use [infisical profile pin](https://infisical.com/docs/cli/reference.md#profile-pin), and for one directory, use [infisical profile bind](https://infisical.com/docs/cli/reference.md#profile-bind).

Run the [Infisical Proxy](https://infisical.com/docs/integrations/platforms/infisical-proxy.md), which sits between your applications and Infisical and caches secret responses, so applications keep getting secrets when Infisical is unreachable.

Start the Infisical Proxy. Point your applications at its `--listen-address` instead of your Infisical instance. They call the same API endpoints with the same credentials, and the proxy forwards requests, caches the responses, and refreshes the cache.

Run an Infisical [relay](https://infisical.com/docs/documentation/platform/gateways/relay-deployment), which carries traffic between Infisical and your gateways, so gateways need only outbound connections. Run it in the foreground with [infisical relay start](https://infisical.com/docs/cli/reference.md#relay-start), or as a systemd service with [infisical relay systemd install](https://infisical.com/docs/cli/reference.md#relay-systemd-install).

Start a relay in the foreground. An organization relay authenticates by enrolling with `--enroll-method`, or as a machine identity with the same flags as [infisical login](https://infisical.com/docs/cli/reference.md#login). An instance relay authenticates with the secret in `INFISICAL_RELAY_AUTH_SECRET`.

Install or remove a systemd service that runs a relay. Both commands run only on Linux, as root.

Install and enable a systemd service that runs the relay. Run the command as root on Linux.

Stop and remove a relay's systemd service. Run the command as root on Linux.

Delete all the data the CLI stores on your machine and return it to its default state. Use it when a problem persists and you want a clean start.

The command revokes the session of every profile on the server, then deletes every profile's credentials from your system keyring and deletes the `~/.infisical` directory. That directory also holds cached secrets and the credentials that gateways, relays, and KMIP servers saved when you ran them as a non-root user, so those are deleted too. A session that can't be revoked stays valid until it expires, and the command prints a warning for it. `.infisical.yaml` and `.infisical.json` files in your projects aren't touched.

Log in again with [infisical login](https://infisical.com/docs/cli/reference.md#login) afterwards. Directory bindings are deleted with the rest of the configuration, and terminals pinned with [infisical profile pin](https://infisical.com/docs/cli/reference.md#profile-pin) point to a profile that no longer exists.

Scan a Git repository's history, a directory, or standard input for leaked secrets. The scan runs locally and doesn't need an Infisical login.

By default, the CLI reads `git log -p` for every commit on every branch of the repository at `--source`. Pass `--log-opts` to choose the commits, `--no-git` to scan the files in their current state, or `--pipe` to scan standard input.

To change the rules or skip known findings, see [Scan code locally with the CLI](https://infisical.com/docs/documentation/platform/secret-scanning/scan-locally.md).

The command exits with `--exit-code` when it finds leaks, and with `1` when the scan fails.

Scan the uncommitted changes in a Git repository for leaked secrets, by reading `git diff`. Without `--staged`, the scan covers changes you haven't staged yet. With it, the scan covers what the next commit will contain, which makes it suited to a pre-commit hook. [infisical scan install](https://infisical.com/docs/cli/reference.md#scan-install) sets one up.

The scan uses the same config and `.infisicalignore` file as [infisical scan](https://infisical.com/docs/cli/reference.md#scan), and exits with `--exit-code` when it finds leaks.

Install a Git pre-commit hook in the current repository with `--pre-commit-hook`. Without that flag, the command does nothing.

The hook runs `infisical scan git-changes -v --staged` before each commit and blocks the commit when it finds secrets. The CLI writes it to `.git/hooks/pre-commit`, or adds it to the end of that file if one exists. To turn the hook off in a repository, run `git config hooks.infisical-scan false`.

Manage service tokens. Service tokens are deprecated and will be removed in a future release. Use a [machine identity](https://infisical.com/docs/documentation/platform/identities/machine-identities.md) instead, and log in as it with [infisical login](https://infisical.com/docs/cli/reference.md#login).

Create a service token for a project with your user login. Service tokens are deprecated; create a [machine identity](https://infisical.com/docs/documentation/platform/identities/machine-identities.md) instead.

Without `--token-only`, the command prints the token's name, project, access, scopes, and the token itself to standard error, so capturing standard output gets nothing.

Manage secrets from the command line. The `sm` commands inject secrets into a process, export them to a file, read and write them, lease credentials from [dynamic secrets](https://infisical.com/docs/documentation/platform/dynamic-secrets/overview), run the [Agent Proxy](https://infisical.com/docs/documentation/platform/agent-proxy/overview), and list and create projects.

> [!NOTE]
>
> If `infisical --version` prints 0.43.145 or earlier, your CLI doesn't have `sm`. [Upgrade the CLI](https://infisical.com/docs/cli/upgrade.md), or run the commands without `sm`, such as `infisical run` instead of `infisical sm run`. For the Agent Proxy, use `infisical secrets agent-proxy` instead of `infisical sm agent-proxy`.

Run the [Infisical Agent Proxy](https://infisical.com/docs/documentation/platform/agent-proxy/overview), which lets AI agents and untrusted code use secrets without holding them. Agents send their HTTP requests through the proxy, which replaces placeholder credentials with real ones before forwarding each request, so the agent never holds the real secret.

For an agent on your own computer, [infisical sm agent-proxy run](https://infisical.com/docs/cli/reference.md#sm-agent-proxy-run) starts a proxy and a sandboxed agent together. For a proxy shared across your network, run [infisical sm agent-proxy start](https://infisical.com/docs/cli/reference.md#sm-agent-proxy-start) on its own host, and launch agents behind it with [infisical sm agent-proxy connect](https://infisical.com/docs/cli/reference.md#sm-agent-proxy-connect).

Launch an agent that sends its requests through an agent proxy on another host, started with [infisical sm agent-proxy start](https://infisical.com/docs/cli/reference.md#sm-agent-proxy-start). See [Standalone Agent Proxy](https://infisical.com/docs/documentation/platform/agent-proxy/standalone-agent-proxy).

The command authenticates as the agent's machine identity, with `--client-id` and `--client-secret` or a token. It doesn't use your login. It then starts the agent with `HTTP_PROXY` and `HTTPS_PROXY` set to the proxy's address, and sets the variables that make the agent's HTTP clients trust your organization's root certificate. See [what `connect` puts in the agent's environment](https://infisical.com/docs/documentation/platform/agent-proxy/standalone-agent-proxy#what-connect-puts-in-the-agent’s-environment).

If the agent can read a secret or lease a dynamic secret that a proxied service brokers to it, the command refuses to start, because the agent would get the real value and bypass the proxy.

The command exits with the agent's exit code.

Launch an agent on your own computer in an OS sandbox, with a proxy that brokers credentials onto its requests. The command starts the proxy, runs the agent, and stops the proxy when the agent exits. It authenticates as your login, or with `--token`. See [Local Agent Proxy](https://infisical.com/docs/documentation/platform/agent-proxy/local-agent-proxy).

The [sandbox](https://infisical.com/docs/documentation/platform/agent-proxy/local-agent-proxy#the-sandbox) stops the agent from reading credential files such as `~/.ssh` and `~/.aws`. If the host supports it, the sandbox also blocks every network connection except the one to the proxy. The sandbox needs macOS, or Linux with `bubblewrap` installed. On any other system, the command won't start unless you pass `--no-sandbox`.

The agent never gets real secret values or an Infisical token. It gets placeholder values for [proxied services](https://infisical.com/docs/documentation/platform/agent-proxy/proxied-services) that substitute credentials into requests. The command [removes variables that look like credentials](https://infisical.com/docs/documentation/platform/agent-proxy/local-agent-proxy#environment-scrubbed) from the agent's environment, such as any variable with `TOKEN` or `SECRET` in its name. To keep one of those variables, pass its name to `--pass-env`.

The command always starts its own proxy. To use a proxy on another host, run [infisical sm agent-proxy connect](https://infisical.com/docs/cli/reference.md#sm-agent-proxy-connect).

Start an agent proxy in the foreground, for agents on other hosts to connect to with [infisical sm agent-proxy connect](https://infisical.com/docs/cli/reference.md#sm-agent-proxy-connect). See [Standalone Agent Proxy](https://infisical.com/docs/documentation/platform/agent-proxy/standalone-agent-proxy).

The proxy authenticates as its own machine identity, which needs read access to the secrets your proxied services reference, and renews its access token as it runs. The proxy logs brokered requests at `info` and blocked requests at `warn`. To also see requests passed through without a credential, pass `--log-level=debug`.

List the [dynamic secrets](https://infisical.com/docs/documentation/platform/dynamic-secrets/overview) in an environment and folder, with each one's provider, default TTL, and max TTL. A dynamic secret generates credentials on demand, such as a database user, and each set of credentials it generates is a lease. Manage leases with [infisical sm dynamic-secrets lease](https://infisical.com/docs/cli/reference.md#sm-dynamic-secrets-lease).

Create, list, renew, and delete the leases of a dynamic secret.

Generate a new set of credentials from a dynamic secret. The command prints the lease ID, when the lease expires, and the credentials. Keep the lease ID to renew or delete the lease later, or find it with [infisical sm dynamic-secrets lease list](https://infisical.com/docs/cli/reference.md#sm-dynamic-secrets-lease-list).

The table and `--plain` show only credentials whose values are strings. Pass `--output` to get every credential the provider returns.

Delete a lease before it expires, and revoke its credentials with the provider. `--env` and `--path` must point to the folder that holds the lease's dynamic secret, or Infisical reports that the lease doesn't exist.

List the active leases of a dynamic secret, with each lease's ID, expiry time, and creation time.

Extend a lease before it expires, and print its new expiry time. A renewal can't push the lease past the dynamic secret's max TTL, counted from when the lease was created. `--env` and `--path` must point to the folder that holds the lease's dynamic secret, or Infisical reports that the lease doesn't exist.

Print an environment's secrets in a file format such as `.env` or JSON, for tools that read configuration from a file. Output goes to standard output unless you pass `--output-file`.

`dotenv` writes each secret as `KEY='value'`, and `dotenv-export` adds `export` in front. Neither escapes quotes inside values. `dotenv-eval` also writes `export` statements, but quotes each value so the output is safe to load with `eval` or `source`. No format escapes secret names, so load output into a shell only when every name is a valid shell variable name.

`--template` takes a Go template that fetches secrets with the functions the [Infisical Agent](https://infisical.com/docs/integrations/platforms/infisical-agent.md#available-secret-template-functions) provides, such as `listSecrets` and `getSecretByName`.

List, inspect, and create Secrets Management [projects](https://infisical.com/docs/documentation/platform/project.md). Use these commands to find the project ID that [infisical init](https://infisical.com/docs/cli/reference.md#init) and the `--projectId` flag take, or to create a project without opening Infisical. `project` is an alias, so `infisical sm project list` also works.

> [!NOTE]
>
> The commands work only with Secrets Management projects. Projects of other products, such as Certificate Management or KMS, don't appear in the list.

Create a Secrets Management project in your organization with the Development, Staging, and Production environments.

The user or machine identity that creates the project becomes the project's admin. The command prints the project and its environments, followed by the `infisical init` command that links the current directory to the project.

> [!NOTE]
>
> Service tokens can't create projects. If your environment stores a service token in `INFISICAL_TOKEN`, the command uses your login instead.

Show a project's name, slug, and ID, and the name, slug, and ID of each of its environments. Use an environment's slug with the `--env` flag of other `sm` commands.

List the name, slug, and ID of each Secrets Management project you're a member of in your organization. With a machine identity, the command lists the projects the identity is a member of.

> [!NOTE]
>
> Service tokens can't create projects. If your environment stores a service token in `INFISICAL_TOKEN`, the command uses your login instead.

Inject secrets from Infisical into a process as environment variables. The CLI fetches the secrets for the project linked in [`.infisical.yaml`](https://infisical.com/docs/cli/project-config), or the one you pass with `--projectId`, and starts your command with them set.

Secrets override variables that are already set in your shell. Secrets named `HOME`, `PATH`, `PS1`, `PS2`, `PWD`, `EDITOR`, `XAUTHORITY`, `USER`, `TERM`, `TERMINFO`, `SHELL`, or `MAIL`, or starting with `XDG_` or `LC_`, are never injected.

Print the secrets in an environment and folder as a table. Pass `--output` to print them as JSON, YAML, or dotenv instead.

Delete secrets by name.

Without `--type`, the command deletes your personal secrets with those names. Pass `--type=shared` to delete the shared secrets that everyone on the project sees.

Create, delete, and list the folders in an environment. Folders organize an environment's secrets into paths such as `/backend/api`.

Create a folder named `--name` inside `--path`.

Delete the folder named `--name` inside `--path`.

List the folders inside `--path`.

Print an example `.env` file that lists every secret's name without its value, for people who work on the project without Infisical.

Each secret's comment in Infisical appears as a comment above it. To give a secret an example value, add `DEFAULT:<value>` to the end of its comment.

Print the secrets you name. A name that doesn't exist prints as `*not found*`.

In scripts, pass `--plain --silent` to print only the values, with no other output.

Create secrets, or update the value of secrets that already exist. The result table masks values unless you pass `--show-values`.

You can set secrets without permission to read secret values. In that case, the CLI can't compare values, so it writes every secret you pass that already exists and reports each one as `SECRET VALUE MODIFIED`, even when the value didn't change.

Your shell saves the values you pass on the command line in its history file. To keep them out, pass `--file` or `name=@path`, or [set your shell to skip these commands](https://infisical.com/docs/cli/faq.md).

> [!WARNING]
>
> Infisical SSH has been removed, so these commands no longer work. SSH access is now part of Infisical PAM: set up an [SSH account](https://infisical.com/docs/documentation/platform/pam/accounts/ssh), then connect to it with [infisical pam access](https://infisical.com/docs/cli/reference.md#pam-access).

> [!WARNING]
>
> Removed along with Infisical SSH, so this command no longer works. See [infisical ssh](https://infisical.com/docs/cli/reference.md#ssh).

> [!WARNING]
>
> Removed along with Infisical SSH, so this command no longer works. To reach SSH hosts through Infisical, use [infisical pam access](https://infisical.com/docs/cli/reference.md#pam-access). See [infisical ssh](https://infisical.com/docs/cli/reference.md#ssh).

> [!WARNING]
>
> Removed along with Infisical SSH, so this command no longer works. See [infisical ssh](https://infisical.com/docs/cli/reference.md#ssh).

> [!WARNING]
>
> Removed along with Infisical SSH, so this command no longer works. See [infisical ssh](https://infisical.com/docs/cli/reference.md#ssh).

Manage machine identity access tokens. The only subcommand is [infisical token renew](https://infisical.com/docs/cli/reference.md#token-renew).

Renew a machine identity access token, such as one printed by `infisical login --method=universal-auth`, and print the renewed token. How long a token can be renewed for is set by the machine identity's **Access Token TTL** and **Access Token Max TTL**. Service tokens, which start with `st.`, can't be renewed.

The command doesn't use your login profile, so for any instance other than US Cloud, pass `--domain` or set `INFISICAL_DOMAIN`.

Print a profile's session token, pick the default profile from a list, or move a profile to another instance. For everything else, use [infisical profile](https://infisical.com/docs/cli/reference.md#profile).

Print details of a login profile. The only subcommand is [infisical user get token](https://infisical.com/docs/cli/reference.md#user-get-token).

Print the access token of the profile in effect, along with its session ID, expiry time, and remaining lifetime. Pass `--profile` to read another profile's token, or `--org` to get a token for a different organization. See [infisical profile](https://infisical.com/docs/cli/reference.md#profile) for how the profile in effect is chosen.

If the session has expired, or you have no profile yet, the CLI runs `infisical login` first.

Pick the machine's default profile from a list of your profiles, each shown with its account, organization, and instance. This does the same as [infisical profile use](https://infisical.com/docs/cli/reference.md#profile-use), which takes the profile name instead of asking.

A terminal pinned with [infisical profile pin](https://infisical.com/docs/cli/reference.md#profile-pin) or a directory bound with [infisical profile bind](https://infisical.com/docs/cli/reference.md#profile-bind) keeps using its own profile.

Change a login profile. The only subcommand is [infisical user update domain](https://infisical.com/docs/cli/reference.md#user-update-domain).

Point a profile at a different Infisical instance, such as moving it from Infisical Cloud to your self-hosted instance. The command asks which profile to change, then for the new instance's URL. Only the profile you pick changes, even when other profiles use the same account and instance.

A session issued by the old instance isn't valid on the new one, so the CLI clears the profile's stored credentials and its organization. Sign in again with `infisical login --profile <name> --domain <url>`.

Show where the CLI stores your login credentials, and list the vaults you can switch to with [infisical vault set](https://infisical.com/docs/cli/reference.md#vault-set).

There are two vaults. `auto`, the default, uses your system keyring: the macOS Keychain, Windows Credential Manager, or the Secret Service on Linux. If the CLI can't write to the system keyring the first time it stores credentials, it switches to `file` on its own. `file` stores credentials encrypted in `~/infisical-keyring`, with a random passphrase kept in the CLI's config file, `~/.infisical/infisical-config.json`.

Change where the CLI stores your login credentials. See [infisical vault](https://infisical.com/docs/cli/reference.md#vault) for what each vault is.

Credentials in the previous vault can't be read from the new one, so switching removes every profile, the default profile, and every directory binding. Log in again with [infisical login](https://infisical.com/docs/cli/reference.md#login) afterwards. Credentials already in the previous vault aren't deleted.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.