Signing in
Before you can run any command that talks to the TestSprite API, you need to store a valid API key. The fastest path istestsprite init — it prompts for the key, verifies it against the server, installs the agent skill into your repo, and prints a unified summary, all in one step:
Installation
The full onboarding walkthrough
GET /me with the key you provide before writing anything to disk. A rejected or malformed key never overwrites a working profile.
--from-env instead of typing at a prompt:
Checking who you are
Runtestsprite auth whoami (alias: testsprite auth status) to confirm which key and profile are active:
write:tests or run:tests, the output appends a note: line listing the gap. For machine-readable output, add --output json.
Signing out
To remove credentials for the active profile:~/.testsprite/credentials. Other profiles are not touched.
Where credentials live
The CLI stores credentials in~/.testsprite/credentials, an INI-style file. The directory is created with mode 0700 and the file with mode 0600. All writes are atomic.
auth configure.
Profiles
Profiles let you manage multiple accounts or API keys (for example, an interactive key and a CI key) without re-entering credentials each time. To configure a named profile, pass--profile before the subcommand:
--profile as a global flag:
api_key is read from ~/.testsprite/credentials. If the named section does not exist, the CLI exits with a validation error (exit 5).
Environment variables
Environment variables override the credentials file. This is the recommended pattern for CI and container environments.| Variable | Purpose | Precedence |
|---|---|---|
TESTSPRITE_API_KEY | API key to use for all requests | Wins over the credentials file |
TESTSPRITE_PROFILE | Active profile name (default: "default") | Overridden by --profile |
- Profile:
--profileflag >TESTSPRITE_PROFILEenv >"default" - API key:
TESTSPRITE_API_KEYenv > credentials file value for the active profile
Scopes
API keys carry a list of scopes that gate which operations the CLI can perform. All new keys and grandfathered keys default to the full working set.| Scope | Gates |
|---|---|
read:me | auth whoami, usage |
read:projects | project list, project get |
read:tests | test list, test get, test steps, test result, test code get, test failure get, test failure summary, test artifact get |
write:tests | test create, test create-batch, test update, test delete, test delete-batch, test code put, test plan put, project create, project update |
run:tests | test run, test wait, test rerun |
testsprite agent install is a pure-local operation — it only writes files to your project directory and never calls the API, so no scope is required. testsprite init does call the API to verify your key (GET /me) and fetch your identity, but it works with any valid key and needs no write or run scope.API Keys
The Web Portal key management walkthrough
Where to Go Next
Projects
Create and manage the projects your tests live in
Creating Tests
Author frontend plans and backend code files
Configuration
Full flag and environment variable precedence reference
CI/CD Integration
Non-interactive auth patterns for pipelines