Skip to main content

One key, one environment

An API key belongs to exactly one environment. There is no --environment flag, because the key itself already determines it. Switching environments means switching profiles. A profile bundles three things: a stored API key, the region it belongs to, and an optional label you choose.
The API does not report which environment a key belongs to, so the CLI cannot tell you either. Label your profiles yourself with --label, and check with flexprice whoami before doing anything destructive.

Getting set up

flexprice init is the guided path: it prompts for a region and key, verifies the key against the API, and stores it as the default profile.
To add more environments later, use login:

Working with multiple profiles

flexprice env list shows every environment in your tenant, which is useful for orientation — but remember it cannot tell you which one your active key maps to.

Credential precedence

When more than one source could supply a key, the CLI resolves in this order and stops at the first match:
1

The --api-key flag

Highest precedence. Intended for CI and one-off commands.
2

The FLEXPRICE_API_KEY environment variable

Overrides any stored profile. The usual choice for CI, since it keeps the key out of your shell history and process list.
3

The stored profile

Either the one named by -p/--profile, or your default profile.
The API base URL resolves separately, on the same first-match basis: --base-url, then --region, then the region stored on the active profile.
A key on its own does not identify a region. If you pass --api-key without a stored profile, you must also pass --region or --base-url — otherwise the CLI stops and tells you so rather than guessing.

Where keys are stored

Keys go in your operating system’s keychain when one is available. Where it is not — inside a container, or a CI runner — the CLI falls back to an encrypted file at ~/.flexprice/keys. flexprice whoami reports which backend is in use:
Non-secret settings live in ~/.flexprice/config.toml. Keys are never written there.

In CI

Set the key through the environment and pin the region explicitly:
No init or login step is needed — the environment variable takes precedence over stored profiles, so nothing has to be configured on the runner.

Next steps

Global flags

Every flag the CLI accepts, grouped by purpose.

Output & scripting

Exit codes and non-interactive behaviour.