> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/gitbook.md).

# GitBook

Search and manage documentation spaces in GitBook.

### Connectors

Choose the connector that matches your authentication method. The options below use the names shown in StackAI.

| Connector | Authentication        |
| --------- | --------------------- |
| GitBook   | Personal Access Token |

#### GitBook

Connect to GitBook to search and manage documentation spaces.

**Set up in GitBook**

1. Prepare the GitBook account or service that the workflow will access. Grant access to the required resources and operations.
2. **Personal Access Token:** Create a personal access token in GitBook Developer settings.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **GitBook**.
2. Enter the credentials and connection details in the fields below.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field         | Required | What to enter                                                                                                                                          |
| --------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Personal Access Token | Yes      | Create a personal access token in GitBook Developer settings. [Provider instructions](https://gitbook.com/docs/developers/gitbook-api/authentication). |

#### Verify the connection

Check that the connection is healthy. Then run a read operation against a resource the connected account can access. A successful connection check confirms authentication; it does not guarantee permission for every action.

If access is denied, check the credential or OAuth permissions, the selected account or environment, and access to the specific resource. Update expired credentials or reconnect after permissions change.

### Use an action

1. Add the required **GitBook** action to the workflow.
2. Select a connection when the action requests one.
3. Complete the required fields. Use the reference picker when a value comes from another workflow step.
4. Run the workflow and inspect the action’s output. Check the result before using it in a later step.

### Actions

#### List Spaces

List documentation spaces in a GitBook organization.

**Inputs**

| Field           | Type            | Required | Description                                                                                        |
| --------------- | --------------- | -------- | -------------------------------------------------------------------------------------------------- |
| Organization    | select (string) | Yes      | The GitBook organization whose spaces should be listed. Options load from the selected connection. |
| Maximum results | integer         | No       | The maximum number of spaces to return. Default: 100.                                              |
| Cursor          | string          | No       | Resume from a cursor returned by an earlier call.                                                  |

**Outputs**

| Field       | Type          | Description                                            |
| ----------- | ------------- | ------------------------------------------------------ |
| Spaces      | object\_array | The spaces in the selected organization.               |
| Space count | integer       | The number of spaces returned.                         |
| Next cursor | string        | The cursor for the next batch, when more spaces exist. |

#### Search content

Search published pages in a GitBook space.

**Inputs**

| Field           | Type            | Required | Description                                                                                      |
| --------------- | --------------- | -------- | ------------------------------------------------------------------------------------------------ |
| Organization    | select (string) | Yes      | The organization used to find the target space. Options load from the selected connection.       |
| Space           | select (string) | Yes      | The space whose published content should be searched. Options load from the selected connection. |
| Search query    | string          | Yes      | Words or a phrase to find in published pages. Maximum: 512.                                      |
| Maximum results | integer         | No       | The maximum number of ranked matches to return. Minimum: 1. Maximum: 500. Default: 50.           |
| Page            | string          | No       | The page number to retrieve. Leave empty for the first page.                                     |

**Outputs**

| Field          | Type          | Description                                    |
| -------------- | ------------- | ---------------------------------------------- |
| Search results | object\_array | Ranked matching pages and sections.            |
| Result count   | integer       | The number of matches returned.                |
| Next page      | string        | The next page number, when more matches exist. |

#### Get space content

Get the current published revision and page content for a GitBook space.

**Inputs**

| Field                    | Type            | Required | Description                                                                                                            |
| ------------------------ | --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- |
| Organization             | select (string) | Yes      | The organization used to find the target space. Options load from the selected connection.                             |
| Space                    | select (string) | Yes      | The space whose current published content should be returned. Options load from the selected connection.               |
| Include computed content | boolean         | No       | Include GitBook computed content generated from OpenAPI specifications, translations, or integrations. Default: false. |
| Maximum results          | integer         | No       | The maximum number of pages to return in this batch. Minimum: 1. Maximum: 500. Default: 100.                           |
| Cursor                   | string          | No       | Resume from a cursor returned by an earlier call.                                                                      |

**Outputs**

| Field              | Type    | Description                                                     |
| ------------------ | ------- | --------------------------------------------------------------- |
| Published revision | object  | The current published GitBook revision and this batch of pages. |
| Page count         | integer | The number of pages included in the result.                     |
| Next cursor        | string  | The cursor for the next batch, when more pages exist.           |

#### Get page content

Get the published Markdown content of one GitBook page.

**Inputs**

| Field        | Type            | Required | Description                                                                                              |
| ------------ | --------------- | -------- | -------------------------------------------------------------------------------------------------------- |
| Organization | select (string) | Yes      | The organization used to find the target space. Options load from the selected connection.               |
| Space        | select (string) | Yes      | The space containing the page to read. Options load from the selected connection.                        |
| Page         | select (string) | Yes      | The published page whose Markdown content should be returned. Options load from the selected connection. |

**Outputs**

| Field        | Type   | Description                                    |
| ------------ | ------ | ---------------------------------------------- |
| Page ID      | string | The exact GitBook page ID.                     |
| Page title   | string | The page title returned by GitBook.            |
| Page path    | string | The page path returned by GitBook.             |
| Git metadata | object | Git sync metadata for the page when available. |
| Page content | string | The complete published page body in Markdown.  |

#### Create page

Create a markdown page in a GitBook change request and optionally publish it.

**Inputs**

| Field                  | Type            | Required | Description                                                                                  |
| ---------------------- | --------------- | -------- | -------------------------------------------------------------------------------------------- |
| Organization           | select (string) | Yes      | The organization used to find the target space. Options load from the selected connection.   |
| Space                  | select (string) | Yes      | The space where the page should be created. Options load from the selected connection.       |
| Page title             | string          | Yes      | The title of the new page.                                                                   |
| Page content           | textarea        | Yes      | The page body in Markdown, without repeating the separately supplied page title.             |
| Parent page            | select (string) | No       | An optional page under which to create this page. Options load from the selected connection. |
| Change request subject | string          | No       | An optional subject of up to 100 characters for the draft. Maximum: 100.                     |
| Publish immediately    | boolean         | No       | Merge the change request after creating the page. Default: false.                            |

**Outputs**

| Field          | Type    | Description                                            |
| -------------- | ------- | ------------------------------------------------------ |
| Change request | object  | The change request containing the new page.            |
| Created page   | object  | The page created in the change request.                |
| Published      | boolean | Whether GitBook merged the change request.             |
| Merge result   | string  | GitBook's merge outcome when publishing was requested. |

#### Update page content

Replace a GitBook page's content in a change request and optionally publish it.

**Inputs**

| Field                  | Type            | Required | Description                                                                                |
| ---------------------- | --------------- | -------- | ------------------------------------------------------------------------------------------ |
| Organization           | select (string) | Yes      | The organization used to find the target space. Options load from the selected connection. |
| Space                  | select (string) | Yes      | The space containing the page to update. Options load from the selected connection.        |
| Page                   | select (string) | Yes      | The page whose content should be replaced. Options load from the selected connection.      |
| Page content           | textarea        | Yes      | The complete replacement page body in Markdown, without repeating the page title.          |
| Change request subject | string          | No       | An optional subject of up to 100 characters for the draft. Maximum: 100.                   |
| Publish immediately    | boolean         | No       | Merge the change request after replacing the page content. Default: false.                 |

**Outputs**

| Field          | Type    | Description                                               |
| -------------- | ------- | --------------------------------------------------------- |
| Change request | object  | The change request containing the page update.            |
| Updated page   | object  | The page after GitBook persisted the replacement content. |
| Published      | boolean | Whether GitBook merged the change request.                |
| Merge result   | string  | GitBook's merge outcome when publishing was requested.    |

### Important behavior

Actions that create, update, send, or delete data can change the connected service. Review their inputs before running them. A retry can repeat an operation; consider this when configuring retries for actions that change data.

The catalog lists the fields and capabilities available in the supplied provider definition. Availability can also depend on your deployment and organization’s Feature Access settings.


---

# 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://docs.stackai.com/integrations/catalog/gitbook.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.
