Use sim login for a stored browser-approved login, or supply an existing API key for CI. These settings apply to the installed CLI. Commands Sim runs inside Chat use your session identity; local login and profile-management commands are unavailable. See Configuration for that boundary.
Signing in
The CLI prefers OAuth on a local machine. SSH sessions and headless Linux terminals select API-key pairing; a server without OAuth also selects pairing when no method is specified. An unreachable server is an error, not a reason to fall back.
Choose the method explicitly when the credential type matters:
Explicit OAuth never falls back and overrides remote-session detection. Pairing creates a new key; use SIM_API_KEY to supply one you already have. Older deployments that issue only copilot keys must be upgraded: those keys cannot authenticate the platform CLI. OAuth discovery does not verify pairing compatibility.
OAuth approval
The CLI opens Sim's sign-in page and then a consent page naming the Sim CLI and its requested access. Approve the request to return control to the terminal:
The login uses an authorization code, Proof Key for Code Exchange (PKCE), and a loopback redirect. The browser returns a one-time code; the terminal exchanges it for tokens over its own connection. Tokens are stored in ~/.sim/credentials with 0600 permissions.
Access tokens last one hour. The refresh-token family has a fixed 30-day lifetime; renewal does not extend it. After expiry, log out and sign in again.
A profile holds one stored credential. Replacing an API key requires confirmation or --yes. An existing OAuth login must be revoked with sim logout before another login; --yes does not bypass this.
Over SSH or in a container
OAuth needs the browser to reach a listener on the machine running sim. Use pairing when that connection is unavailable:
The terminal prints a code and an approval URL you can open on another device:
--read-only and --callback-port are OAuth-only. Combining either with pairing stops login instead of silently ignoring the option.
For an SSH tunnel that forwards the remote loopback port to your browser's machine, choose OAuth and specify that same port:
Supplying a callback port also overrides automatic SSH detection. An ordinary container port publication cannot reach a listener bound to the container's own loopback interface; use pairing there unless you provide a working loopback route.
Picking a workspace
A personal login can act in accessible workspaces, subject to current roles, policies, and resource access. --read-only narrows OAuth scope; a default workspace only selects a target and does not narrow credential scope.
After OAuth login, select a default or pass a workspace per command:
Pairing sets the default workspace chosen on the approval page.
To reuse a stored login with another default workspace:
The new profile references the active authentication profile through auth_profile and stores its own workspace. With the default login active, that reference is auth_profile = default.
Omit --workspace in an interactive terminal to choose an accessible workspace. The picker is capped at 1,000 entries; scripts and larger inventories require an explicit ID. See Configuration for profile resolution.
Checking who you are
whoami reports the endpoint, credential type, workspace, output format, and where each setting came from. It checks authentication through API metadata when available, then reads the selected workspace to verify access. Older servers can fall back to the workspace check.
For exit 1, inspect the endpoint and workspace before signing in again. A valid login cannot fix a wrong workspace or missing permission. Use --no-verify for offline inspection.
Authenticating CI
Create a key under Settings → Sim API keys, then store it in your CI secret manager. Supply the key and workspace without running login:
The environment key overrides stored authentication. Use a workspace key only for supported workspace-scoped operations; organization audit logs and fork administration require a personal credential. Never commit credentials. SIM_CONFIG_DIR relocates local state when a runner has no writable home directory.
GitHub Actions
This job installs Node for the CLI and Bun to install the package. Add it to a workflow with your chosen trigger:
See Scripting for asynchronous runs and command-specific failure handling.
Several accounts and workspaces
Use separate authentication profiles for different identities or deployments:
Use shared workspace profiles when the same stored identity targets several workspaces:
Shared profiles retain separate workspace/output settings but share an endpoint and stored login. References are direct, never chained. Log in against the authentication profile rather than a profile that shares it.
Self-hosted and non-production deployments
Use HTTPS for remote sign-in. Both OAuth and pairing refuse non-loopback HTTP endpoints. Loopback development addresses can use HTTP:
Login saves the endpoint. You can also configure it before signing in:
An OAuth login belongs to its issuing deployment. Log out before changing or removing that endpoint. API keys must also belong to the selected deployment.
OAuth is available by default when server authentication is enabled. DISABLE_AUTH=true disables OAuth. Servers without OAuth can use pairing if they support platform API keys. See Sign in with Sim for server setup and upgrade requirements.
Where the login is stored
Stored authentication lives in ~/.sim/credentials, written 0600. Non-secret defaults live separately in ~/.sim/config. Never copy credentials into a dotfiles repository:
Concurrent local commands coordinate OAuth renewal through the credentials lock. A process rereads credentials after taking the lock and adopts an already-renewed token instead of reusing the old refresh token.
Run login separately on each machine. Copying the credentials file copies one single-use refresh-token family. Concurrent use of those copies can be treated as replay and revoke that login.
If a refresh response is lost after the server consumes the token, the CLI does not retry that token. Recover with logout and a new login:
Signing out
The first command removes stored authentication; --all also removes the profile's settings.
For OAuth, logout revokes that login's complete token family before clearing it locally, including access tokens from earlier rotations. Independent logins on other machines remain signed in. To revoke the client's grant across independent logins, use Settings → General → Authorized apps.
A workspace profile cannot remove its shared login. Remove only that local profile with sim logout --all --profile <name>, or log out of its authentication profile. Deleting an authentication profile entirely is refused while workspace profiles still reference it.
Organization audit logs
sim audit-logs requires a personal credential: an OAuth login or personal API key. Pairing creates a personal key. A workspace key cannot read organization audit logs.