Skip to content
CLI · Authentication

CLI

Authentication

Authenticate the CLI with your Edge account using API keys.

On this page10 sections

1. Generate an API key#

Create an API key in your Edge account:

  1. Go to Account → API Keys.
  2. Click Create API Key.
  3. Give it a name (e.g. “CLI - MacBook”).
  4. Copy the key immediately. It won’t be shown again.

The same key also authenticates direct HTTPS calls. See the REST API documentation.

2. Log in#

Run the login command and paste your API key when prompted (interactive), or pass the key directly, which is useful for scripts (non-interactive):

Text
$ edge auth login
? Enter your API key: ek_live_••••••••••••••••••••••••

✓ Authenticated successfully
  Account: Acme Corp
  User: john@example.com
Terminal
edge auth login --key ek_live_abc123def456...

Check authentication status#

Text
$ edge auth status
✓ Authenticated

Account:  Acme Corp
User:     john@example.com
Key:      ek_live_abc1****
Expires:  Never

Log out#

Remove stored credentials:

Text
$ edge auth logout
✓ Credentials removed

Environment variable#

You can also authenticate using the EDGE_API_KEY environment variable:

Terminal
# Set for current session
export EDGE_API_KEY=ek_live_abc123def456...

# Or add to your shell profile (~/.bashrc, ~/.zshrc)
echo 'export EDGE_API_KEY=ek_live_abc123...' >> ~/.zshrc

The environment variable takes precedence over the stored config file.

Config file location#

Credentials are stored in:

  • macOS / Linux: ~/.edge/config.json
  • Windows: %USERPROFILE%\.edge\config.json

Example config:

JSON
{
  "api_key": "ek_live_abc123def456...",
  "default_region": "london",
  "output": "table"
}

CI/CD integration#

Use environment variables in your CI/CD pipelines:

YAML
# GitHub Actions example
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Install Edge CLI
        run: curl -fsSL https://edge.network/install.sh | sh
      
      - name: Deploy
        env:
          EDGE_API_KEY: ${{ secrets.EDGE_API_KEY }}
        run: |
          edge cdn purge my-deployment
          edge storage sync ./dist my-bucket/app/

Authentication priority#

The CLI checks for credentials in this order:

  1. Command-line flag: --api-key
  2. Environment variable: EDGE_API_KEY
  3. Config file: ~/.edge/config.json

Activity tracking#

All actions performed via the CLI are logged in your account activity log with full attribution:

  • Source badge: CLI actions are tagged with a CLI badge to distinguish them from web or API actions
  • User attribution: for accounts with team members, the activity log shows which user performed each action
  • Full audit trail: all create, update and delete operations are logged with timestamps

This helps teams track automated deployments, distinguish CI/CD activity from manual changes, and maintain compliance records.

Next steps