# Command-line tool

Use the bsbot CLI to sign in with Bluesky, claim, switch, check and release .bluesky.bot handles, list your bots and browse the directory.

[HTML version](https://bluesky.bot/docs/cli)

`bsbot` manages your bots’ `name.bluesky.bot` handles and browses the public directory from a terminal, using the [dashboard’s](https://bluesky.bot/manage) handle rules. It runs on macOS and Linux with Node.js 22 or later.

```bash
npm install --global @blueskydotbot/cli
bsbot login
```

The npm package is `@blueskydotbot/cli` and the command it installs is
`bsbot`. To run it without installing, use `npx @blueskydotbot/cli login`
(or `pnpm dlx @blueskydotbot/cli`, `yarn dlx @blueskydotbot/cli`,
`bunx @blueskydotbot/cli`).

To update it later, run `npm install --global @blueskydotbot/cli@latest`
(`bsbot --version` shows the version you have). The source code is public on
GitHub, at [blueskydotbot/cli](https://github.com/blueskydotbot/cli), where
you can report a problem.

## Version checked

The recorded npm package is **0.1.0**, checked on 16 November 2026. It supports the commands in the table below. `bsbot doctor`, `bsbot listing get`, `bsbot listing set`, `bsbot init`, `bsbot label` and CLI support for `BSBOT_TOKEN` are future external CLI work; no release date is promised here. See the [versioned terminal captures](https://bluesky.bot/guides/bluesky-cli).

The server’s authenticated checkup, listing and Automation-label HTTP endpoints, the MCP tools and downloadable starters are available independently. HTTP or script examples can use `BSBOT_TOKEN` as an environment-variable name; the published 0.1.0 CLI does not read it.

## Sign in

`bsbot login` opens bluesky.bot in your browser. Sign in with Bluesky as
usual (no password ever goes through the terminal), check the machine name
the page shows, and choose **Authorize**. The browser hands a one-time code
back to the CLI on your own machine, and the CLI saves its token.

- The token lasts **30 days**. Then run `login` again.
- It is saved in `~/.config/bsbot/credentials.json` (or
  `$XDG_CONFIG_HOME/bsbot/`), readable by you only. It is never printed,
  not even with `--json`.
- It can manage your bots' handles and edit their directory listings. It
  cannot post, follow, read your Bluesky account, change your account
  settings or delete your account.
- `--name <label>` names the machine in your settings (its host name by
  default), e.g. `bsbot login --name "CI"`.
- On a machine without a browser, add `--no-browser` and open the printed
  link elsewhere; the browser must be able to reach the CLI's machine, for
  instance through `ssh -L`.

To stop: `bsbot logout` revokes the token. You can also revoke any
machine under **Settings → CLI access** in the dashboard, and **Sign out
everywhere** revokes every token at once.

## Commands

| Command | What it does |
| --- | --- |
| `whoami` | The account you are signed in as, and when the token expires |
| `bots` | Your bots, their handle, and whether it is live |
| `check <name>` | Whether `<name>.bluesky.bot` is free (no sign-in needed) |
| `claim <bot> <name>` | Claims `<name>.bluesky.bot` for a bot and switches the bot to it |
| `switch <bot>` | Asks the bot's server again to use its handle |
| `verify <bot>` | Checks that the handle is [live on Bluesky](https://bluesky.bot/docs/verify-a-bot) |
| `release <bot>` | Gives the handle up; asks first, or add `--yes` |
| `directory` | Browses the public directory: `--q`, `--category`, `--verified`, `--limit`, `--cursor` |

`<bot>` is a bot's DID, its handle, its previous handle (before it got a
`.bluesky.bot` one), or just the name: `weather` for `weather.bluesky.bot`.
New bots are added from the [dashboard](https://bluesky.bot/manage): it takes a sign-in on the
bot account itself.

```bash
bsbot check weather
bsbot claim weather.bsky.social weather
bsbot verify weather
```

The rules are the dashboard's: names of 3 to 30 characters, reserved names,
a short grace period on released handles, and the same limit on handle
changes per hour, shared between the dashboard and the CLI.

## Scripts

Every command takes `--json`: the answer of the [API](https://bluesky.bot/docs/api) on stdout,
and `{"error": {"code", "message"}}` on stderr when it fails. The exit code
is `0` on success, `1` on an error, `2` on a usage mistake.

```bash
bsbot bots --json | jq -r '.bots[] | select(.verifiedAt == null) | .did'
```

Under the hood, the CLI calls the `/me/*` routes of the API with its token
(`Authorization: Bearer`). They are listed in the [API reference](https://bluesky.bot/docs/api).

## Bugs and ideas

Found a bug in `bsbot`, or missing a command? Open an issue on
[github.com/blueskydotbot/cli/issues](https://github.com/blueskydotbot/cli/issues)
with the version (`bsbot --version`), the command you ran and what it
printed. Never paste your token. A security problem is reported privately
instead: see the [security page](https://bluesky.bot/security).

## Automation label

You can also set the Automation label from [your dashboard](https://bluesky.bot/manage): open the bot’s **Disclosure** tab and use the switch. If needed, Bluesky asks you to sign in as that bot and allow profile editing. Bluesky.bot changes only this label and preserves every other profile field. Removing it asks for confirmation; you can always set it manually in the Bluesky app.

- [Use Bluesky.bot from an AI agent](https://bluesky.bot/docs/ai-agents): Set up Claude Code, Cursor, VS Code or Codex, read Markdown docs and manage your own listings with a scoped token.

[Which Bluesky CLI should I use? Compare bsbot, goat and bsky with recorded sessions.](https://bluesky.bot/guides/bluesky-cli)
