The Retab CLI stores named environment profiles inDocumentation Index
Fetch the complete documentation index at: https://docs.retab.com/llms.txt
Use this file to discover all available pages before exploring further.
~/.retab/config.json.
Each profile pairs a slug (test, production, staging, qa, …)
with a stored API key. CLI commands resolve credentials from those
profiles, environment variables, and flags using a strict precedence so
the command target is never ambiguous.
The key still selects the customer environment. CLI profile flags only
choose which stored key the CLI sends.
Commands
retab env switch only changes the local default. It never mutates server
state and it never changes what an API key can access.
Selecting an environment for one command
Three flags pick an environment for a single command:--live is documented as an alias for --env production. It always
targets the canonical production environment, regardless of any custom
display name you give production locally.
Resolution precedence
The CLI picks credentials in this strict order. The first source that provides a key wins.| # | Source |
|---|---|
| 1 | --api-key flag |
| 2 | RETAB_API_KEY environment variable |
| 3 | --env <slug> stored environment profile |
| 4 | --live stored production profile |
| 5 | Stored default_environment profile (e.g. set by env switch) |
| 6 | Stored OAuth session (for commands that support it) |
| 7 | Legacy stored api_key |
| 8 | Unauthenticated error |
Conflict rejection
The CLI rejects combinations where the visible command target and the actual key target could disagree. This is deliberate: silent overrides are exactly how production accidents happen.| Input | Behavior |
|---|---|
--api-key + --live | Fails: the key already selects the environment. |
--api-key + --env <slug> | Fails: the key already selects the environment. |
RETAB_API_KEY + --live | Fails: env var key already selects the environment. |
RETAB_API_KEY + --env <slug> | Fails: env var key already selects the environment. |
--env production + --live | Accepted (equivalent). |
--env test + --live | Fails as contradictory. |
| Stored profile key resolves to a different server env | Fails; re-add the profile with the right key. |
Server-resolved environment
retab auth status reports what the server says about the active
credential, not just what the prefix looks like:
retab env list shows the same picture in a table:
--json or rely on the
non-TTY default).
Production safety prompts
High-risk live writes (publish, delete, rotate secret, run with external side effects, retry job, resend webhook) require confirmation. In an interactive shell the CLI prints:--confirm:
list, get, auth status, diagnose, …) never
prompt; they print the resolved environment in debug/status output so
the target is still visible.
CI guidance
Prefer explicit keys plus--confirm over ambient env switch production in CI. The explicit form makes production use visible in
the script and in CI logs, and it avoids the failure mode where a
forgotten env switch silently turns subsequent commands into
production writes.
retab env switch production in a CI runner.
Custom environments
Custom slugs (e.g.staging, qa, demo) are local profile names. Each
custom slug is still backed by a test or production API key, so its
server-side type is determined by the key:
rt_test_...-> server typetestrt_live_...-> server typeproduction
See also
- API keys — create test and live keys in the dashboard.
- Environments overview — the customer environment model.
- CLI install and core commands — the rest of the CLI surface.