phantom sync pushes secrets from your local vault to deployment platforms (Vercel and Railway). It reads real values from the OS keychain, applies any filters you configure, and calls the platform API directly — no secrets are written to disk or logged.
Use --dry-run before a real push. Dry runs never decrypt secret values and never call platform APIs; they report target configuration, selected key names, skipped key names, token-env presence, and warnings. A dry run also applies the live run's lifecycle gate from vault metadata alone: when a selected secret is overdue under enforce_rotation_on_access, has been demoted to read-only, or has lifecycle metadata that cannot be read, live_gate_refusal carries the refusal the live run would return (names only) and the dry run exits non-zero, as the live run would.
phantom sync --dry-run --json
phantom sync --platform vercel --project prj_abc123 --dry-run --jsonBefore using sync, complete the basic setup: getting-started.md.
- Phantom reads secret names from the vault and decrypts their values.
- For each configured sync target, it compares the local values against what the platform currently has.
- Keys that are new or changed are upserted. Keys that match exactly are skipped.
- Secrets are zeroized from memory after all targets have been processed.
The platform token (e.g., VERCEL_TOKEN) is read from your local environment — it is never stored in .phantom.toml.
export VERCEL_TOKEN=your_vercel_token
phantom sync --platform vercel --project prj_abc123This pushes all vault secrets to the production and preview environments of the specified project.
Add a [[sync]] block to your .phantom.toml:
[[sync]]
platform = "vercel"
token_env = "VERCEL_TOKEN"
project_id = "prj_abc123"
targets = ["production", "preview"]token_env names the environment variable that holds your Vercel API token. Phantom reads it at sync time — the token is not stored in the config file.
targets controls which Vercel environments receive the secrets. Valid values are production, preview, and development. Defaults to ["production", "preview"] if omitted.
Once configured, syncing is one command:
phantom syncTo preview the same configured targets safely:
phantom sync --dry-run --jsonTo sync only to Vercel when you have multiple platforms configured:
phantom sync --platform vercelexport RAILWAY_TOKEN=your_railway_token
phantom sync --platform railway --project proj_abc123[[sync]]
platform = "railway"
token_env = "RAILWAY_TOKEN"
project_id = "proj_abc123"
environment_id = "production"
service_id = "svc_abc123"environment_id defaults to "production" if omitted. service_id is optional — if omitted, secrets are set at the project level.
Push a subset of secrets by passing one or more --only patterns:
# Push only secrets whose names start with STRIPE_
phantom sync --only "STRIPE_*"
# Push exactly DATABASE_URL and REDIS_URL
phantom sync --only DATABASE_URL --only REDIS_URLPatterns are matched as shell globs against secret names. --only can be repeated.
You can also set per-target filters in .phantom.toml using the only field:
[[sync]]
platform = "vercel"
token_env = "VERCEL_TOKEN"
project_id = "prj_frontend"
only = ["NEXT_PUBLIC_*", "STRIPE_PUBLISHABLE_KEY"]
[[sync]]
platform = "vercel"
token_env = "VERCEL_TOKEN"
project_id = "prj_backend"
only = ["STRIPE_SECRET_KEY", "DATABASE_URL", "REDIS_URL"]When --only is passed on the command line and the target also has an only list in the config, the two lists are merged — a secret passes if it matches any pattern from either source.
You can have multiple [[sync]] blocks — they are processed in order:
[[sync]]
platform = "vercel"
token_env = "VERCEL_TOKEN"
project_id = "prj_abc123"
[[sync]]
platform = "railway"
token_env = "RAILWAY_TOKEN"
project_id = "proj_def456"
environment_id = "production"phantom sync runs all targets. phantom sync --platform vercel runs only matching blocks.
The phantom_sync MCP tool is read-only — it shows sync configuration and which secrets would be pushed, but does not execute any API calls. Actual sync requires running phantom sync in a terminal. This is intentional: sync writes to production infrastructure and should require an explicit human action.
- Getting started: getting-started.md
- Cloud vault sync (Phantom Cloud, not deployment platforms): login.md
- Troubleshooting: troubleshooting.md
- Site: https://phm.dev