AgentKit
DocsKitsCLI ReferenceDesktop App
BetaYou are reading docs for the beta channel (3.0.0-beta.15). Features may change before the next stable release.Switch to stable →

secrets

ak secrets import-env

Bulk-import secrets from a dotenv file

Use ak secrets import-env for the operation described below. The command help records its arguments, effects, and options.

Command contract

Bulk-import secrets from a dotenv file

Synopsis

Parse <path> as a minimal dotenv file (KEY=value, KEY="quoted", KEY='quoted', # comments, blank lines) and store one secret per key. <path> must be at most 1 MiB. Values are never printed, logged, or included in --json output — only the imported/skipped counts and (with --verbose) a safe per-line reason are shown. Without --force, a key that already has a stored value is skipped rather than overwritten; --force overwrites instead. Use it when onboarding an existing .env-based project onto the secrets vault.

Effects: Writes one value per imported key to the active backend and updates each key's metadata in ~/.agentkit/secrets/index.json. Never modifies <path> itself.

Exit status: 0 success 2 invalid flags, arguments, an unreadable dotenv file, or one over the 1 MiB import limit 5 backend or index failure

ak secrets import-env <path> [flags]

Examples

  ak secrets import-env ${PATH}                    # skip keys that already exist
  ak secrets import-env ${PATH} --force             # overwrite existing keys too
  ak secrets import-env ${PATH} --verbose --json    # machine-readable per-line detail

Options

      --backend string         Storage backend: keychain (default), file (age-encrypted vault), or memory (dev/test; values and its index are throwaway)
      --force                  Overwrite keys that already have a stored value
  -h, --help                   help for import-env
      --json                   Emit machine-readable JSON (implies --no-interactive)
      --no-interactive         Disable interactive prompts (CI-safe)
  -q, --quiet                  Suppress non-error output on stderr
      --unlock-with-recovery   Open the file backend's vault with a recovery private key and set a new passphrase
  -V, --verbose                Extra diagnostic output on stderr (loses to --quiet)
  -y, --yes                    Assume yes for all prompts

SEE ALSO

  • ak secrets - Manage named secret values (API keys, tokens)