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:
qwryai-cli auth:loginThe 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.
- 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. - 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. - 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:loginprints one JSON line when it starts and one when you've approved, so a script can read the approval link before the login finishes:{"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-openand openverification_uri_completeon another device:qwryai-cli auth:login --no-openThe code is valid for 15 minutes. If nobody approves it in time, the CLI stops with
Device login expired; runauth:loginagain.
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.
- 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. - Set the variable
export QWRYAI_API_KEY=<your-qwryai-api-key> qwryai-cli auth:status --verify
Check status
qwryai-cli auth:statusShows 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:
{"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.
qwryai-cli auth:status --verify{
"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
qwryai-cli auth:logoutRevokes the browser login on QwryAI and deletes ~/.qwryai/credentials.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
| Command | Purpose |
|---|---|
qwryai-cli auth:login | Sign in through the browser approval page |
qwryai-cli auth:login --no-open | Print the approval link without opening a browser |
qwryai-cli auth:status | Show whether a credential is set up and its source |
qwryai-cli auth:status --verify | Ask QwryAI for the plan, role, permissions and tools the credential has now |
qwryai-cli auth:logout | Revoke the browser login and delete the stored credential |