API Keys
API keys authenticate requests to the compile API. Every pure build call and every WebSocket connection requires a valid key. Keys are scoped to an organization and count usage toward that organization’s billing.
Creating a key
Section titled “Creating a key”- Open the dashboard and navigate to API Keys.
- Click New key.
- Enter a display name (e.g.
ci-prod,dev-laptop). - Click Create.
The key value is shown exactly once. Copy it now — it cannot be retrieved again. If you lose it, create a new key and revoke the old one.
Using a key
Section titled “Using a key”Pass the key as the api_key field in the first WebSocket message (compile.start). The CLI stores it in ~/.pure/credentials after the first successful compile.
Never commit an API key to version control. In CI, store it as a secret environment variable and pass it to the CLI:
PURE_API_KEY=pk_live_... pure build src/main.ts --releaseThe CLI reads PURE_API_KEY from the environment before prompting interactively.
Key status
Section titled “Key status”| Status | Description |
|---|---|
| Active | Key is valid and can authenticate requests |
| Expired | Key has passed its expiry date; creates an auth.error with code KEY_EXPIRED |
| Revoked | Key was manually revoked; creates an auth.error with code KEY_REVOKED |
The dashboard shows the last time each key was used (last_used). Use this to spot unused keys that can safely be revoked.
Rotating a key
Section titled “Rotating a key”Rotating replaces a key value while keeping the same display name and settings. The old value immediately stops working.
- Find the key in the API Keys list.
- Click Rotate.
- Copy the new value from the confirmation dialog.
Update any system that uses the old key before rotating.
Revoking a key
Section titled “Revoking a key”Revoking permanently deactivates a key. It cannot be un-revoked.
- Find the key in the API Keys list.
- Click Revoke → Confirm.
Subsequent requests using the revoked key return auth.error with code KEY_REVOKED.
Security practices
Section titled “Security practices”- Use one key per environment (dev, staging, prod, CI). This limits blast radius if a key is leaked.
- Set a short expiry on keys used in scripts that run on untrusted machines.
- Audit
last_usedperiodically and revoke keys that have not been used in 90+ days.