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

# Install the CLI

> Install the asteroid command, sign in, and pick an organization.

The `asteroid` command calls the Asteroid API from your terminal, scripts and CI. It needs Node.js 22 or later.

<Steps>
  <Step title="Install">
    ```bash theme={null}
    npm install -g @asteroidai/cli
    ```
  </Step>

  <Step title="Sign in">
    ```bash theme={null}
    asteroid login
    ```

    The CLI prints a code and opens your browser. Confirm the code to sign in. If you belong to more than one
    organization, pick one.
  </Step>

  <Step title="Check it works">
    ```bash theme={null}
    asteroid whoami
    asteroid workflow list
    ```

    Your user, organization and workflows come back.
  </Step>
</Steps>

## Organizations

`asteroid orgs` lists the organizations you can act in. `asteroid use <org>` sets the default by id or name.
`--org <org>` acts in another organization for one command.

## CI and agents

Set `ASTEROID_API_KEY` instead of signing in. An API key belongs to one organization, so `--org` does not apply.

```bash theme={null}
export ASTEROID_API_KEY=...
asteroid execution list --json
```

Add `--json` to get the API response as JSON. Scripts should read `--json`, because the text output may change
between releases. Exit codes: 0 ok, 1 API or sign-in error, 2 usage error.

## Shell completion

Load the completion script when your shell starts.

| Shell | Add this line | To |
| :- | :- | :- |
| zsh | `source <(asteroid complete zsh)`, after `compinit` | `~/.zshrc` |
| bash | `source <(asteroid complete bash)` | `~/.bashrc` |
| fish | `asteroid complete fish \| source` | `~/.config/fish/config.fish` |
| PowerShell | `asteroid complete powershell \| Out-String \| Invoke-Expression` | `$PROFILE` |

## Environment

| Variable | Use |
| :- | :- |
| `ASTEROID_API_KEY` | Authenticate with an API key instead of `asteroid login`. |
| `ASTEROID_API_URL` | API host. Defaults to `https://odyssey.asteroid.ai`. |
| `ASTEROID_ORG` | Default organization, by id or name. |
| `ASTEROID_CONFIG_DIR` | Where the CLI keeps its config and, without a keychain, its sign-in. |
| `ASTEROID_NO_BROWSER` | Print the sign-in link without opening a browser. |
| `ASTEROID_NO_KEYCHAIN` | Store the sign-in in a private file, not the OS keychain. |

## Next

<CardGroup cols={2}>
  <Card title="CLI reference" icon="list" href="/cli/reference" horizontal>Every command, its arguments and its flags</Card>
  <Card title="Call a workflow" icon="code" href="/integrate/call-a-workflow" horizontal>Run workflows from your own code</Card>
</CardGroup>


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