> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/developers/integrations/reference/cli-reference.md). Agents can also search and read this documentation through its [MCP server](https://gitbook.com/docs/~gitbook/mcp).

# CLI reference

Explore the full reference guide for GitBook’s CLI commands

### `gitbook login`

Sign in through your browser. The CLI opens GitBook, waits for the authorization to redirect back to a local callback, and stores the resulting session.

The browser must run on the same machine as the CLI, so this doesn't work over SSH, in containers, in CI, or in sandboxed AI agents. Use `gitbook auth` in those environments. Browser sign-in also can't publish or unpublish integrations.

### `gitbook auth`

Authenticate the CLI with a GitBook Developer API token. You can generate a personal developer token in your [GitBook Developer settings](https://app.gitbook.com/account/developer). This works in CI, over SSH, and in AI agent sandboxes, and is required to publish integrations.

The token can also be provided using the command line argument `--token=<token>`; If none is provided, it'll be prompted.

### `gitbook integration new <dir>`

Create and initialize a new integration locally. The program will prompt for information about the integration.

### `gitbook integration dev`

Create a live connection from your integration to your GitBook editor. Updates made locally while the connection is running will automatically be received in the editor.

See the [development section](https://gitbook.com/docs/developers/integrations/development.md) to learn more.

### `gitbook integration publish`

Publish the integration defined in the `gitbook-manifest.yaml` file. See the [GitBook Manifest reference](https://gitbook.com/docs/developers/integrations/configurations.md) documentation to learn more.

See the [publishing section](https://gitbook.com/docs/developers/integrations/publishing.md) to learn more about publishing your integration to GitBook.

### `gitbook integration unpublish <integration-name>`

Unpublish your integration from the GitBook integration platform. Pass the name of the integration as an argument to the command.

{% hint style="info" %}
`gitbook integration` (singular) holds the commands for building and publishing your own integration. `gitbook integrations` (plural) holds the commands generated from the GitBook API for managing integrations, such as listing installations. Run `gitbook integration --help` or `gitbook integrations --help` to see each group.
{% endhint %}

### `gitbook whoami`

Print information about the currently authenticated user.

### `gitbook help`

View the GitBook CLI commands and information on using them.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://gitbook.com/docs/developers/integrations/reference/cli-reference.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
