> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sabaothcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# sabaoth org use

> Select the organization later commands act in

Selects an organization you have logged in to on this machine, after checking that its stored key still gives access.

```bash theme={null}
sabaoth org use <org-id> [--json]
```

## Arguments

**org-id** `string` *required*

The ID of an organization stored on this machine. Run `sabaoth org list` to see them.

## Flags

**--json** `boolean` (default: false)

Print the result as JSON on stdout.

## Example

```text theme={null}
$ sabaoth org use org_xyz
Now using Side Project (org_xyz).
```

With `--json`:

```json theme={null}
{
  "selected_organization_id": "org_xyz",
  "organization": { "id": "org_xyz", "display_name": "Side Project" }
}
```

## Behavior

* **Access is checked first.** The CLI sends the stored key to the API, and the organization must still be one the key covers. Then the selection is saved.
* **The display name is refreshed.** If the organization was renamed, the new name is saved and a warning tells you so.
* **Nothing changes on failure.** If the key is rejected, no longer covers the organization, is missing, or the keychain is locked, the previous selection stays.
* **Only organizations you've logged in to.** To add a new one, use [`sabaoth login`](https://docs.sabaothcloud.com/cli/commands/login).

> [!NOTE]
>
> With `SABAOTH_API_KEY` set, the selection is still saved, but a warning reminds you that commands keep using the environment variable's organization until you unset it.

> [!TIP]
>
> To run a single command in another organization without changing the selection, pass `--org` to that command instead, for example `sabaoth postgres list --org org_xyz`.

## Errors

| Code | Exit | Meaning |
| - | - | - |
| `ORGANIZATION_NOT_REGISTERED` | 2 | You haven't logged in to this organization on this machine. Run `sabaoth login --org <org-id>`. |
| `CREDENTIAL_NOT_FOUND` | 1 | The organization is listed, but its key is missing from the keychain. Run `sabaoth login --org <org-id>`. |
| `ORGANIZATION_NOT_AUTHORIZED` | 1 | The stored key no longer gives access to this organization. |
| `API_KEY_UNAUTHORIZED` | 1 | The stored key was rejected, for example because it was revoked or expired. Log in again with a new key. |
| `CREDENTIAL_STORE_UNAVAILABLE` | 1 | The OS keychain couldn't be reached. Unlock it and retry. |

## Related

* [`sabaoth org list`](https://docs.sabaothcloud.com/cli/commands/org-list)
* [Organizations and context](https://docs.sabaothcloud.com/cli/organizations.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.