Skip to content
QwryAI
Documentation
Pages

Getting Started

CLI Auth

Sign the QwryAI CLI in with your browser or an API key, check which credential it uses, and sign out

Use the auth commands to store a browser login for interactive use. For CI and other unattended jobs, set the QWRYAI_API_KEY environment variable instead. See QwryAI CLI.

Whichever way you sign in, you choose what the credential may do, and it never gets more than your workspace role allows. If your role changes, you leave the workspace or the plan lapses, the credential loses that access too.

Log in with the browser

For interactive use, sign in through your browser:

Bash
qwryai-cli auth:login

The CLI opens the Connect qwryai-cli to QwryAI page and prints a device code such as 7KQ2-M9XD. Sign in if you're asked to.

  1. Check the device code

    Make sure the Device code on the page matches the one in your terminal. The page also shows the Workspace and its plan, and the Agents the CLI will reach: access covers every agent in the workspace, including ones you add later.

    Check that the Device code matches the code in your terminal.
  2. Choose the permissions

    Under Permissions, every permission your role holds is on. Turn off any the CLI shouldn't have, such as Change agent settings for a read-only script.

    Turn off any permission the CLI shouldn't have.
  3. Approve

    Select Approve qwryai-cli. The terminal confirms the login and the CLI stores the credential in ~/.qwryai/credentials.json, readable by your user alone.

    auth:login prints one JSON line when it starts and one when you've approved, so a script can read the approval link before the login finishes:

    JSON
    {"success":true,"action":"open_verification_url","verification_uri":"https://www.qwryai.com/oauth/device/verify","verification_uri_complete":"https://www.qwryai.com/oauth/device/verify?user_code=7KQ2-M9XD","user_code":"7KQ2-M9XD","browserOpened":true}
    {"success":true,"message":"QwryAI CLI authenticated","apiUrl":"https://api.qwryai.com/public/v1"}

    On a server, over SSH or in any terminal that can't open a browser, add --no-open and open verification_uri_complete on another device:

    Bash
    qwryai-cli auth:login --no-open

    The code is valid for 15 minutes. If nobody approves it in time, the CLI stops with Device login expired; run auth:login again.

Log in with an API key

For scripts and CI, create an API key and pass it in the environment. The CLI doesn't store keys.

  1. Create the key

    In QwryAI, open Workspace settings › API keys and select Create API key. Choose what the key can do in Create New API Key, then select Confirm. Only members who can manage API keys see the button, and the page asks you to subscribe if your plan has no API access.

    On Workspace settings › API keys, select Create API key, choose what the key can do, then select Confirm.
  2. Set the variable
    Bash
    export QWRYAI_API_KEY=<your-qwryai-api-key>
    qwryai-cli auth:status --verify

Check status

Bash
qwryai-cli auth:status

Shows whether a credential is set up and where it comes from (oauth for a browser login, api_key for QWRYAI_API_KEY, or none). It doesn't contact QwryAI:

JSON
{"success":true,"data":{"apiUrl":"https://api.qwryai.com/public/v1","authenticated":true,"source":"oauth"}}

Add --verify to ask QwryAI what the credential can do right now: the workspace's plan, your role, the permissions it holds and the tools they allow.

Bash
qwryai-cli auth:status --verify
JSON
{
  "success": true,
  "data": {
    "apiUrl": "https://api.qwryai.com/public/v1",
    "authenticated": true,
    "source": "oauth",
    "account": {
      "success": true,
      "data": {
        "tenantId": "<workspaceId>",
        "plan": "growth",
        "authType": "oauth",
        "creatorRole": "Admin",
        "granted": ["USE_CHAT", "MANAGE_CHAT", "READ_AGENT_CONFIGURATION"],
        "permissions": [
          { "permission": "USE_CHAT", "label": "Chat with agents" },
          { "permission": "MANAGE_CHAT", "label": "Manage conversations and helpdesk" },
          { "permission": "READ_AGENT_CONFIGURATION", "label": "Read agent settings" }
        ],
        "tools": ["get_account_context", "list_agents", "search_knowledge", "create_conversation", "send_message", "query_conversations", "agent_configuration"]
      }
    }
  }
}

The CLI prints this on one line; it's spread out here for reading.

Log out

Bash
qwryai-cli auth:logout

Revokes the browser login on QwryAI and deletes ~/.qwryai/credentials.json:

JSON
{"success":true,"message":"QwryAI OAuth credentials revoked and removed"}

auth:logout doesn't touch QWRYAI_API_KEY. To stop a key working, delete it in Workspace settings › API keys.

Commands

CommandPurpose
qwryai-cli auth:loginSign in through the browser approval page
qwryai-cli auth:login --no-openPrint the approval link without opening a browser
qwryai-cli auth:statusShow whether a credential is set up and its source
qwryai-cli auth:status --verifyAsk QwryAI for the plan, role, permissions and tools the credential has now
qwryai-cli auth:logoutRevoke the browser login and delete the stored credential

Explore the documentation