Skip to main content

import

Import secrets from a file into an environment.

Usage

envshed import <file> [options]

Supported file formats: .env, .json, .yaml, .yml, .csv

The format is auto-detected from the file extension. Use --format to override.

Options

OptionDescription
<file>Path to the file to import
--format <format>Format override: env, json, yaml, csv
--forceOverwrite existing secrets without confirmation
-o, --org <slug>Organization slug
-p, --project <slug>Project slug
-e, --env <slug>Target environment slug

Format Support

.env files

Standard KEY=VALUE format. Multiline values in double-quoted strings are supported:

DATABASE_URL=postgres://localhost/mydb
PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAK...
-----END RSA PRIVATE KEY-----"

JSON files

Flat key-value object:

{
"DATABASE_URL": "postgres://localhost/mydb",
"API_KEY": "secret123"
}

Also supports Infisical's export format (array of objects with key and value fields).

YAML files

Flat key-value mapping:

DATABASE_URL: postgres://localhost/mydb
ENABLE_FEATURE: "no"

Note: Values that look like YAML booleans (yes, no, true, false, on, off) are always imported as strings. Use quotes if you want to be explicit.

CSV files

CSV with a header row containing key and value columns:

key,value
DATABASE_URL,postgres://localhost/mydb
API_KEY,secret123

Quoted fields containing commas or newlines are handled correctly.

Conflict Detection

Before writing, the CLI fetches existing secrets and checks for conflicts. If any existing keys would be overwritten with a different value, you are prompted to confirm:

The following existing secrets would be overwritten:

~ DATABASE_URL (will be overwritten)

Continue and import? (y/N)

Use --force to skip this confirmation.

Examples

# Import from a .env file (auto-detected)
envshed import .env

# Import a JSON export with explicit format
envshed import secrets.json --format json

# Import to a specific environment without confirmation
envshed import production.env --env production --force

# Import from a different directory
envshed import /path/to/export.yaml