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.com/install.sh | sh) - A Swamp account (swamp-club.com)
Log in with the CLI
Run swamp auth login to authenticate via your browser:
$ swamp auth loginYour 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 whoamiYou will see output like:
stack72 (paul@systeminit.com) on https://swamp-club.com
Collectives: swamp, system-initiative, stack72Log in without a browser
Pass credentials directly to skip the browser flow. The --username flag
accepts either a username or an email address:
$ swamp auth login --username alice --password secret --no-browser$ swamp auth login --username alice@example.com --password secret --no-browserOmit --password to be prompted for it interactively — the username is already
provided via the flag, so only the password is prompted.
Pipe a password from stdin
You can pipe a password to avoid interactive prompts entirely. This is useful in scripts and CI environments where no TTY is available:
$ printf 'mypassword\n' | swamp auth login --username alice --no-browserThe --username flag is required when piping — without it the CLI prompts for
both username and password, which conflicts with the pipe.
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:
- Sign in to swamp-club.com
- Open Settings
- Expand the Access Tokens panel
- Enter a name and click Create
- 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.
- Navigate to the collective's settings page
- Expand the API Tokens panel
- Enter a name and optionally set an expiration date
- Click Create
- 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 logoutWeb 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.comYou 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.