Overview
The Corelayer CLI gives you terminal access to Corelayer groups, issues, and integrations. Sign in from your browser, then use Corelayer from the terminal. If your organization uses a dedicated Corelayer deployment, the CLI connects to the right server automatically.Prerequisites
- Node.js 18+
- npm
- A Corelayer account with access to at least one organization
Install
Authenticate
Browser Login (Interactive)
- Opens the Corelayer app in your browser
- Asks you to authorize CLI access for your current organization
- Redirects back to a temporary localhost callback used by the CLI
- Stores your API key and server URL in
~/.corelayer/config.json
Environment Variable (Non-Interactive)
For CI/CD pipelines, agents, and headless environments, set theCORELAYER_API_KEY environment variable. No login command is required.
POST /api/v1/api-keys), then store it as a secret in your CI/CD platform or agent runtime.
The CLI resolves credentials in this order:
CORELAYER_API_KEYenvironment variable (highest priority)- Token stored in
~/.corelayer/config.json(fromcorelayer login)
Pipe a Token (Non-Interactive Login)
To save an existing API key to the CLI config file without opening a browser — useful for self-hosted instances:~/.corelayer/config.json so subsequent commands work without the environment variable.
Usage
The CLI documents itself. Runcorelayer --help to see every command:
--help to any subcommand for its specific flags and examples:
Quick Tour
A typical first session looks like:Global Flags
The CLI supports these global flags:--jsonfor machine-readable output--quietor-qto suppress success messages--api-url <url>to override the configured API server--no-colorto disable ANSI color output
Environment Variables
| Variable | Description | Default |
|---|---|---|
CORELAYER_API_KEY | API key for non-interactive auth (skips login) | — |
CORELAYER_API_URL | Server URL | https://api.corelayer.com |
CORELAYER_AUTH_URL | Auth server URL for browser login | https://app.corelayer.com |
Dedicated Deployments
For browser login, you do not need to manually choose the API server. Corelayer returns the correctserver_url during authorization and the CLI stores it in ~/.corelayer/config.json.
Use --api-url only when:
- you are doing manual login with an auth code
- you are testing against a local or non-default environment
- you explicitly want to override the stored server URL for one command
Using the CLI with AI Agents
Authentication for Agents
Agents should authenticate via theCORELAYER_API_KEY environment variable — not corelayer login. This follows the same pattern as GH_TOKEN for GitHub CLI, VERCEL_TOKEN for Vercel, and STRIPE_API_KEY for Stripe.
General Best Practices
- Set
CORELAYER_API_KEYandCORELAYER_API_URLin the agent’s environment - Prefer
--jsonwhen an agent needs to read the output - Set
default-groupif the agent will make repeated issue or integration calls
agents/corelayer-cli.md.
Command Types
Agents should treat CLI commands in three categories:1. Read-Only Commands
These are safe to use for discovery, triage, and reporting:corelayer groups listcorelayer issues listcorelayer issues getcorelayer issues summarycorelayer integrations listcorelayer config get
- Prefer
--jsonwhen an agent needs to reason over the output - Use
corelayer groups list --jsonfirst if the correct group is not known - Set
default-groupbefore repeated issue or integration reads
2. Local State Commands
These change the local CLI session or local config, not Corelayer data on the server:corelayer logincorelayer logoutcorelayer config set default-group <group-id>corelayer config set api-url <url>
corelayer loginis fine when the user is actively trying to authenticate- use
corelayer config set default-groupwhen the user will run repeated commands against the same group - avoid changing
api-urlunless the user explicitly wants a different environment - avoid
logoutunless the user asks for it or the workflow clearly requires resetting auth
3. Write and Update Commands
These change data or issue state on the Corelayer server and should be used carefully:corelayer issues close <issue-id> --feedback "..."corelayer issues bulk-close --group <group-id> --last-seen-before-or-on 14days --feedback "..."corelayer issues reopen <issue-id>corelayer issues delete <issue-id> --yes
bulk-close over looping issues close calls. Bulk close is the intended path for large cleanups and avoids 429 rate limits from repeated single-issue mutations.
Best practice:
- ask for explicit approval before running any of these commands
- include a short, accurate reason when closing an issue
- prefer
closeorreopenoverdelete - only use
delete --yeswhen the user has clearly requested deletion - if the user is unsure, show the issue first with
corelayer issues get <issue-id> --json
Recommended Agent Workflows
Investigate issues in one group
Review integrations for a group
Summarize current issue health
Troubleshooting
Browser Login Does Not Open
Copy the URL printed bycorelayer login and open it manually in your browser.
Callback Fails on 127.0.0.1
Use manual login:
Wrong Organization or Server
Log in again while the correct organization is active in the Corelayer app. The browser flow will return the correct server URL for that organization.API Calls Fail After Switching Environments
Check the stored API server:- run
corelayer loginagain - or override the server for a command with
--api-url <url>