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 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 ([email protected]) on https://swamp-club.com
Collectives: swamp, system-initiative, stack72Log in without a browser
Pass credentials directly to skip the browser flow:
$ swamp auth login --username alice --password secret --no-browserOmit --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:
- Sign in to swamp.club
- 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.