Skip to main content

Description

Export environment variables from the platform into a file format. By default, output is sent to stdout (standard output), but you can use the --output-file flag to save directly to a file.

Subcommands & flags

infisical export

Use this command to export environment variables from the platform into a raw file formats

Environment variables

Used to fetch secrets via a machine identities apposed to logged in credentials. Simply, export this variable in the terminal before running this command.
Alternatively, you may use service tokens.
Used to disable the check for new CLI versions. This can improve the time it takes to run this command. Recommended for production environments.To use, simply export this variable in the terminal before running this command.

flags

The path to write the output file to. Can be a full file path, directory, or filename.
When --output-file is specified:
  • Secrets are saved directly to the specified file
  • A success message is displayed showing the file path
  • For directories: adds default filename secrets.{format} (e.g., secrets.json, secrets.yaml)
  • For dotenv formats in directories: uses .env as the filename
When --output-file is NOT specified (default behavior):
  • Output is sent to stdout (standard output)
  • You can use shell redirection like infisical export > secrets.json
  • Maintains backwards compatibility with existing scripts
If you’re using shell redirection and your token expires, re-authentication will fail because the prompt can’t display properly due to the redirection.
The --template flag specifies the path to the Go template file used for rendering secrets. When using templates, you can omit the other format flags.
my-template-file
The Infisical CLI templating engine also supports Sprig library templating functions to help you transform your secrets further. You can read more about the available functions here.
Used to set the environment that secrets are pulled from.
Note: this flag only accepts environment slug names not the fully qualified name. To view the slug name of an environment, visit the project settings page.default value: dev
By default the project id is retrieved from the .infisical.json located at the root of your local project. This flag allows you to override this behavior by explicitly defining the project to fetch your secrets from.
Parse shell parameter expansions in your secrets (e.g., ${DOMAIN})Default value: true
By default imported secrets are available, you can disable it by setting this option to false.Default value: true
Format of the output file. Accepted values: dotenv, dotenv-export, csv, json and yamlDefault value: dotenv
Prioritizes personal secrets with the same name over shared secretsDefault value: true
The --path flag indicates which project folder secrets will be injected from.
When working with tags, you can use this flag to filter and retrieve only secrets that are associated with a specific tag(s).
Note: you must reference the tag by its slug name not its fully qualified name. Go to project settings to view all tag slugs.By default, all secrets are fetched