Create a key for CI

Create keys in the dashboard under API keys (owners and admins). Give CI its own key, with the least access it needs and an expiry: Options on every key:
  • Expiry: 7, 30, 90 or 365 days, or never.
  • Sandbox list: limit the key to specific sandbox IDs. Other sandboxes answer “not found” to it.
The secret is shown once. Revoking a key stops it at once. Keys created before the usage:read and billing:read scopes existed do not have them. Key management is a dashboard action: API keys cannot create, list or revoke keys (the /v1/api-keys routes accept dashboard sessions only, see the API reference).

Use it in a job

Store the key as a CI secret and expose it as E2B_API_KEY (or ANONA_API_KEY) together with E2B_DOMAIN:
A job script that always cleans up, even when the test fails:
Set a timeout on every CI sandbox, so a cancelled job cannot leave one running. Tag CI sandboxes with metadata, then sweep leftovers:
sweep.sh

The CLI with a key

The CLI takes --api-key, else ANONA_COMPUTE_API_KEY or E2B_API_KEY, else the profile; a key wins over a browser sign-in. To keep one in a profile:
key_profile.sh