Skip to main content

AUTHENTICATE WITH API KEYS

This guide shows you how to authenticate with swamp using API keys — through the CLI, the web UI, or environment variables.

Prerequisites

  • The swamp CLI installed (curl -fsSL https://swamp.club/install.sh | sh)
  • A swamp account (swamp.club)

Log in with the CLI

Run swamp auth login to authenticate via your browser:

$ swamp auth login

Your browser opens to the swamp login page. After you sign in, the CLI confirms authentication and stores your credentials locally.

Verify your identity:

$ swamp auth whoami

You will see output like:

stack72 ([email protected]) on https://swamp-club.com
Collectives: swamp, system-initiative, stack72

Log in without a browser

Pass credentials directly to skip the browser flow:

$ swamp auth login --username alice --password secret --no-browser

Omit --password to be prompted interactively.

Use an environment variable

Set SWAMP_API_KEY to authenticate without storing credentials to disk:

export SWAMP_API_KEY=swamp_abc123...

All CLI commands that require authentication will use this key. See the API Key Authentication reference for precedence rules.

Create a personal API key in the web UI

If you need a key for custom integrations outside the CLI:

  1. Sign in to swamp.club
  2. Open Settings
  3. Expand the Access Tokens panel
  4. Enter a name and click Create
  5. Copy the key immediately — it is shown only once

Create a collective API token

To create a token scoped to a collective, you need the owner or admin role on that collective.

  1. Navigate to the collective's settings page
  2. Expand the API Tokens panel
  3. Enter a name and optionally set an expiration date
  4. Click Create
  5. Copy the token immediately — it is shown only once

Revoke or delete a key

CLI-created keys: Run swamp auth logout to remove stored credentials and revoke the key.

$ swamp auth logout

Web UI keys: Open Settings > Access Tokens, click Revoke to disable the key (it can no longer authenticate but remains visible), or Delete to remove it permanently.

Collective tokens: Open the collective's settings, find the token, and click Revoke or Delete.

Connect to a different server

Pass --server to authenticate against a server other than the default:

$ swamp auth login --server https://registry.example.com

You can also set the SWAMP_CLUB_URL environment variable.

Refer to the API Key Authentication reference for the full details on key formats, scoping, and credential precedence.