API Keys
Create and manage API key pairs and write-only ingestion keys.
API Keys
Access via Settings → API Keys in your project.
BrowserStack AI Evals uses two types of project credentials:
| Key Type | Purpose | Auth Method |
|---|---|---|
| Public + Secret key pair | Full API access — read and write | HTTP Basic Auth (public:secret) |
| Write-only key | Trace ingestion only — no read access | Bearer token |
Public / Secret Key Pairs
A public/secret key pair grants full read and write access to all project resources through the REST API.
Creating a key pair:
- Go to Settings → API Keys
- Click Create new API key
- Copy the secret key immediately — it is shown only once
- Store both keys securely (e.g., in a secrets manager or CI/CD environment variables)
Usage in the SDK:
export AISDK_PUBLIC_KEY=pk-lf-...
export AISDK_SECRET_KEY=sk-lf-...Usage in direct API calls (HTTP Basic Auth):
curl https://evals-api.browserstack.com/api/public/traces \
-u "pk-lf-...:sk-lf-..."Or with the Authorization header:
curl https://evals-api.browserstack.com/api/public/traces \
-H "Authorization: Basic $(echo -n 'pk-lf-...:sk-lf-...' | base64)"Key rotation:
- Create a new key pair
- Update your application / CI to use the new keys
- Delete the old key pair from the settings page
Once you delete a key pair, any application using those credentials will immediately lose access. Always rotate before deleting.
Write-Only Keys
Write-only keys grant ingestion-only access — they can send traces and scores but cannot read any data. Use these for:
- SDK instrumentation in production (limits blast radius if a key leaks)
- CI/CD pipelines that only send trace data
- Third-party services that should have no read access
Creating a write-only key:
- Go to Settings → API Keys
- Scroll to the Write-Only Keys section
- Click Create write-only key
- Copy the key immediately
Usage:
# SDK — set the write-only key as the secret key
export AISDK_WRITE_ONLY_KEY=wk-lf-...# Direct API calls — Bearer token authentication
curl https://evals-api.browserstack.com/api/public/ingestion \
-H "Authorization: Bearer wk-lf-..."Write-only keys are accepted on all ingestion endpoints (POST /api/public/ingestion, POST /api/public/traces, POST /api/public/scores).
Organization-Level API Keys
In addition to project-level keys, organization Owners can create organization-level API keys that work across all projects in the organization. These are managed from the organization settings (not the project settings).
Use organization keys for:
- Multi-project dashboards and reporting tools
- Organization-wide data pipelines
- Administrative scripts that need cross-project access
Permission Requirements
| Action | Required Role |
|---|---|
| View API keys | VIEWER and above |
| Create key pair | OWNER or ADMIN |
| Delete key pair | OWNER or ADMIN |
| Create write-only key | OWNER or ADMIN |
| Delete write-only key | OWNER or ADMIN |