- log in on a machine
- create, update, list, and delete variables
- pull resolved values into files
- generate SDK types
Install
- npm
- pnpm
- yarn
- bun
Authentication
barekey auth login
Starts the browser-based device flow:
- starts a device authorization request
- prints the verification URL and code
- opens the browser when possible
- stores the session locally after approval
barekey auth whoami
barekey auth logout
barekey loginbarekey whoamibarekey logout
How target resolution works
Every environment command needs a target:- organization
- project
- stage
- command flags
barekey.json- stored CLI session org for organization only
Target flags
Mostenv and typegen commands accept:
barekey.json
Recommended project file:
orgfororganizationstageforenvironment
Missing target errors
If the CLI cannot resolveproject and environment, it fails and tells you to either:
- pass
--projectand--stage - or create a
barekey.json
Command reference
barekey env list
List variables in the resolved stage:
- name
- visibility
- kind
- declared type
barekey env get
Read one resolved variable:
| Flag | Meaning |
|---|---|
--seed <value> | deterministic seed for ab_roll |
--key <value> | deterministic namespace key |
--json | machine-readable output |
barekey env get-many
Read multiple values in one command:
| Flag | Meaning |
|---|---|
--names <csv> | comma-separated variable names |
--seed <value> | deterministic seed for ab_roll values |
--key <value> | deterministic namespace key |
--json | machine-readable output |
barekey env new
Create a variable with its first value:
| Flag | Meaning |
|---|---|
--type <type> | declared type: string, boolean, int64, float, date, json |
--visibility <visibility> | private or public |
--ab <value-b> | create an ab_roll with A value from the positional <value> and B value from --ab |
--chance <number> | required when using --ab, from 0 to 1 |
--json | machine-readable output |
barekey env set
Upsert a variable:
env new.
Examples:
barekey env delete
Delete a variable:
| Flag | Meaning |
|---|---|
--yes | skip the confirmation prompt |
--ignore-missing | do not fail if the variable does not exist |
--json | machine-readable output |
barekey env pull
Resolve the whole stage and either print or write the result.
| Flag | Meaning |
|---|---|
--format <type> | dotenv or json |
--out <path> | write to a file instead of stdout |
--seed <value> | deterministic seed for ab_roll values |
--key <value> | deterministic namespace key |
--redact | if printing to stdout in a non-TTY context, show only a summary |
Output formats
dotenv:
json:
barekey typegen
Generate SDK types into your installed @barekey/sdk package:
| Flag | Meaning |
|---|---|
--watch | keep polling and regenerate when needed |
--interval <ms> | watch poll interval in milliseconds |
--org <slug> | override organization |
--project <slug> | override project |
--stage <slug> | override stage |
Day-to-day recipes
Create a variable and verify it
Update a public variable
Pull local dev values
Pull JSON for scripts
Regenerate SDK types after variable changes
Notes and gotchas
env newrequires an initial<value>.env setis the upsert command.get-manyexpects a comma-separated--namesvalue.- The CLI can reuse your saved login automatically.
barekey.jsonis safe to commit because it contains configuration, not secrets.- Pulled
.envfiles are not safe to commit.

