Organizations & Account Status
The Optibot CLI always acts as exactly one organization at a time. Your review quota, repositories, API keys, and security scans all belong to that active organization. If you belong to more than one organization, the CLI gives you commands to see which one is active and to switch between them.
How the Active Organization Works
When you authenticate, Optibot issues a token that is scoped to a single organization. The active organization is encoded in that token, not stored separately on disk. Switching organizations means exchanging your current token for a new one scoped to the organization you pick.
A few consequences worth knowing:
- API keys are bound to the organization that was active when you created them. A key minted for one organization will not act on another. To create a key for a different organization, switch first, then create the key.
- Switching is instant and does not require a new browser login. The CLI re-scopes your existing session.
- During
optibot login, if you belong to more than one organization, the CLI shows an arrow-key picker so you can choose which one to start in.
Checking Your Status
Run optibot status to see how you are authenticated, which organization is active, and how much of your review quota remains:
optibot status
The output includes:
- Auth method — whether the CLI is using the
OPTIBOT_API_KEYenvironment variable or your saved config file. - Org — the active organization (and your role in it). If you belong to more than one, it reminds you that
optibot org switchcan change it. - Reviews — quota used, limit, and remaining, plus when the quota resets. The CLI checks every limit that applies to you (a daily cap, your organization’s trial allowance, or its 30-day review limit) and reports the one with the fewest reviews left. When none of them applies it prints
no daily limitinstead of numbers. - A nudge to run
optibot setup ciif you have no API keys yet and are wiring Optibot into CI.
If the service rejects your API key, optibot status prints an authentication error and exits 1, so a CI step can use it to check the key before running reviews.
Listing Your Organizations
optibot org list
Lists every organization you belong to. The active one is marked with a *, and your role in each is shown in parentheses.
Showing the Active Organization
optibot org current
Prints just the currently active organization and your role in it.
Switching Organizations
optibot org switch
Opens an interactive arrow-key picker of your organizations. Selecting a different one re-scopes your stored session to that organization. If you only belong to one organization, there is nothing to switch and the command says so.
Heads up: API keys are bound to the organization active at the time they were created. After switching, run
optibot setup ci(oroptibot apikey create <name>) if you need a key that acts as the newly selected organization.
optibot org switch requires an interactive terminal. In a non-interactive environment (such as CI), set the correct organization on a dev machine first and use the API key it produces.
It also refuses to run while OPTIBOT_API_KEY is set, and exits non-zero:
Cannot switch organization while OPTIBOT_API_KEY is set.
That variable takes precedence over ~/.optibot/config.json, so nothing would read the re-scoped session the switch writes, and every command afterwards would keep acting as the previous organization. An optk_ key is in any case permanently bound to the organization that was active when it was created. To act as another organization, either unset the variable, switch, and run optibot setup ci to mint a key for that organization, or set OPTIBOT_API_KEY to a key created while that organization was active.
Command Reference
| Command | Description |
|---|---|
optibot status | Show auth method, active organization, role, and review quota |
optibot org list | List organizations you belong to (active marked with *) |
optibot org current | Show the currently active organization |
optibot org switch | Switch the active organization (interactive) |