> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.tester.army/llms.txt.
> For full documentation content, see https://docs.tester.army/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.tester.army/_mcp/server.

# API Keys

Use API keys to authenticate CLI, CI, and programmatic API requests.

## Create an API key

1. Open **Profile → API Keys** in the TesterArmy dashboard.
2. Click **Create API Key**.
3. Copy the key and store it in your secret manager or CI environment.

API keys are shown once. If you lose a key, revoke it and create a new one.

## Bearer token format

Send the key in the `Authorization` header:

```bash
curl https://tester.army/api/v1/runs \
  -H "Authorization: Bearer $TESTERARMY_API_KEY"
```

For the CLI, either run `ta auth` or set:

```bash
export TESTERARMY_API_KEY="YOUR_KEY"
```

## Troubleshooting

### `401 Unauthorized`

The API key is missing, malformed, revoked, or belongs to a user who no longer has access to the team.

Check that:

1. The header is exactly `Authorization: Bearer YOUR_KEY`.
2. The key comes from **Profile → API Keys**.
3. The key has not been revoked.
4. The user who created the key still belongs to the team.

### Rotate a key

1. Create a new key.
2. Update your CLI, CI, or secret manager.
3. Confirm requests work with the new key.
4. Revoke the old key.