Authentication

TestBro uses API tokens to authenticate CLI and API requests. Tokens are tied to your user account and provide access to all your projects.

Creating API Tokens

  1. Log in to the TestBro dashboard
  2. Navigate to Settings > API Tokens
  3. Click Create Token and give it a descriptive name
  4. Copy the generated token -- it will only be shown once

Tokens follow the format tb_live_... for production and tb_test_... for test environments.

CLI Authentication

Login with a token

testbro login --token <your-api-token>

This stores your credentials in ~/.testbro/config.json. You only need to run this once per machine.

Specify a custom API URL

If you are running a self-hosted instance or developing locally:

testbro login --token <your-api-token> --url http://localhost:3024

Check authentication status

testbro whoami

This displays your email and the currently active project.

Log out

testbro logout

This removes stored credentials from your machine.

Environment Variable Authentication

For CI/CD and automated environments, set the TEST_BRO_TOKEN environment variable instead of using testbro login:

export TEST_BRO_TOKEN=tb_live_your_token_here

The CLI will automatically use this token when no stored credentials are found. This is the recommended approach for CI/CD pipelines.

Token Security

  • Tokens provide full access to your account's projects and test cases
  • Store tokens securely -- never commit them to version control
  • Use environment variables in CI/CD rather than hardcoded values
  • Rotate tokens periodically from the dashboard
  • If a token is compromised, delete it immediately from Settings > API Tokens

API Authentication

When calling the TestBro API directly, include the token in the Authorization header:

curl -H "Authorization: Bearer tb_live_your_token_here" \
  https://your-instance.com/api/projects

All API endpoints (except /api/health and /api/auth/register) require authentication.

Next Steps