~/.testsprite/credentials), and built-in defaults. Per-invocation flags override everything else.
Global flags
Global flags override both environment variables and the credentials file for a single invocation. They must appear before the subcommand. Full descriptions are in the Command Reference.| Flag | Overrides | Default |
|---|---|---|
--output <json|text> | — | text |
--profile <name> | TESTSPRITE_PROFILE | default |
--verbose | — | false |
--debug | — | false |
--dry-run | — | false |
--request-timeout <seconds> | TESTSPRITE_REQUEST_TIMEOUT_MS | 120 |
Credentials file
The CLI stores API keys in~/.testsprite/credentials, an INI-style file. The directory is created with mode 0700 and the file with mode 0600. Writes are atomic — a partial write never corrupts an existing key.
testsprite auth configure to write a profile interactively. Use --from-env in CI to skip the prompt.
Profiles
A profile is a named section in the credentials file. Each profile holds anapi_key. You can maintain as many profiles as you like — for example, one for interactive use and one with a separate API key for CI.
There’s no separate “select profile” command — you apply a profile to whichever command you run. For a single command, prepend the global --profile flag (here project list is just an example command):
default if neither --profile nor TESTSPRITE_PROFILE is set.
Environment variables
Environment variables override the credentials file but are overridden by their corresponding flag.| Variable | Purpose | Overridden by |
|---|---|---|
TESTSPRITE_API_KEY | API key to use | — (highest precedence for the key) |
TESTSPRITE_PROFILE | Active profile name | --profile |
TESTSPRITE_REQUEST_TIMEOUT_MS | Per-request timeout in milliseconds | --request-timeout (seconds) |
Resolution precedence
The CLI resolves each setting through a fixed chain. First match wins. Profile selection:--profileflagTESTSPRITE_PROFILEenvironment variable- Literal
"default"
TESTSPRITE_API_KEYenvironment variableapi_keyin the active profile from~/.testsprite/credentials
The JSON output contract
--output json is the stable, parseable contract every command supports, and exit codes are stable independently of output mode — so agents and CI scripts branch on the exit code rather than parsing stderr. See Output & Scripting.
On error, every command emits a consistent JSON envelope regardless of --output mode; for its shape and the full error-code table see Exit Codes & Errors.
Request timeouts
--request-timeout <seconds> sets the client-side timeout for each individual HTTP request (range 1–600, default 120). Set it via the environment variable as milliseconds: TESTSPRITE_REQUEST_TIMEOUT_MS=30000.
This timeout governs single HTTP round-trips only. It does not affect the --timeout ceiling on test run --wait, test wait, or test rerun --wait — those polling loops run until the run reaches a terminal status or the wait timeout expires, independent of per-request timeouts.
The dashboard link
When a run completes, the JSON output includes adashboardUrl field and text mode prints a Dashboard: line. This deep-links directly into the Web Portal run view for that test.
dashboardUrl field is absent under --dry-run.
Where to Go Next
Authentication
Configure API keys, profiles, and non-interactive CI auth
Command Reference
Every command, flag, and output shape
Exit Codes & Errors
Every exit code and error code in one table
CI/CD Integration
Use the CLI in GitHub Actions and other pipelines