CLI API Keys & Authentication
Manage authentication and API keys for CLI automation and integrations.
Difficulty
The ivybloom CLI is the scriptable surface for the platform, and authentication is the first thing any automated workflow needs to establish. Reach for API keys when a script, CI/CD job, or integration must authenticate non-interactively — outside the browser OAuth flow used for hands-on work. They are the credential that lets your unattended pipelines call the platform securely; for the full command surface, see the CLI overview.
API Keys & Authentication
Manage authentication and API keys for CLI automation and integrations.
Authentication Methods
The ivybloom CLI supports four authentication methods:
Browser OAuth (Recommended)
Opens your default browser to authenticate. Best for interactive use.
API Key
Best for automation, CI/CD, and headless servers.
Device Flow (Headless)
For SSH sessions or servers without browsers. Follow the on-screen link to authenticate on another device.
CLI Linking
Opens browser, authenticates, and automatically generates an API key for this CLI installation. Use --frontend-url to specify a custom frontend for self-hosted deployments.
Which commands need an API key
Chat streams and tool calls need an API key (ivy_…). The CLI sends it as X-API-Key. A signed-in session token goes out as Authorization: Bearer instead. The CLI's client id is only a device label and never counts as a credential on its own: the server refuses a chat stream that has only a client id with 401 CLI_API_KEY_REQUIRED, and the CLI doesn't send a request that has no key or token.
ivybloomin a terminal checks for a key at start. It opens the browser to link this installation when no key is stored, when the key has expired, or when the key expires within 3 days. A linked key lasts 30 days.ivybloom chat --headless,--scriptruns andivybloom mcp servenever open a browser. With no usable key they exit with an error. Runivybloom auth linkfirst, or setIVYBLOOM_API_KEY.
Browser OAuth and device flow store a session token, not an API key, so the first terminal start after either one still links.
Why Use API Keys?
API keys are essential for:
- CI/CD Pipelines - Automate job submission in GitHub Actions, GitLab CI, etc.
- Scripting - Run batch analyses without interactive login
- Headless Servers - Authenticate on machines without browsers
- Integrations - Connect external tools to your platform account
Using API Keys
Environment Variable (Recommended)
Via Login Command
Security Warning
Avoid storing API keys in config files that may be committed to version control.
Managing Authentication
Check Status
View Current User
Force Re-Authentication
Logout
Device Management
List Linked Devices
Revoke a Device
Revoking a device immediately invalidates its session. Any scripts using that device's credentials will stop working.
Creating API Keys
Via Web Interface
- Go to ivybiosciences.com/settings/api-keys
- Click "Create New Key"
- Enter a descriptive name
- Copy the generated key (shown once only)
Via CLI Linking
This automatically creates and configures an API key.
CI/CD Integration
GitHub Actions
Setup:
- Create an API key
- Add as a repository secret named
IVYBLOOM_API_KEY
GitLab CI
Jenkins
Security Best Practices
Never hardcode API keys in scripts or config files that are version controlled.
CLI linking creates device-specific credentials that can be revoked individually.
Replace keys periodically or when team members leave.
Create different keys for development, staging, and production.
Check linked devices regularly:
Troubleshooting
"Invalid API Key"
- Verify the key hasn't been revoked
- Check for typos (keys have the shape
ivy_<keyId>_<secret>) - Ensure no extra whitespace
"Insufficient Permissions"
Your API key may not have the required permissions. Create a new key with full access.
"Authentication Failed"
Try re-authenticating:
"CLI_API_KEY_REQUIRED" or "this CLI has no API key"
This CLI has no API key, or its linked key has expired. Link it again:
"Device Not Found"
The device may have been revoked. Re-link the CLI:
CLI Key Management
Manage API keys directly from the CLI:
API Key Scopes
API keys use three canonical capabilities (REST API):
| Scope | Description |
|---|---|
read | Read operations (list, view, download) |
write | Write operations (submit, upload, create, modify) |
manage | Admin operations (revoke keys, manage access) |
The CLI also accepts legacy domain scopes for compatibility (e.g., jobs.read, data.write), which map to the canonical capabilities above.
Default: Omitting --scopes creates a key with read and write access (not manage). To add manage, pass --scopes read write manage explicitly.
Top-Level Device Management
In addition to auth devices, there are top-level device commands:
Read next
- Configuration — Set up CLI defaults
- Organizations — Team-scoped authentication
- Agent Mode — CI/CD automation patterns
- FAQ — Common questions
Was this page helpful?