Authentication
Everything you do in Nexus is done as you, in one organization, with your role there. Nexus UI, the CLI and the API use the same credentials underneath: a personal Nexus token.
| Credential | How you get it | Lifetime | Used by |
|---|---|---|---|
| Nexus UI session | Sign in to Nexus UI | 12 hours | Nexus UI in your browser |
| CLI token | nexus auth login | 90 days, revocable | The nexus CLI on one machine |
| API key | nexus auth tokens create, Nexus UI → Settings → Keys, or POST /v1/auth/tokens | Until revoked | CI, scripts, your own code |
| Service account key | nexus service-accounts keys create (owners and admins) | 90 days by default, never past its account | CI and scripts that act for no person |
Personal tokens start with nx_, and service account keys start with nxsa_. An agent you link to act for you gets
its own key (nxo_…); you see and revoke it under Settings → Keys. Products running on Nexus get their own
short-lived scoped keys (nxs_…) that can only call models and connectors; you never handle those.
Nexus UI: sign in with Google or email
Open Nexus UI and sign in with your Google account, or with your email. Your first sign-in creates your personal organization. You can also create an organization for your company, or open one you were invited to. Whoever creates an organization is its owner.
The CLI: a one-time code
nexus auth login- The CLI asks Gateway for a one-time code (
POST /v1/auth/device) and opens Nexus UI's approval page. Use--no-browserto only print the link, for example over SSH. - You check that the code matches and approve it for the organization selected in Nexus UI.
- The CLI, polling
POST /v1/auth/token, receives a CLI token and saves it.
Codes last ten minutes and work once. The token is saved in ~/.nexus/factory/config.json, readable by you only
(NEXUS_CONFIG moves it). --url signs in to another Nexus Gateway.
nexus auth status # organization, user, role, Gateway URL, token (masked), and whether Gateway accepts it
nexus auth logout # revokes the token on Gateway and forgets itAPI keys
Create an API key with the CLI, signed in as yourself:
nexus auth tokens create --label "CI deploys"The key is shown once. It belongs to you and acts with your role: if you are a member, so is the key. List and
revoke your keys with the CLI. Owners and admins see and revoke everyone's (--all).
nexus auth tokens # your API keys and CLI sign-ins, with their ids
nexus auth tokens revoke <id>Nexus UI does the same under Settings → Keys. The API is
POST /v1/auth/tokens, GET /v1/auth/tokens and
DELETE /v1/auth/tokens/{id}.
In CI: --with-token
echo "$NEXUS_API_KEY" | nexus auth login --with-tokenThe CLI reads the key from stdin, so it never appears in your shell history or the process list. nexus auth logout
then only forgets the key; revoke it with nexus auth tokens revoke <id> when you no longer need it.
Calling the API
Send your token as a bearer token:
curl "$NEXUS_URL/v1/tenants/me" -H "Authorization: Bearer $NEXUS_API_KEY"$NEXUS_URL is your Nexus Gateway, for example https://api.nexus.inc. The answer names your organization, you, your role and
the permissions you have. The agent gateway (the Anthropic and OpenAI pass-through) also accepts the token as
x-api-key, the header Anthropic's clients send.
A missing or unknown token is 401; a permission your role doesn't have is 403 role_required, naming who may.
See Errors.