DoubleX AgentesDocs

CLI › DoubleX in the terminal

Authentication

Sign in through the browser or with an API key. The CLI stores the credential in the system keychain, never in a text file.

The CLI uses an API key to talk to the app. You have two ways to provide that key:

OptionHowUse it when
Browser login (recommended)doublex loginOn your own computer. The CLI gets a key just for this terminal, which you can disconnect from your Profile at any time.
Personal keydoublex login --api-key - or the DOUBLEX_API_KEY variableServers, containers, CI and machines without a browser.

Browser login#

Terminal
doublex login

What happens:

  1. The CLI starts a local server, just for this step, at http://127.0.0.1:8765.
  2. The browser opens the app's Allow terminal access? page, with this computer's name and what the CLI will be able to do. If you're not signed in, the app asks you to sign in first.
  3. You click Allow. The browser goes back to the local server with a single-use code.
  4. The CLI exchanges the code for a terminal key (with PKCE verification: the code is useless to anyone else), checks the key and saves it to the keychain.
Opening the browser so you can allow access…
Waiting for confirmation in the browser (up to 5 minutes)…
Signed in as Ana Souza ([email protected]) · Empresa SA.

The terminal key shows up in Settings › Profile › Terminal (CLI) › Connected terminals, with the computer name and when it was last used.

OptionDefaultWhat it's for
--no-browseroffShows the authorization URL instead of opening the browser.
--callback-port <port>8765Changes the local server's port, if 8765 is in use.
--base-url <url>from the installerSigns in to a different app address.

On a remote computer (SSH)#

The browser needs to reach the local port on the machine where the CLI is running. Forward the port over SSH and use --no-browser:

Terminal
ssh -L 8765:127.0.0.1:8765 you@server
doublex login --no-browser

Open the URL the CLI shows in your computer's browser and click Allow.

Sign in with a key#

Generate your personal key in Settings › Profile › API access and pass it through stdin, so it doesn't end up in your shell history or in the process list:

Terminal
echo "$DOUBLEX_API_KEY" | doublex login --api-key -

The CLI checks the key with the server before saving it. If it's invalid, nothing is saved.

Check#

Terminal
doublex whoami
Ana Souza <[email protected]>
id: usr_1a2b3c4d5e6f
org: Empresa SA (admin)
teams: Sales, Operations
url: https://doublex.ai

With --json, whoami returns the same object as GET /api/me.

Sign out#

Terminal
doublex logout

logout revokes the terminal key on the server and deletes it from the keychain. If you signed in with your personal key, it's only removed from the keychain and stays valid: revoke it in your Profile if you need to. You can also disconnect any terminal from the Profile page, without access to the computer.

Environment variables#

Variables apply only to the command they're set for and take priority over what's saved. They're the way to go for CI, containers and servers without a keychain.

VariableWhat it's for
DOUBLEX_API_KEYAPI key. When it's set, the CLI doesn't check the keychain.
DOUBLEX_BASE_URLThe app's address.
DOUBLEX_LANGCLI language: pt, en or es.
XDG_CONFIG_HOMEChanges the folder of the config file (default ~/.config).
GitHub Actions
- name: Update the Brain with the product docs
  env:
    DOUBLEX_API_KEY: ${{ secrets.DOUBLEX_API_KEY }}
    DOUBLEX_BASE_URL: https://doublex.ai
  run: |
    curl -fsSL https://doublex.ai/cli/install.sh | sh
    ~/.local/bin/doublex brain upload docs/*.md --scope organization

Where the CLI stores the credential#

SystemWhere
macOSKeychain, item doublex-cli, one entry per app address
LinuxSecret Service (GNOME Keyring or KWallet), through secret-tool, service doublex-cli

The ~/.config/doublex/config.json file stores only the app's address, never the key. Because the key lives in the keychain, you can be signed in to more than one address (for example, production and a test environment) and choose with --base-url.