Only this pageAll pages
Powered by GitBook
Couldn't generate the PDF for 124 pages, generation stopped at 100.
Extend with 50 more pages.
1 of 100

GitBook Documentation

Getting Started

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Creating Content

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

API References

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Publishing Documentation

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Collaboration

Loading...

Loading...

Loading...

Loading...

GitBook Documentation

Create and publish beautiful documentation your users will love. GitBook has all the tools you need to create everything from product guides to API references and beyond.

At GitBook, our mission is to provide a user-friendly and collaborative solution for creating, editing, and sharing product and API documentation.

Sign up Quickstart

Discover GitBook

Task lists

Add a task list to display tasks that can be completed

Task lists allow you to create a list of items with checkboxes that you can check or uncheck.

Note: Readers of your published space will not be able to check or uncheck these boxes. You can decide which boxes are checked and unchecked when you create the content.

Example of a task list

Representation in markdown

- [ ] Here’s a task that hasn’t been done
  - [x] Here’s a subtask that has been done, indented using `tab`
  - [ ] Here’s a subtask that hasn’t been done.
- [ ] Finally, an item, unidented using `shift` + `tab`.

Stepper

Add a step-by-step guide to a page — perfect for guides, walkthroughs and technical troubleshooting processes

Stepper blocks let you break down a tutorial or guide into separate, but clearly linked steps. Each step can contain multiple different blocks, allowing you to add detailed information.

Example

1

Add a stepper block

To add a stepper block, hit / on an empty line or click the + on the left of the editor and select Stepper from the insert menu.

2

Add some content

Once you’ve inserted your stepper block, you can start adding content to it — including code blocks, drawings, images and much more.

3

Add more steps

Click the + below the step numbers or hit Enter twice to add another step to your stepper block. You can remove or change the style of the step header or step body if you wish.

Representation in Markdown

## Example

{% stepper %}
{% step %}
### Step 1 title
Step 1 text
{% endstep %}
{% step %}
### Step 2 title
Step 2 text
{% endstep %}
{% endstepper %}

Limitations

There are some limitations on which blocks you can create inside of a stepper block — for example, you cannot add expandable blocks or another stepper block. See all the blocks you can add by starting a new line within a stepper block and pressing / to bring up the insert palette.

Guides

Paragraphs

Add a paragraph block to insert formatted text, inline images and more

A paragraph is the most basic content block you can use on GitBook.

Example of a paragraph

Professionally printed material in English typically does not indent the first paragraph, but indents those that follow. For example, Robert Bringhurst states that we should “set opening paragraphs flush left.”

Representation in Markdown

Because a paragraph block is just text, that’s how it’s represented in Markdown.

Professionally printed material in English typically does not indent the first paragraph, but indents those that follow. For example, Robert Bringhurst states that we should “set opening paragraphs flush left.”

Tabs

Add tabs so you can display large blocks of related information without creating a long, hard-to-navigate page

A tab block is a single block with the option to add multiple tabs.

Each tab can contain multiple other blocks, of any type. So you can add code blocks, images, integration blocks and more to individual tabs in the same tab block.

Add or delete tabs

Example

Here is an example that lists instructions relevant to specific platforms:

Here are the instructions for Windows

Here are the instructions for macOS

Here are the instructions for Linux

Representation in Markdown

{% tabs %}

{% tab title="Windows" %} Here are the instructions for Windows {% endtab %}

{% tab title="OSX" %} Here are the instructions for macOS {% endtab %}

{% tab title="Linux" %} Here are the instructions for Linux {% endtab %}

{% endtabs %}

Page links

Add a page link block to show relations between pages in your space.

Page link blocks are the best way create relations between different pages within your content. Page links stand out on the page as they fill their own block — compared to a hyperlink added to some text.

Example of page link block

Representation in Markdown

{% content-ref url="./" %} . {% endcontent-ref %}

Math & TeX

Add a mathTeX block to a page when you want to display a mathematical formula in your documentation

Example of Math & TeX block

Representation in Markdown

# Math and TeX block

$$f(x) = x * e^{2 pi i \xi x}$$

Columns

Add a column to create different layouts in your documentation.

Columns are a great way to create different layouts for your documentation. You can add many different types of blocks inside a column, and adjust the width of each side to customize it to the design you need.

Representation in Markdown

## Example

{% columns %}
{% column width="50%" %}
### Create a seamless experience between your docs and product

Integrate your documentation right into your product experience, or give users a personalized experience that gives them what they need faster.

<a href="https://www.gitbook.com/#alpha-waitlist" class="button primary">Learn more</a>
{% endcolumn %}

{% column %}
<figure><img src="../../.gitbook/assets/GitBook vision post.png" alt="An image of GitBook icons demonstrating side by side column functionality"><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

Setting a custom subdirectory

Set a custom subdirectory for your docs sites

One reason to do this is so that your docs URL is formatted in a consistent way with your other site URLs. Using a subdirectory may also be beneficial for SEO.

To configure a subdirectory, you'll need to set things up in your website's backend, then finalize the process in your GitBook site settings.

GitHub pull request preview

See a preview of your content when making a pull request in GitHub

When you submit a pull request (PR) to a GitHub branch that has been synced to a GitBook space, you can preview the content before merging. This allows you to check the impact of changes before merging them.

You can use this feature to have a final layer of checks before merging a PR, allowing you to see your changes in a non-production environment before merging it into your synced branch.

How to access preview links

For every PR create using a target branch synced with a GitBook space, you’ll see a status added to the PR with a unique preview URL. Clicking the Details link on the status will take you to the preview URL for your content. You can then make sure the content is as expected before merging the PR.

Preview links are only accessible by users with a GitBook account.

Security considerations

For security reasons, by default GitBook doesn’t currently generate previews for PRs opened from forks of your repository. Because the content of the PR preview is accessible under your own domain, whether on .gitbook.io or your custom domain, a user could generate malicious content in a fork of your public repository and have it served under your name.

We allow users to explicitly configure this through an option in the Git Sync settings.

GitHub & GitLab Sync

Synchronize your GitBook content with GitHub or GitLab with GitBook’s bi-directional integration

Overview

Git Sync allows technical teams to synchronize GitHub or GitLab repositories with GitBook and turn Markdown files into beautiful, user-friendly docs. Edit directly in GitBook’s powerful editor while keeping content synchronized with your codebase on GitHub or GitLab.

Git Sync is bi-directional, so changes you make directly in GitBook’s editor are automatically synced, as are any commits made on GitHub or GitLab. This allows developers to commit directly from GitHub or GitLab and technical writers, instructional designers and product managers to edit, discuss and feedback changes directly in GitBook.

Embedded URLs

Embed videos, music and more directly into your page with a URL

To add an embedbed URL, simply paste the link of the content you want to embed and hit Enter.

Note: The content you want to embed must be publicly available in order for GitBook to access the file. For example, when embedding a Google doc the share settings must be set to Anyone with the link.

Videos

Note: You can choose to auto-play and loop YouTube and Vimeo embeds by adding ?autoplay=1&_loop=1 to the end of your video’s URL.

Codepen

Spotify

Representation in Markdown

{% embed url="URL_HERE" %}

Quotes

Add a quote block to a page to highlight copy you’re adding from elsewhere, or to draw attention to a specific part of your text

Quotes are useful when you want to include something from another source.

Example of a quote

"No human ever steps in the same river twice, for it’s not the same river and they are not the same human." — Heraclitus

Representation in Markdown

> "No human ever steps in the same river twice, for it’s not the same river and they are not the same human." — _Heraclitus_

Quickstart

Get up and running in GitBook and publish your first docs site in minutes

Getting started

You’ll need a GitBook account to start publishing documentation.

Create a docs site

When you first sign up, you’ll have a chance to create a docs site from the docs site wizard. You can launch the wizard again to create a new site at any point by clicking the + button next to the Docs sites header in the sidebar.

The docs site wizard will take you through the flow of creating your first site. You’ll need to give your site a name, choose if you want to start from scratch with an empty site or add our sample content, and whether or not you want to publish your docs right away.

Edit your content

Check out these resources if you’d like to learn more about the editing experience in GitBook:

Customize your site

Not only can you edit the content of your site, you can also customize many settings related to the look and feel of your site when it’s published.

You can read more about customizing your docs in the resources below:

Publish your documentation

Finally, you’re ready to publish your site into the world. If you haven’t already published your site from the wizard, you can publish your site from your site’s dashboard at any time.

After publishing your site, you’ll get a link that you’re able to share with anyone!

Commit messages & Autolink

By default, when exporting content from GitBook to the Git repository, GitBook will generate a commit message based on the merged change request:

Autolink GITBOOK-<num> in GitHub and GitLab

Use the following URL format, where spaceId corresponds to your space’s URL:

<https://app.gitbook.com/s/{spaceId}/~/changes/<num>/

Customize the commit message template

The template can contain the following placeholders:

  • {change_request_number} unique numeric ID for the change request

  • {change_request_subject} the subject of the change request when merged, or No subject if none has been provided.

The default template is:

Spaces

Organize the content you create and publish into spaces

A space is a project that lets you work on a collection of related pages. They allow you to write content, organize pages, add integrations and more.

Create a space

Duplicate a space

Duplicating a space will create a copy of the source space, in the same location (organization, collection, sub-collection, etc.).

Move a space

Delete a space

Deleted spaces can be restored from the Trash for up to 7 days. After this, they will be permanently deleted.

Unordered lists

Add an unordered list block to create bullet point lists

Unordered lists are great for making a series of points that do not necessarily need to be made in a particular order. They are effectively bullet point lists, with support for nesting as needed.

When typing a list in GitBook, you can exit the list and start a new empty block below by hitting Enter twice.

Example of unordered list

  • Item

    • Nested item

      • Another nested item

    • Yet another nested item

  • Another item

  • Yet another item

To create nested items, you can use Tab to indent and ⇧ + Tab to outdent.

Representation in Markdown

Search & Quick find

Search and navigate your documentation fast with quick find.

GitBook’s Quick find palette lets you search for content across all your organizations, and jump between them fast.

Use Quick find

Search results

Results from the space you’re currently in appear at the top, followed by results from other spaces from the organization you’re currently working in — as well as other organizations you are a member of.

We do not currently support the ability to prioritize certain content in Quick find results.

Permissions

Quick find is compliant with your team’s permission settings, meaning that users will only be able to search the content they have permission to access.‌

Content indexing

Each result shows the first three lines of information below the section header. If your section is too big, your keyword match may not appear in the preview — but don’t worry, quick find still found a match!

GitBook AI

GitBook uses AI to help you find the knowledge you need within your organization, faster

When engaging with GitBook AI, you have the ability to ask questions or elaborate on specific requirements. This AI-driven tool is designed to review your documentation in real-time, providing you with quick, direct answers.

GitBook AI helps you find answers in the GitBook app

You can enable GitBook AI for your organization’s internal content, allowing you to ask questions and get semantic answers about your internal knowledge base.

Head to the Organization settings page and, in the General tab, toggle the Enable GitBook AI setting on.

Using GitBook AI search

FAQs

How long does it take for GitBook AI to index changes?

How does GitBook AI handle my data?

How do I prevent hallucinations with GitBook AI search?

If you’re seeing GitBook produce answers that are incorrect, the best method for correcting this is write explicit content around the topic so the AI does not have to guess.

Add an OpenAPI specification

Learn how to add and update an OpenAPI specification in GitBook application or from CLI.

How to add a specification

  1. Open the OpenAPI section in the sidebar

  2. Click on Add specification

  3. Give your specification a name. This helps identify it, especially if you manage multiple specs

  4. Choose one of the following:

    • Upload a file (e.g. openapi.yaml)

    • Enter a URL to a hosted spec

    • Use the CLI to publish the spec

Update your specification

You can update your OpenAPI specification at any time using the GitBook UI or the CLI, regardless of how it was initially added.

In GitBook Application

In the OpenAPI panel:

  • If your spec is linked to a URL:

    • GitBook checks for updates automatically every 6 hours.

    • To fetch updates immediately, click Check for updates.

  • If your spec was uploaded as a file:

    • Click Update to upload a new version.

  • You can switch from a File to a URL source by clicking on Edit in the breadcrumb actions menu.

Using the CLI

Use the same command to update your specification:

You can also use the CLI to Check for updates by running the publish command on the same URL.

Publish a docs site

Publish your documentation to the internet as a docs site

Once you’ve finished writing, editing, or importing your content, you can publish your work to the web as a docs site. Your docs will be published on the web and available to your selected audience.

Create a docs site

To create a docs site, click the plus + icon next to Docs site in the sidebar to launch the docs site wizard.

Give your site a name, choose a starting point for your content, and select whether you want to publish your site now or later.

If you already have content in a space that you would like to use, you can create a docs site directly from that space by opening the space and clicking Share in the top-right corner of the window. Then choosing Publish as a docs site from the share modal.

Publish a docs site

There are three primary options to choose from when publishing your site:

Delete or unpublish a docs site

Site editing permissions

You can view all the permissions set for users with access to the docs site from the permissions modal from the docs site’s Overview page. You’ll also see which space the user’s permission was inherited from. If you’d like to change the permission settings, open the space, then click Share. Here you can edit the permissions from a modal.

Users with Administrator or Creator permissions on any space linked to a specific docs site will have full access permissions for the site. This means that they’ll be able to control any of the publishing and customization settings.

Users with Reviewer, Editor, Commenter, or Reader permissions on any space linked to a specific site will get read-only permissions. This means they will see the docs site in your organization, but won’t be able to access any of its settings.

Integrating with CI/CD

Learn how to automate the update of your OpenAPI specification in GitBook.

Upload a specification file

If your OpenAPI spec is generated during your CI process, you can upload it directly from your build environment:

Set a new souce URL or trigger a refresh

If your OpenAPI specification is hosted at a URL, GitBook automatically checks for updates. To force an update (for example, after a release), run:

Enabling authenticated access

To protect your docs behind a sign-in screen, you’ll need to first enable authenticated access for your site.

Enable authenticated access

Choose an authentication method

Depending on your setup, we have integrations and guides on setting up authenticated access for different tools.

Head to the relevant guide to continue setting up authenticated access for your site.

Managing API operations

Learn how to mark an OpenAPI API operation as experimental, deprecated or hide it from your documentation.

It’s common to have operations that are not fully stable yet or that need to be phased out. GitBook supports several OpenAPI extensions to help you manage these scenarios.

Marking operation as experimental, alpha, or beta

Use x-stability to communicate that an endpoint is unstable or in progress. It helps users avoid non-production-ready endpoints. Supported values: experimental, alpha, beta.

Deprecating an operation

To mark an operation as deprecated, add the deprecated: true attribute:

Optionally specify when support ends by including x-deprecated-sunset:

Hiding an operation from the API reference

To hide an operation from your API reference, add x-internal: true or x-gitbook-ignore: true attribute.

Collections

Organize your spaces into folders.

Collections are a way to group spaces together to make it easier for you to organize your content. With collections, you can:

  • organize your content by similar topics or ideas

Create a collection

Click the + button next to the Spaces header in the sidebar to create a new collection. You can also create a collection or space within another collection from the collection’s main page.

Move a collection

Nested collections

You can nest collections inside each other, creating a collection -> sub-collection -> space hierarchy.

Open a collection and you can click New collection from the collection’s main page to create a sub-collection.

How to delete a collection

Deleting a collection is final, but spaces inside a deleted collection will move to the Trash and can be restored up to seven days after deletion. You can access the Trash from the bottom of the sidebar.

Drawings

Create drawings within GitBook and add them to your page

To create a drawing, press / on an empty line to bring up the insert palette and choose Drawing. This will open a popover with Excalidraw tools — simply close the popover when you’re done and your diagram will appear on your GitBook page.

GitBook stores drawings as special SVG files in the space. Those files have an extension of drawing.svg.

Example of a drawing block

Draw with GitBook AI

When using drawing block, you can ask GitBook AI to generate an illustration by specifying a prompt. Simply type in a prompt and hit Generate, or choose one of the suggested prompts to get started.

Once GitBook AI has finished the drawing, you can double-click to open the full drawing palette and edit it however you like.

When editing a drawing, click the Use AI to generate button to bring up GitBook AI’s prompt editor again and generate a new drawing.

Content structure

Create pages, spaces and collections

The structure of your content in GitBook is organized through pages, spaces and collections. Pages live inside of spaces, and collections are groups of spaces.

Layout and structure

Customize the layout and structure of your published documentation.

Header

Search bar

Change the position and look of the search bar between prominent (centered in the header) and subtle (located in the upper right corner). Turning off the header entirely will place the search bar in the sidebar instead.

Navigation

Add header links to your site. You could use header links to point to important parts of your documentation, or link back to your main website.

You can choose what appearance you would like your link to have—normal link, primary button, or secondary button. When enabled, simply add a title and a URL for each link. We support two levels of header navigation, meaning you can have sub‑links that appear in a dropdown menu.

Announcement (Premium & Ultimate)

Toggle this option on to add an announcement banner to the top of your published site. You can add a message and optionally include a link and call to action, which will appear after your message in the banner.

You can also change the announcement style using the same options as hint blocks—Info, Warning, Danger, and Success. The color of these styles is determined by your semantic colors settings.

Pagination

Control the display of the “previous” and “next” buttons that appear at the bottom of each page in your space. You can also set this feature for specific pages.

Footer (Premium & Ultimate)

Logo

Add your logo or another image in the footer.

Copyright text

Add copyright information to your footer.

Navigation

Add links in your footer, organized into multiple sections. Similar to the header, add a title and URL for each link, and include a section title for each group of links.

Configuring a subdirectory with Vercel

Host your documentation with a /docs subdirectory using Vercel

1

Configuring your GitBook site

In your GitBook instance, click on your docs site name in the sidebar, then Manage site, then Domain and redirects. Under ‘Subdirectory’, click Set up a subdirectory.

Enter the URL where you would like to host your docs. Then specify the subdirectory for docs access, e.g. tomatopy.pizza/docs, and click Configure.

Under Additional configuration, you will now see a proxy URL. You'll use this in the next step when configuring your Vercel settings. Copy it to your clipboard.

2

Update your vercel.json

In your Vercel app, open your vercel.jsonfile (or create one in the root directory if you don't already have one). Then, add the following:

Be sure to update the URL on line 5 with the proxy URL you got from GitBook in the first step.

3

Re-deploy your app and try it out!

Re-deploy your Vercel app with the update configuration. This may take a few moments. Now, when visiting the URL, you should see your docs site!

Searching internal content

Find what you’re looking for faster with keyword search and AI-powered smart search

Whether you’re working within the GitBook app or your visitors are reading your published content, GitBook’s search functions help to make it easy to find what you’re looking for.

You can use quick find to look for specific words or phrases, or you can ask GitBook AI a question. It’ll scan through your docs and summarize an answer in seconds, with references to help you find out more.

Global search

Describing enums

Learn how to add descriptions to enums.

When an API operation includes an enum, you can add x-enumDescriptions to provide more context about each option. GitBook will display the enum values and their descriptions in a table next to the operation.

Authenticated access

Set up custom authentication for your published content

Authenticated access allows you to publish your content while requiring authentication from any visitors who want to view it. When enabled, GitBook lets your authentication provider handle who has access to the content.

Use cases

Common use cases for authenticated access include:

  • Publishing sensitive product documentation that should only be accessible to paying customers, sales prospects or partners.

  • Publishing internal knowledge base content that should only be accessible to employees of your company.

How it works

There are two methods you can choose from when setting up authenticated access:

  1. Installing one of our authentication integrations — we currently support Okta, Azure, and Auth0. We highly recommend this option if you’re using an authentication provider we support.

  2. Create and host your own server to handle the authentication. Many different technologies can be used, but it’s up to you to code and maintain the solution you choose.

PDF export

Export a PDF copy of your GitBook content

Allow readers to export a PDF version of your published content

This setting determines whether or not readers of your published content can download it in PDF format. This feature is only available for Standard and Premium sites.

Export your own internal content as PDF

However you decide to configure your published docs sites, all logged-in members of an organization on a Pro or Enterprise can export a page — or an entire space — from your internal knowledge base as a PDF file.

Note that links across spaces are not currently supported when exporting internal content to PDF.

Export an individual page

  1. next to the page title.

  2. Select Export to PDF > Current page.

  3. Wait for the page to load, then click the Print or save as PDF button in the upper right to open your browsers Print menu.

  4. From here, you can save the page as a PDF or open it in your PDF viewer using the typical process for your browser.

Export an entire space

  1. next to the page title and choose Export as PDF > All pages. Alternatively, open the space’s Actions menu

  2. Wait for the page to load, then click the Print or save as PDF button in the upper right to open your browsers Print menu.

  3. From here, you can save the page as a PDF or open it in your PDF viewer using the typical process for your browser.

Live edits

Edit pages in real-time with other collaborators

GitBook supports live collaboration, meaning you’ll be able to work on the same document with multiple members at the same time.

Toggling live edit mode

When a space is in Live edits mode, the space header will show the Editor tab. When it is in Locked live edits mode, the space header will show a Read-only tab. When the Read-only tab appears in the space header, you will need to open a change request to edit the content of the page, or unlock live edits.

When is live editing not available?

You cannot unlock live editing if:

  1. a space is published with the In collection, Public, or Unlisted visibility option.

Testing with segments

Test your conditions with mock data.

Segments allow you to test the conditions you set by defining claims on a mock user.

For example, you might want to only show a page or section to beta users. By creating a segment and defining the properties associated with this group of mock users, you can mimic a segment that is specific to the users you’re targeting.

Create a segment

Here you’ll be able to define the data that will appear on a mock user. Because this is the data that’s being represented, the visitor.claims key is omitted.

Example

To create a segment for beta users following the examples in our docs, you would create a new segment, and add the following data.

When heading back to the condition editor, selecting the beta segment we created should show that the page we’re viewing would be accessible to our test user.

Detected segments

Detected segments allow you to get a sense of the type of claims you are receiving from visitors to your site.

These segments are not editable, but allow you to copy/paste claims from the segment editor to create your own user segments.

Testing segments in the preview

In addition to testing segments in the segment editor, you’ll be able to use your segments in real time in the preview when viewing changes for your site.

Use the dropdown in the upper left corner when in preview mode for your site to choose a segment to see how your site will look for your chosen segment.

Adding custom code samples

Learn how to configure custom code samples to display alongside your API endpoints.

GitBook can automatically generate generic code examples for each API operation. If you’d prefer to showcase custom or more detailed snippets, add x-codeSamples to your OpenAPI definition. This way, you control how your endpoints are demonstrated and can offer language or SDK-specific examples.

Key Points

  • x-codeSamples is an array of code sample objects.

  • Each object defines:

    • lang: The language of the code (e.g., JavaScript, Java).

    • label: A short label for the code block.

    • source: The actual code snippet.

You can to your paragraph, such as emojis, images and Math & TeX.

You can also using the context menu or keyboard shortcuts, or using .

To add a new tab to a tab block, hover over the edge of a tab and click the + button that appears. To delete a tab, open the tab’s Options menu then select Delete.

The links below point to and :

You can use the mathTeX format to include mathematical formulae in your documentation. We offer this through the library.

You can also add mathTeX .

s=1N−1∑i=1N(xi−x‾)2s = \sqrt{\frac{1}{N-1} \sum_{i=1}^N (x_i - \overline{x})^2}s=N−11​i=1∑N​(xi​−x)2​

f(x)=x∗e2piiξxf(x) = x * e^{2 pi i \xi x}f(x)=x∗e2piiξx

Create a seamless experience between your docs and product

Integrate your documentation right into your product experience, or give users a personalized experience that gives them what they need faster.

Learn more

With a custom subdirectory, you can make your docs site accessible at example.com/docs. This is different from a which lets you make your docs site accessible at docs.example.com.

This behavior works out of the box, provided you have given the the necessary read-only permissions to PRs.

Only can enable and configure Git Sync.

Start a quote by typing > followed by pressing Space in an empty paragraph, or use the. You can also convert a paragraph block to a quote by highlighting the entire paragraph and hitting >.

Now that you’ve created a site, you can edit or import your content. If you have an existing repository on GitHub or GitLab with your documentation, you can easily migrate and sync your content to GitBook using . Find out more in .

After importing your content, you can edit your pages using GitBook’s built-in editor and do things like , customize the and more.

You can change things like the , add more structure through and , or update your settings.

If you’re running into problems or have any questions, we’re here to help. or and we’ll help you from there.

Want to explore publishing in more details? Check out .

If you want to automatically resolve your GitBook change request IDs (e.g. GITBOOK-123) in commits to links, you can enable this using GitHub’s Autolink references feature. See instructions on .

When using GitBook with a , or when you have specific guidelines for commit messages; you might want to customize the message used by GitBook when pushing a commit to Git.

Click the + button next to the Spaces header in the sidebar and choose New space to create a new space. You can also create a new space inside a .

You can edit a space’s name by hovering over the name in the .

To duplicate a space, open that space's Action menu in the sidebar and select Duplicate.

You can move a space by opening the space’s Action menu in the sidebar, selecting Move space to… and choosing a destination. Alternatively, you can drag and drop spaces in the sidebar to move or reorder them. You can move spaces between collections or even organizations, as long as you have an in both.

You can delete a space by opening the space’s Action menu in the sidebar and selecting Delete.

​You can open the Quick find palette by hitting the Quick find button at the top of the sidebar or by pressing ⌘ + K on Mac or Ctrl + K on PC.

When you select a search result from an organization, you’ll switch to browsing that organization. To go back, use quick find to select a document in the organization you were in before, or use in the sidebar.

We index your content by grouping it into sections. Sections are denoted using , with the content that follows them forming part a section.

GitBook AI search is available both within the GitBook app to search internal content, and .

Once GitBook AI is enabled, open the Ask or search menu from the left sidebar and simply type out a question. GitBook AI will take a few seconds to scan your documentation and summarize the results.

When someone makes a change to your content — such as a merged — it can take up to one hour for GitBook to index the changes to and reflect them in AI search results.

We pass your content to OpenAI to index and process data. OpenAI does not use this content for service improvements (including model training). You can find out more about how OpenAI handles data .

If you have an OpenAPI spec, you can add it to your organization by uploading the file directly, linking to a hosted URL, or using the .

Read our guide to learn how to automate the update of your specification.

The content on your site comes from in your organization. When you create a new docs site, you can create a new space, or link an existing one.

By default, your site will be published publicly. You can change your site’s visibility in your .

To delete a docs site, you’ll need to open your site’s dashboard, then open from the top-right corner.

Docs sites inherit the editing permissions from the linked to them.

GitBook can work with or any CI/CD pipeline you already have for managing your OpenAPI specification. By using the GitBook CLI, you can automate updates to your API reference.

Head to your , and choose Authenticated access from your site’s audience settings. Once selected, you’ll see a few options you’ll need to continue configuring your site. You’ll also see a generated "Private key", which you’ll need at a later point in the authenticated access setup.

manage space at scale by allowing you to override the organization-level defaults.

You can move a collection by opening the Actions menu , selecting Move collection to… and choosing a destination. Alternatively, you can drag and drop collections in the sidebar to move or reorder them. You can move collections into other collections — or even to other organizations, if you have an in both.

To move one collection into another, click Move collection to… from the collection’s Action menu and then choose its new location. Alternatively, you can drag and drop the collection to its new location.

You can delete a collection by opening its Actions menu and selecting Delete.

You can create a drawing or sketch directly though GitBook using the integrated editor, then add it right into your GitBook page.

If you’re publishing your documentation on , and add multiple spaces as , your users will be able to use the Ask or search bar to find information across all your site sections.

Head to to start setting up protected access for your site.

To enable or disable PDF export for visitors to your , open the docs site’s dashboard and click the Settings tab, then select the Features section. You can toggle it on and off here.

Open the page you want to export, then open the page’s

Open the

in the and choose Export as PDF in the drop-down menu. Note: This action is not available within a change request.

With live edits enabled, members in your org can edit a space without creating . When editing content, you can see the avatars of anyone currently viewing the space in the top-right corner.

Live edits are locked by default in any newly created space. To edit the content, you will either need to , or toggle live edits on.

You can toggle live edit mode in a space by selecting Lock live edits or Unlock live edits from the Actions menu .

a space has enabled.

Only can lock or unlock live edits.

To create a new segment, head to the condition editor, and click the settings icon next to an existing segment in the segment dropdown.

Blocks
Inline content
KaTeX
GitBook GitHub app
GITBOOK-14: Improve documentation about users management
GITBOOK-{change_request_number}: {change_request_subject}
- Item
   - Nested item
      - Another nested item
   - Yet another nested item
- Another item
- Yet another item
gitbook openapi publish --spec api-spec-name --organization organization_id <path-or-url>
# Set your GitBook API token as an environment variable
export GITBOOK_TOKEN=<api-token>

gitbook openapi publish \
  --spec spec_name \
  --organization organization_id \
  example.openapi.yaml
# Set your GitBook API token as an environment variable
export GITBOOK_TOKEN=<api-token>

gitbook openapi publish \
  --spec spec_name \
  --organization organization_id \
  https://api.example.com/openapi.yaml
openapi.yaml
paths:
  /pet:
    put:
      operationId: updatePet
      x-stability: experimental
openapi.yaml
paths:
  /pet:
    put:
      operationId: updatePet
      deprecated: true
openapi.yaml
paths:
  /pet:
    put:
      operationId: updatePet
      deprecated: true
      x-deprecated-sunset: 2030-12-05
openapi.yaml
paths:
  /pet:
    put:
      operationId: updatePet
      x-internal: true
{
    "rewrites": [
        {
            "source": "/docs",
            "destination": "<INSERT YOUR PROXY URL FROM GITBOOK>"
        },
        {
            "source": "/docs/:match*",
            "destination": "<INSERT YOUR PROXY URL FROM GITBOOK>/:match*"
        }
    ]
}
openapi.yaml
openapi: '3.0'
info: ...
components:
  schemas:
    project_status:
      type: string
      enum:
        - LIVE
        - PENDING
        - REJECTED
      x-enumDescriptions:
        LIVE: The project is live.
        PENDING: The project is pending approval.
        REJECTED: The project was rejected.
{
  "isBetaUser": true
}
openapi.yaml
paths:
  /users:
    get:
      summary: Retrieve users
      x-codeSamples:
        - lang: JavaScript
          label: Node SDK
          source: |
            import { createAPIClient } from 'my-api-sdk';

            const client = createAPIClient({ apiKey: 'my-api-key' });
            client.users.list().then(users => {
              console.log(users);
            });
        - lang: Java
          label: Java SDK
          source: |
            MyApiClient client = new MyApiClient("my-api-key");
            List<User> users = client.getUsers();
            System.out.println(users);
Sign up
Integrating with CI/CD

Expandable

Add an expandable block to a page to keep your pages shorter, hide longer content, or create FAQs

Expandable blocks are helpful in condensing what could otherwise be a lengthy paragraph. They are also great in step-by-step guides and FAQs.

Example

Step 1: Start using expandable blocks

To add an expandable block hit / on an empty block, or click the + on the left of the editor, and select Expandable.

Step 2: Add content to your block

Once you’ve inserted an expandable block, you can add content to it — including lists and code blocks.

Representation in Markdown

# Expandable blocks

<details>

<summary>Expandable block</summary>



</details>

Limitations

There are some limitations on which blocks you can create inside of an expandable block. You can check the full list by starting a new line in an expandable block and pressing / to bring up the insert palette.

Join our community
send our support team a message
GitHub
here
GitBook CLI
Excalidraw
published docs site

Enabling GitHub Sync

Set up and authorize the GitHub integration for GitBook

Getting started

Authenticate with GitHub

If you’re setting up GitHub Sync for the first time and haven’t already linked a GitHub account, you’ll be prompted to do that when you begin configuring Git Sync. If you’ve already linked your account, you may still need to authenticate via GitHub.

If you see a 'Potential duplicated accounts' error message at this step, this means your GitHub account is already linked with another GitBook user account.

To help you identify which accounts are linked, you will have to log out from this session and log in using the sign-in with GitHub method.

If you already know your GitBook account associated with GitHub you can log into that user account and unlink your GitHub account (done in settings) before logging back in and linking your current account.

Install the GitBook app to your GitHub account

Follow the instructions in the GitHub popover and either give GitBook specific repository permissions, or allow access to all repositories, depending on your needs.

Select a repository and branch

Select the account and repository you want to keep in sync with your GitBook content.

Once you’ve selected the correct repository, choose which branch you want commits to be pushed to and synced from.

Perform an initial sync

When syncing for the first time, you’ll have the option to sync in one of two directions:

  1. GitBook -> GitHub will sync your space’s content to the selected branch. This is great if you’re starting from an empty repository and want to get your GitBook content in quickly.

  2. GitHub -> GitBook will sync your space’s content from the selected branch. This is great if you have existing Markdown content in a repository and want to bring it into GitBook.

Write and commit

When you edit on GitBook, every change request merge will result in a commit to your selected GitHub branch.

When you commit to GitHub, every commit will be synced to your GitBook space as a history commit.

The GitHub app that powers our GitHub integration is currently not available to customers on GitHub Enterprise Server instances.

Blocks

Add and edit blocks within your content.

GitBook is a block-based editor, meaning you can add different kinds of blocks to your content — from standard text and images to interactive blocks. Your pages can include any combination of blocks you want, and there’s no limit to the number of blocks you can have on a page.

Inserting a new content block

You can insert a new content block below an existing block using your mouse:

  1. Hover over the block above the place you need the new content block.

  2. Click on the + icon that appears on the left to open the insert palette.

  3. Select the block you want from the drop-down menu to insert it.

Alternatively, on a new line, you can press / to launch the insert palette, which lists all the available blocks. You can scroll through the list to find the one you want, or use your keyboard to search for the block you want, navigate up and down the list, and insert it with Enter.

Exiting a block

When you are done, you can continue adding new content to the page either by inserting a new block using the + button to the left of your content, or by hitting ⌘ + Enter on a Mac or Ctrl + Enter on a PC.

Selecting blocks and interacting with selected blocks

You can select a single block by pressing the Esc key with the cursor in the block. You can also select multiple blocks by highlighting content within them and hitting Esc.

Once selected, you can:

  • Select more blocks by clicking on them while keeping the Shift ⇧ key pressed.

  • Moving up and down to select the block above or below, using the ↑ and ↓ keys

  • Copy the entire block using ⌘ + C (Mac) or Ctrl + C (Windows)

  • Cut the entire block using ⌘ + X (Mac) or Ctrl + X (Windows)

  • Delete the selected block or blocks using ⌫ or Del.

Full-width blocks

By making your blocks full width, you can create a clear visual hierarchy in your content, or simply give more space to content that needs it.

  • Code Blocks

  • Image blocks

  • Tables

  • Cards

  • API Blocks

  • Integration blocks

  • Columns

Hints

Add a hint to a page to draw your reader’s attention to specific pieces of important information

Hints are a great way to bring the reader’s attention to specific elements in your documentation, such as tips, warnings, and other important information.

Examples of hint blocks

Info hints are great for showing general information, or providing tips and tricks.

Success hints are good for showing positive actions or achievements.

Warning hints are good for showing important information or non-critical warnings.

Danger hints are good for highlighting destructive actions or raising attention to critical information.

This is a H2 heading

This is a line

  • This is a second line using an unordered list and color

To add a heading to your hint, you need to create a heading block as the the first block in the hint.

Representation in Markdown

{% hint style="info" %}
**Info hints** are great for showing general information, or providing tips and tricks.
{% endhint %}

{% hint style="success" %}
**Success hints** are good for showing positive actions or achievements.
{% endhint %}

{% hint style="warning" %}
**Warning hints** are good for showing important information or non-critical warnings.
{% endhint %}

{% hint style="danger" %}
**Danger hints** are good for highlighting destructive actions or raising attention to critical information.
{% endhint %}

{% hint style="info" %}

## This is a H2 heading

This is a line

This is an inline <img src="../../.gitbook/assets/command_icon_light.svg" alt="The Apple computer command icon" data-size="line"> image

- This is a second <mark style="color:orange;background-color:purple;">line using an unordered list and color</mark>
{% endhint %}

Files

Manage and add files to your space such as PDFs, videos, documents and more

You can upload files to your GitBook space and add them to your page for people to view or download.

You can show some files, such as images and OpenAPI files, on the page itself for people to see without clicking anything. For others, such as PDFs, users will have to click to view or download it.

You can also optionally add a caption below any file you insert into your page to add more information if needed.

Example of a file

Uploading a file

You can manage uploaded files in the Files side panel of your space. You can find the Files panel at the top of your space’s table of contents.

To upload a file, drag and drop it into the Drop your file or browse section, or select it and use your system file dialog to select the file you want to upload.

GitBook allows you to upload files up to 100MB per file.

Tip: You can also drag and drop images from your file system directly into the editor — or paste a copied image into your content. GitBook will automatically add them to the Files side panel for the respective space, so you can view and manage them later.

Renaming a file

Deleting a file

Note: Make sure you update any pages that included your deleted file! File blocks that reference a deleted file will show an empty block, or Could not load image error.

Replacing a file

If you have a file that simply needs updating to a new version, you can replace it. This will swap out the old file and put the new file in its place. Any blocks that previously referred to the old file will then refer to the new file.

This can be helpful if, for example, you’ve had a major product redesign and need to update outdated UI screenshots that appear on multiple pages. Replacing the original file would update the screenshot everywhere in your space, saving you time and effort.

Tip: Once you’ve uploaded an image or a file, you can reference it anywhere in your space by creating an image or a file block and selecting it from the Files side panel.

We recommend you do this rather than uploading the image again every time you want to include it, to make it easier to replace images later and to avoid having multiple files with the same name.

Writing with GitBook AI

Use GitBook AI to generate and build content for your page

You can use GitBook AI to create content on any empty line on your page. It can create all kinds of content — formatted in Markdown — including code samples, templates, page summaries and more.

Write with GitBook AI

Press Space on any empty line, or type / and choose Write with AI to enter GitBook AI’s writing mode.

You can instantly start typing any prompt you want. GitBook AI will analyze the prompt and generate content based on it. For example:

Write me a two-paragraph overview of why documentation is important for product teams.

Alternatively, you can also choose from one of the suggested prompts or prompt starters:

Continue writing

If you click this option, GitBook AI will analyze the content on your current page and then generate more content based on that.

Explain…

Click this and then tell GitBook AI what you want it to explain. This isn’t limited by content on your page, so you can ask it to explain anything at all.

Summarize

As you can imagine, this option will summarize all the content on your page — great for writing a TL;DR at the bottom of a detailed document, or adding a quick summary at the top for people just checking in.

Explain this

This will break down the complex information on your page and explain it in simpler language — including explaining acronyms and other jargon. This is perfect if the page you’re reading involves a lot of complex information, or you want to add an explainer for less technical folks.

Translate

This mode will translate your current page into one of a set number of languages. If you want to translate into a language that’s not on the list, simply type it into the prompt box.

FAQs

How does GitBook AI use my data?
How much does GitBook AI cost?

Configuring a subdirectory with Cloudflare

Host your documentation with a /docs subdirectory using Cloudflare

1

Configuring your GitBook site

In your GitBook organization, click on your docs site name in the sidebar, then click Manage site or open the Settings tab. Open the Domain and redirects section and under ‘Subdirectory’, click Set up a subdirectory.

Enter the URL where you would like to host your docs. Then specify the subdirectory for docs access, e.g. tomatopy.pizza/docs, and click Configure.

Under Additional configuration, you will now see a proxy URL. You'll use this in the next step when configuring your Cloudflare worker. Copy it to your clipboard.

2

Create your Cloudflare worker

Sign into your Cloudflare account and navigate to Workers & Pages

Click the Create button.

On the ‘Create an application’ screen, click the Hello world button in the ‘Start from a template’ card.

Give the worker a more descriptive name, like mydocs-subpath-proxy. Once you finish renaming the worker, click Deploy.

3

Configure your custom domain

Your worker will get a default URL that you can use. To configure your custom domain instead (such as tomatopy.pizza), click Settings. Then, in the ‘Domains & Routes’ section, click + Add.

In the ‘Domains & Routes’ tray that opens, click Custom domain, then enter your custom domain in the textbox that follows. When you specify the custom domain, do not include the subdirectory. For example, tomatopy.pizza is correct, while tomatopy.pizza/docs is not.

4

Update the worker code

When the worker is finished deploying, click Edit code, or click Continue to project, and then the Edit code button in the upper right.

In the code editor that opens, replace the sample code with the following snippet:

export default {
  fetch(request) { 
    const SUBDIRECTORY = '/docs';
    const url = new URL(request.url);
    const target = "<INSERT YOUR PROXY URL FROM GITBOOK>" + url.pathname.slice(SUBDIRECTORY.length);
    const proxy = new URL(
      target.endsWith('/') ? target.slice(0, -1) : target 
    )
    proxy.search = url.search;
    return fetch(new Request(proxy, request));
  }
};

Be sure to update the URL on line 5 with the proxy URL you got from GitBook in the first step.

Once that’s done, click Deploy. This process may take a few moments. Once it’s complete, when visiting the URL, you should see your docs site!

Site settings

Customize and edit settings across your published site

General

Site title

Change the name of your site, if you don't have a custom logo this is the name that your site visitors will see.

Social preview

Here, you can upload a custom social preview image for your site. This will set the site’s og:image to your uploaded image, and it’ll show when the site’s link is shared to any platform or product that supports OpenGraph images, such as Slack or X.

If you don’t add a social preview, GitBook will automatically generate one using your theme color, page title and description.

Unpublish site

Unpublish your site, but keep its settings and customizations. You can publish your site again at any time.

Delete site

Unpublish and remove your site from the Docs site section in the GitBook app.

Audience

Audience

Choose who sees your published content. See Publish a docs site for more info.

Adaptive content Ultimate

Your visitor token signing key will also be displayed here.

Domain and URL

Custom domain

Configure a custom domain to unify your site with your own branding. See Set a custom domain for more info.

GitBook Subdirectory

Publish your content on a subdirectory (e.g. yourcompany.com/docs). See GitBook Subdirectory for more info

Redirects

Features

PDF export Premium & Ultimate

Let your visitors to export your GitBook as PDF. See PDF export for more info.

Page ratings Premium & Ultimate

Choose whether or not visitors to your published content can leave a rating on each page to let you know how they feel about it. They’ll be able to choose a sad, neutral, or happy face.

AI & MCP

Choose the AI experience Premium & Ultimate

Let your site visitors ask GitBook anything with AI search or the GitBook assistant. See Search & GitBook Assistant for more info.

Extend it with MCP connectors Ultimate

Structure

Plan

OpenAPI

Add an OpenAPI spec to a page and let your users test endpoints right on the page with interactive blocks.

Manually writing REST API documentation can be a time-consuming process. Fortunately, GitBook streamlines this task by allowing you to import OpenAPI documents, which detail your API’s structure and functionality.

The OpenAPI Specification (OAS) is a framework that developers use to document REST APIs. Written in JSON or YAML, it outlines all your endpoints, parameters, schemas, and authentication schemes.

Once imported into GitBook, these documents are transformed into interactive and testable API blocks that visually represent your API methods—whether the specification is provided as a file or loaded from a URL.

Test it (powered by Scalar)

GitBook's OpenAPI block also supports a "test it" functionality, which allows your users to test your API methods with data and parameters filled in from the editor.

Ordered lists

Add an ordered or numbered list to a page

Ordered lists, also called numbered lists, help you prioritize items or create a list of steps.

Example of ordered list

  1. Item 1

    1. Nested item 1.1

      1. Nested item 1.1.1

    2. Nested item 1.2

  2. Item 2

  3. Item 3

To create nested items, you can use Tab to indent and ⇧ + Tab to outdent.

Representation in Markdown

1. Item 1
   1. Nested item 1.1
      1. Nested item 1.1.1
   2. Nested item 1.2
2. Item 2
3. Item 3

Adding an inline image to an ordered list

Adding images inside of ordered lists is possible in GitBook

If you want to add an image within an ordered list, add it using the insert menu, then on the row below the image type 3. then hit Space, and the ordered list will continue.

  1. Item 1

  2. Item 2

  1. Item 3

  2. Item 4

Site redirects

Set up site redirects to route traffic to content anywhere on your site.

Redirects are commonly used when you are migrating your documentation from one provider to another — like when you just moved docs to GitBook. Broken links can impact SEO so we recommend setting up redirects where needed.

Managing redirects on your site

To get started, view your site’s dashboard in GitBook and open the Settings tab, then click Domain & redirects.

Creating redirects

If you want to add another redirect to the same page, you can toggle the Add another redirect option on before you hit Add. When you add your redirect, the modal will remain open with the destination content set to the previous selection so you can add another URL slug immediately.

Editing redirects

To delete a redirect, press the Delete redirect button and confirm.

About automatic redirects

Every time a URL is loaded, GitBook resolves it through the following steps:

  1. Site content is resolved to its canonical URL by following any of the automatically created redirects.

Private publishing with share links

Add greater control over who can view your published GitBook documentation.

You can share you content privately with customers or partners without needing to invite them to your organization by using share links.

Publish with share links

Next, click on Create link to create a share link. You can review and name your share links, customize your domain and copy the link.

Once the link is active, a private token is generated within your URL, which is unique to your space. Sharing this link will give non-GitBook users access to your content in read mode only, with an interface that looks like any other published content.

You can generate as many links as you need from Audience settings.

Access and permissions

The content will be accessible to anyone following the link. Your team members can access your content from the Docs sites section of the sidebar, or by navigating to the space directly.

Revoke a link

You can disable or regenerate your shareable by revoking it. You can see and revoke any previously generated link by opening the visibility menu and clicking through to link and domain settings.

Once you revoke a link, anyone with that outdated link to your content will no longer have access.

Extra configuration

Configure extra options for your published documentation.

Localize user interface

You can select from a list of languages to localize the user interface of your published content. This applies translations to the non-custom areas of the interface.

This setting will not auto-translate your actual content, but it can help match the interface to the language you’re writing in.

Edit on GitHub/GitLab

If your space is connected to a Git repository, you can optionally show a link for your users to contribute to your documentation from your linked repository.

External Links

This setting controls the behaviour when your site users click an external link. By default, they will open in the same tab, but you can switch this to open in a new tab if that's your preference.

Page actions

Page actions adds a page-level dropdown to every page of your docs, allowing users to perform quick actions on a page's content — ideal for using your docs content as context within an AI prompt.

You can disable this option from the Configure tab if you do not wish to show page options in your published docs.

Open in AI providers

Displays an action to open ChatGPT or Claude with the page content.

Copy/View as Markdown

Displays an action to copy or view the page as Markdown.

Privacy Policy

Insert API reference in your docs

Insert complete API reference from your OpenAPI spec or pick individual operation or schemas.

GitBook allows you to automatically generate pages related to the endpoints you have in your OpenAPI spec. These pages will contain OpenAPI operation blocks, allowing you and your visitors to test your endpoints and explore them further based on the information found in the spec.

Automatically create OpenAPI pages from your spec

1

Generate pages from OpenAPI

From here, click OpenAPI Reference.

2

Choose your OpenAPI spec

Choose your previously uploaded OpenAPI spec, and click Insert to automatically add your endpoints to your space. You can optionally choose to add a models page referencing all your OpenAPI schemas.

3

Manage your API operations

GitBook will automatically generate pages based on your OpenAPI spec and the tags set inside it’s definition.

Head to Structuring your API reference to learn more about organizing your operations through your OpenAPI spec.

Add an individual OpenAPI block

Alternatively, you can add OpenAPI operations or schemas from your spec individually to pages throughout your docs.

1

Add a new OpenAPI block

Open the block selector by pressing /, and search for OpenAPI.

2

Choose your OpenAPI spec

Choose your previously uploaded OpenAPI spec, and click Continue to choose your the endpoints you’d like to use.

3

Choose the operations or schemas you’d like to insert

Pick the operations and the schemas you want to insert in your docs and click Insert.

Site sections

Add multiple products to your site as site sections and create a content hub with tabs to access all your content

With site sections, you can centralize all your documentation and create a seamless experience for your users.

Site sections are perfect for organizing your documentation — whether you’re managing separate products, or catering to both end-users and developers with content tailored to each.

Sections or variants?

Each site section is a space in GitBook. You can create site sections from any space you like, but we recommend you use sections as semantically different parts of your docs.

Adding a section to your docs site

From your docs site’s dashboard, open the Settings tab in the site header, then click Structure. Here you can see all the content of your site.

To add a site section, click the New section button underneath the table and choose a space to link as a section. The new section is then added to the table and will be available to visitors as a tab at the top of your site.

Create a site section group

You can group site sections together under a single heading. Site section groups will appear as a drop-down in your site’s nav. Site sections in a group can also include an optional description, which appears below the section title in the drop-down menu.

To create a group, click the arrow next to the New section button and choose New section group. Give your new group a name, then click Add section in the modal to add sections to your group. You can add existing sections of your site to the new group, or select another space you want to add using the menu.

Editing a section

Site sections within a group can also optionally display a description, which will appear in the drop-down menu of your site’s nav bar when the section group is hovered. See the image at the top of this page to see an example of how this can look in your published documentation.

Reordering sections

You can also use the keyboard to select and move content: select a section with the space bar, then use the arrow keys to move it up or down. Hit the space bar again to confirm the new position.

Setting a default section

If you have multiple sections in your site, one section will be marked as the default. This section is shown when visitors arrive on your site, and is served from your site’s root URL. Other sections each have a slug that is appended to the root URL.

Remove a section

To remove a section from a site, open the Settings tab from your docs site dashboard, then click Structure to find the content you want to remove.

Removing a section from your site will remove it — and all variants within it — from the published site, but will not delete any of the spaces or the content within them.

URL

Pass visitor data into your docs through URL query parameters.

You can pass visitor data to your docs through URL query parameters. Below is an overview of the method:

Query parameters

To pass data to GitBook through URL parameters, you’ll need to pass the data in the URL in the format visitor.<prop>.

For example:

https://docs.acme.org/?visitor.language=fr&visitor.country=fr

Visiting this URL would pass in the following claims when the site loads:

{
  "language": "fr",
  "country": "fr"
}

Setting up OIDC

Set up an OIDC login screen for visitors to your docs.

To setup your GitBook site with authenticated access using OIDC, the process looks as follows:

1

Create a new application with your identity provider

Create an application from your identity provider’s dashboard.

2

Install and configure the OIDC integration

Install the Auth0 integration and add the required configuration.

OIDC stands for OpenID Connect, and it's an identity layer built on top of OAuth. Many identity providers abide by OIDC, and GitBook's OIDC integration for authenticated access allows you to publish your space behind authenticated access, and access to the content is controlled by your Identity Provider

Since this guide is a generic guide meant for all identity providers, some details may vary depending on your Identity Provider. For illustration purposes, we are using Google as the identity provider in this guide.

Create a new application with your identity provider

There are some things that you need to set up on your Identity Provider in order to get the integration to work.

You need to create a new app inside your Identity Provider. Its type should be "Web Application." In Google, you create these under "API and Services", "Credentials", and then under "OAuth 2.0 Client IDs."\

Click on Create Credentials, select OAuth Client ID, select Web Application as the type, name it appropriately, and under Authorized Redirect URIs, enter the Callback URL you got from GitBook.

Click Create. Make a note of the Client ID and Client Secret. We will need these to finish configuring of our integration in GitBook.

Install and configure the OIDC integration

Navigate to integrations within the GitBook app, select authenticated access as the category, and install the OIDC integration. Install the OIDC integration on your chosen docs site.

Once you've installed it on your site, go to configuration and make a note of the Callback URL right above the Save button. We may need it to set up the Identity Provider.

Open up the OIDC integration's configuration screen for the space you installed the integration on.

It should look like the following image

For Client ID and Client Secret, paste in the values you got for your identity provider.

Now, you will need to find the Authorization Endpoint and Access Token Endpoint for your Identity Provider. For Google, these are https://accounts.google.com/o/oauth2/v2/auth and https://oauth2.googleapis.com/token respectively.

If you are not using Google, these endpoints will be different for you. Please look into the documentation of your identity provider to locate these endpoints

For OAuth Scope, its value will be again be different depending on your Identity Provider. In case of Google, you can enter openid.

Please look at the list of allowed scopes in your Identity Provider's documentation, and enter the value of the least permissive scope. We only use the Access Token to verify that the user is authenticated, and we do not use the Access Token to fetch any further information. So, entering the least permissive scope is the best security recommendation.

Hit Save.

Now, in GitBook, close the integrations modal and click on the Manage site button. Navigate to Audience, select Authenticated access, and choose OIDC as the backend. Then, click Update audience. Go to the site’s screen and click Publish. The site is now published behind authenticated access controlled by your Auth0 application. To try it out, click on Visit. You will be asked to sign in with OIDC, which confirms that your site is published behind authenticated access using Auth0.

Authenticated access

GitBook offers out-of-the box solutions to protect your docs. Integrations for Auth0, Okta, Azure AD, and AWS Cognito allow you install an integration to enforce a log-in screen before being able to access your published site.

Depending on which authenticated access method you’re using, you’ll still need to configure a few more things depending on which integration you’re using in order to send the right data to GitBook.

Head to the relevant guide for full instructions on setting up adaptive content with authenticated access.

Inviting your team

Collaborate with your teammates on spaces, collections and more

Sharing a space or collection

To share a space or collection, click the share button in the top-right corner. This will open the share modal.

Inside the share modal, you’ll see different sharing options along the top.

You can see everyone who access, and their level of access, in the share modal. You can also make changes to these settings here.

Invite members

Invite a person or team from your organization

Some people in your team may not have access to a specific space in your GitBook organization due to their role or specific permissions settings. To invite someone who’s already a member of your organization, simply type their name, choose their role for this space, and hit Invite.

Invite someone from outside your organization

To invite someone from outside your organization, simply add their email address, choose their role, and hit Invite. When you choose their role, you can also choose to leave the Invite as an organization member toggle switched on to make them a full member of your organization, with access to all your team’s content when they’re logged in.

Inviting someone either as a full member or a guest will make them a member of the organization that owns the space, which will increase your overall subscription charge.

Invite guests via link

If you don’t want to use email to invite someone to your content, or want to invite a number of people as guests quickly, you can create a secret link. You can also set the role of guests that join using the link, so you have control over who can do what to your content.

Adaptive content

Deliver a tailored documentation experience based on who's reading.

When a user visits your site, you may already know things about them - who they are, which plan they're subscribed to, which features they have access to.

Adaptive content helps to build a tailored documentation experience based on who is reading.

Launch the demo site

While authenticated access allows you to protect your docs through a login, adaptive content customizes published material based on various authentication methods — including authenticated access or those from your own app.

How it works

Adaptive content works in 1 of 2 ways:

  1. Passing data from your app to GitBook

  2. Passing data from authenticated access

When a user visits your sites, we call the data they bring with them their "claims"—basically data that helps to identify a user. These claims are controllable by you - the site author - and can be used through the GitBook editor to show or hide different pages, variants, and sections in your docs.

Markdown

Write Markdown directly in the editor to easily create content using common syntax

GitBook’s editor allows you to create formatted content using Markdown.

Markdown is a popular markup syntax that’s widely known for its simplicity. GitBook supports it as a keyboard-friendly way to write rich and structured text.

Text formatting

GitBook supports all the classic inline Markdown formatting:

Titles

  • Heading 1: # A first-level title

  • Heading 2: ## A second-level title

  • Heading 3: ### A third-level title

Code blocks

```⏎ creates a new code block.

```py⏎ creates a new code block with Python syntax highlighting.

Lists

GitBook automatically detects and creates ordered and unordered lists as you type.

  • Begin a line with - or * to start an unordered bullet list.

  • Begin a line with 1. to start a numbered list.

  • Begin a line with - [ ] to start a task list.

When writing any kind of list, hit Tab to add a indent, and Shift+Tab to outdent.

Quotes

Begin a line with > to create a block quote. If you select an entire paragraph from start to end, typing > will wrap the content in a block quote.

This is a block quote.

Dividers

Type --- then hit Enter to create a divider on your page.


This is an example of a divider.

Variables and expressions

Create reusable variables that can be referenced in pages and spaces

If you repeat the same name, phrase or version number multiple times within your content, you can create a variable to help keep all those instances in sync and accurate — which is useful if you ever need to update them, or they’re complex and often mistyped.

You can create variables that are scoped to a single page, or a single space.

Create a new variable

You can use the toggle at the top to view and create variables scoped either to the current page you’re on, or all pages within the current space.

Clicking Create a variable will launch a modal where you can give your variable a name and a value.

Click Add variable to save your variable.

Variable names must start with a letter, and can contain letters, numbers and underscores.

Use variables in your content

Variables defined under your page are accessible under the page.vars object. Similarly, variables defined across your entire space are accessible under the space.vars object.

Update a variable

You can update a variable at any point when within a change request. Updating its value will update the value across any expression blocks referencing it. The changed variable will go live to any published site once the change request is merged.

Content variants

Publish documentation for multiple product versions or languages in a single site

You can publish multiple versions of the same documentation as part of a single docs site. These variants will be available to the end users via the space switcher in the top-left corner of the published site.

Add multiple languages or versions

A site with multiple variants is useful if you need to group together the content of your spaces — such as if you’re documenting multiple versions of an API (v1, v2, v3, etc.), or documenting your content in different languages.

Adding a variant to your docs site

From your docs site’s dashboard, open the Settings tab in the site header, then click Structure. Here you can see all the content of your site.

To add a variant, click the Add variant button in the section you'd like to add to, then choose a space to link. The new variant is then added to the list of variants within the chosen section and will be available to visitors in the variant dropdown on your site.

Changing a variant

Reordering variants

You can also use the keyboard to select and move content: select a section or variant with the space bar, then use the arrow keys to move it up or down. Hit the space bar again to confirm the new position.

Setting a default variant

If you have multiple variants within a section, one variant will be marked as the default. This variant is shown when visitors arrive on your site (or when they visit a section). Other variants each have a slug that is appended to the site's URL.

Setting a variant as default removes its slug field, as it will be served from the section root instead. GitBook will redirect the variant's slug to the appropriate path, to ensure visitors keep seeing your content.

Remove a variant from a site

To remove a variant from a site, open the Settings tab from your docs site dashboard, then click Structure to find the content you want to remove.

Removing a variant from your site will remove it from the published site, but will not delete the space or the content within it.

Headings

Add heading blocks to a page to organize your content and improve SEO

Headings help give your documents structure — and using keywords in headings will also help search engines understand that structure, which can help your page rank higher in search results.

Anchor links

When you add a heading to a page, it creates an anchor link. You can then link directly to these specific sections, to point people to relevant information.

Link to an anchor

You can see anchor links in public content, or private content in read-only mode, by hovering over the title and clicking the # that appears next to it. This will update the URL in your browser’s top bar, so you can copy it to use elsewhere.

Edit an anchor

By default, the anchor link will be identical to the text in your header. If you plan to link to that URL outside of GitBook, changing the header in future will break the anchor link. The link will then take visitors to the top of the page, rather than the anchor location.

Representation in Markdown

GitBook generates SEO optimized pages, meaning page titles in GitBook are automatically represented in markdown as a first level heading:

Heading examples

My heading 1

My heading 2

My heading 3

Site customization

Create branded documentation with a custom logo, fonts, colors, links and more

You can customize the appearance of your published documentation, match the user interface to the language of your content, and more.

You can apply customizations to your entire docs site as a site-wide theme, or to individual variants and site sections.

Customizing sites with multiple sections

If you have a docs site with with multiple sections, you can control the customization of each one individually.

Select the whole site or a specific site section using the drop-down menu at the top of the Customization panel.

  • Site-wide settings – These automatically apply to all linked spaces.

  • Section specific settings – If you’re using site sections, you’re can set section specific customization that will override the default site-wise setting.

Changes you make to specific site sections will override the site-wide customization settings, even if you change the site-wide setting again later.

What counts as ‘Advanced customization’?

Every GitBook user can take advantage of basic customization options on their docs site. Premium or Ultimate site plan users can also use advanced customization features to further tweak their docs to match their brand.

Advanced customization options include:

  • Custom logo – Add a logo that replaces the emoji and title at the top of your docs site.

  • Icons - Change the weight and style of page icons in your docs site.

  • Custom font – Change the font of your docs to one of the built-in options.

  • Footer – Add a custom logo, copyright text and navigation to a footer at the bottom of your documentation.

  • Bold and Gradient themes – Change the background color for your header, or add a gradient background to your entire site with these new themes.

What cannot be customized?

  1. It’s not possible to remove the small “Powered by GitBook” link that appears in published documentation.

Public publishing

Publish your docs publicly to the web so that everyone can access them.

Publish as public

To publish your docs publicly on the web head to the docs site you want to publish, click Publish button, and choose the Public option.

Publish without search engine indexing

By default, your site will be indexed by search engines. You can alternatively choose to disable this — meaning the docs are still available to everyone on the web, but they won’t be indexed by search engines such as Google.

They will still be accessible to anyone with a the link to your documentation. Docs sites that aren’t indexed can be particularly helpful if you want to publish a beta version of your docs, or do large-scale user testing without impacting your SEO with potentially duplicate content.

Page-level search indexing controls

You can also control search indexing at the individual page level. GitBook provides two types of search indexing controls:

Internal search indexing

Controls whether pages are indexed in GitBook's internal search engine and Ask AI feature. This affects:

  • Content search within your GitBook space

  • Ask AI's ability to reference the page content

External search indexing (Web crawlers)

Controls whether search engines and web crawlers (Google, ChatGPT, etc.) can index your pages. This affects:

  • SEO and discoverability through search engines

  • Web crawler access to your content

Hierarchical inheritance behavior

Search indexing settings follow a hierarchical inheritance pattern:

  • Parent page controls: When you disable search indexing on a parent page, it automatically disables indexing for ALL sub-pages beneath it.

  • Children cannot override: Sub-pages cannot re-enable search indexing if their parent page has it disabled.

  • Cascading effect: This creates a cascading effect down the entire page hierarchy - disabling indexing on a top-level page will disable it for the entire section.

This hierarchical behavior ensures consistent indexing policies across related content sections and prevents accidental exposure of content that should remain private within a section.

Monorepos

GitBook supports monorepos. A monorepo is a repository that contains more than one logical project (e.g. an iOS client and a web application).

GitBook can synchronize multiple directories from the same repository with multiple spaces. When enabling Git Sync on a space, you can configure a "Project directory". It will be used to lookup the .gitbook.yaml file for the directory to synchronize with this space.

Example of a repository structure:

In this example, 3 spaces can be created on GitBook and configured with different Root directories:

  • packages/styleguide

  • packages/app

  • packages/api

Updating the Project directory

In most cases, we recommend the following step to update the Project directory:

  1. Disable the existing Git Sync

  2. Move the files in the Git repository to the Project directory

  3. Reconfigure the Git Sync with the new Project directory

In some cases, you might have started with a typical repository synchronizing with only one space, but then decided to transition into a monorepo with multiple spaces synchronizing with it; or might have to rename the Project directory.

Changing the Project directory on an existing Git Sync can have an unexpected impact on the content, the change will only be propagated during the next synchronization (edit made on GitBook or new commit in the Git repository).

If the next operation is an import from the Git repository:

GitBook will expect to find the pages and files in the Project directory. If the files have not already been moved into the repository’s Project directory, the result of the synchronization would be an empty space with no content.

We recommend having the next operation to be a commit moving all GitBook-related files (markdown files, README/SUMMARY, and assets) in the repository to their correct new location, in the Project directory.

If the next operation is an export from GitBook to the Git repository:

GitBook will generate or update new files in the new Project directory. Files synchronized with GitBook will be moved to the new Project directory (with the best attempt); it might cause side effects if other parts of your system depend on these files.

Cards

Display information more dynamically with a set of cards — with or without images

You can use cards to create a visually pleasing page layout, combining text and images in a grid. They’re ideal for building landing pages or displaying any other content in a non-linear way.

Example of a card

Adding links

When creating cards, we recommend you use target links instead of hyperlinks. With a target link, your readers can click anywhere on the card to access the linked URL.

Adding images

This will open the Select file modal. Here you can drag and drop a new image into this, or use an image file you’ve previously uploaded to your space.

Choosing the right image size

GitBook will automatically crop landscape images to a 16:9 ratio on desktop and mobile. If the images you upload are portrait or have a 1:1 ratio, they will be cropped to 16:9 on desktop and display as square or portrait on mobile.

To keep things consistent across desktop and mobile, we recommend uploading all the images for your cards in a 16:9 format (e.g. 1920px x 1080px).

If you want your cards to adapt their layout depending on the screen size, we’d recommend uploading images with a 1:1 ratio, and the content of your image centered.

Changing the size of cards

Enabling GitLab Sync

Set up and authorize the GitLab integration for GitBook

Getting started

In the space you want to sync with your GitLab repo, head to the space menu in the top right, and select Synchronize with Git. From the provider list, select GitLab Sync, and click Configure.

Generate and enter your API access token

You can generate an API access token in your GitLab user settings.

There are two types of access tokens in GitLab: Project and Personal. Note that in order for the integration to work you’ll need to use a Personal token, which you can generate from your GitLab user preferences menu.

Ensure that you enable the following access for your token:

  • api

  • read_repository

  • write_repository

If the tokens you create also have a specific role attached to them, also make sure that it has a Maintainer or Admin role.

Then you can paste the token into the API access token field when configuring your GitLab integration.

Select a repository and branch

Select the repository you want to keep in sync with your GitBook content.

Can’t see your repository? Ensure you’ve set the correct permissions when creating your API token.

Once you’ve selected the correct repository, choose which branch you want commits to be pushed to and synced from.

For many GitLab repositories, the main branch might be automatically set to protected. If this is the case, we recommend adding a specific branch to sync your content between. You can then merge this into main and keep the protection in place.

Perform an initial sync

When syncing for the first time, you’ll have the option to sync in one of two directions:

  1. GitBook -> GitLab will sync your space’s content to the selected branch. This is great if you’re starting from an empty repository and want to get your GitBook content in quickly.

  2. GitLab -> GitBook will sync your space’s content from the selected branch. This is great if you have existing markdown content in a repository and want to bring it into GitBook.

Write and commit

When you edit on GitBook, every change request merge will result in a commit to your selected GitLab branch.

When you commit to GitLab, every commit will be synced to your GitBook space as a history commit.

Version control

Keep track of changes, roll back to a previous version and more

You can easily monitor all the changes people have made to your content using to the Version history side panel.

Version history

In the Version history of a space, you can see a list of all the actions that changed the content within it. These include:

View historical versions of content

Show changes

To enable or disable this, use the Show changes toggle at the bottom of the Version history side panel.

With show changes enabled, content that has changed will be highlighted by an icon on the left of its content block.

Viewing historical published versions

If you're investigating the version history of a published space, you can also view previews of what the previous versions looked like in the published context (i.e. what the end user would see).

You can do this by:

1

From the version history side panel, select the revision

2

Copy the ID at the end of the URL

3

Add it at the end of your published docs URL as /~/revisions/<id>

Roll back to a previous version

Rolling back allows you to revert a space’s content to the way it was at a previous point in time. This is helpful if you’ve accidentally made a breaking change or deleted content and need to quickly get back to a previous version of the space.

Structuring your API reference

Learn how to structure your API reference across multiple pages with icons and descriptions.

GitBook does more than just render your OpenAPI spec. It lets you customize your API reference for better clarity, navigation, and branding.

Split operations across multiple pages

To keep your documentation organized, GitBook can split your API operations into separate pages. Each page is generated from a tag in your OpenAPI spec. To group operations into a page, assign the same tag to each operation:

Reorder pages in your table of contents

The order of pages in GitBook matches the order of tags in your OpenAPI tags array:

Nest pages into groups

To build multi-level navigation, use x-parent (or parent) in tags to define hierarchy:

The above example will create a table of contents that looks like:

If a page has no description, GitBook will automatically show a card-based layout for its sub-pages.

Customize page titles, icons, and descriptions

Build rich descriptions with GitBook Blocks

Highlight schemas

You can highlight a schema in a GitBook description by using GitBook markdown. Here is an example that highlights the “Pet” schema from the “petstore” specification:

Setting up Okta

Set up an Okta login screen for visitors to your docs.

To setup your GitBook site with authenticated access using Okta, the process looks as follows:

1

Create a new Okta application

Create an Okta application from your Okta dashboard.

2

Install and configure the Okta integration

Install the Okta integration and add the required configuration.

3

Configure Okta for adaptive content (optional)

Configure Okta to work with adaptive content in GitBook.

Create a new Okta application

First, sign in to Okta platform (the admin version) and create a new app integration (or use an existing one) by clicking the Applications button in the left sidebar.

Click Create App Integration and select OIDC - OpenID Connect as the Sign-In method. And then select Web Application as the application type.

Name it appropriately and don't edit any other setting on that page. For assignments, choose the appropriate checkbox. Click Save.

On the next screen, copy Client ID and Client Secret. Copy the Okta Domain right below your email address by clicking the dropdown in the top right.

We will need these values to configure the Okta Integration.

Install and configure the Okta integration

Install the integration on your site.

Upon installation on site, you will see a screen asking you enter the Client ID, Okta Domain, and Client Secret.

For Client ID, Okta Domain (remove https://prefix, if any) and Client Secret, paste in the value you copied from Okta Dashboard.

Click Save.

Copy the URL displayed in the modal and enter it as a Sign-In redirect URI in Okta (as shown in the below screenshot). Hit Save.

Now, in GitBook, close the integrations modal and click on the Manage site button. Navigate to Audience, select Authenticated access, and choose Okta as the backend. Then, click Update audience. Go to the site’s screen and click Publish. The site is now published behind authenticated access controlled by your Auth0 application. To try it out, click on Visit. You will be asked to sign in with Okta, which confirms that your site is published behind authenticated access using Auth0.

Configure Okta for adaptive content

LLM-ready docs

Providing an LLM-friendly version of your docs site

We’re building features that make it easier for Large Language Models (LLMs) to ingest and work with your documentation content.

As LLMs become increasingly important for information retrieval and knowledge assistance, ensuring your documentation is LLM-friendly can significantly improve how these models understand and represent your products or services.

LLM-optimized documentation ensures that AI systems like ChatGPT, Claude, Cursor, and Copilot can retrieve and provide accurate, contextual responses about your product or API.

.md pages

With GitBook, all of the pages of your docs site are automatically available as markdown files. If you add the .md extension to any page, you will see the content of that page rendered in markdown which you can pass to an LLM for more efficient processing than an HTML file.

llms.txt

The llms.txt file serves as an index for your documentation site, providing a comprehensive list of all available markdown-formatted pages. With this file, you make it easier for LLMs to efficiently discover and process your documentation content.

llms-full.txt

Where the llms.txt file contains an index of all the page URLs and titles of of your documentation site, the llms-full.txt contains the full content of your documentation site in one file that can be passed to LLMs as context.

LLMs can use this index to navigate directly to the markdown versions of your pages, allowing them to incorporate your documentation into their context without needing to parse HTML.

Tips for optimizing your docs for LLMs

Now that your GitBook site automatically generates .md pages, llms.txt, and llms-full.txt files, these best practices will help LLMs effectively understand and work with your content.

By using these optimizations, you may also improve your documentation’s performance in AI-powered search engines and generative engine optimization (GEO).

The best part? These guidelines will generally make your docs easier for people to read as well.

Use clear, hierarchical structure

Break up your content with good headings (H1, H2, H3) and don’t just write giant walls of text. Bullet points, numbered lists and shorter paragraphs make everything easier to read.

Write concise, jargon-free content

Keep it simple and skip complex technical terms unless you really need them. LLMs do much better when you say what you mean without adding fluff.

Include practical examples

Show, don’t just tell. Code snippets, API examples, and real scenarios help LLMs — and your users — understand how things actually work in practice.

Keep content current and accurate

Nobody likes outdated docs. Regular updates mean LLMs won’t give people wrong information about your latest features and updates.

Test with AI tools

Actually try asking ChatGPT or Claude questions about your docs to see how well they understand your content. You might be surprised by what works and what doesn’t.

Setting up AWS Cognito

Set up an AWS Cognito login screen for visitors to your docs.

To setup your GitBook site with authenticated access using AWS Cognito, the process looks as follows:

1

Create a new AWS Cognito application

Create an AWS Cognito application from your AWS dashboard.

2

Install and configure the AWS Cognito integration

Install the AWS Cognito integration and add the required configuration.

3

Configure AWS Cognito for adaptive content (optional)

Configure AWS Cognito to work with adaptive content in GitBook.

Create a new AWS Cognito application

Go to your desired User Pool in Cognito, and click on App integration. Make a note of the Cognito domain, we will need it to configure the integration.

Scroll to the bottom and click "Create app client". For the app type, select "Confidential client." Scroll down to Hosted UI settings. In allowed Callback URLs, enter the Callback URL you got from GitBook upon installing the integration on a space.

Scroll further down to "OAuth 2.0 grant types"- make sure "Authorization code grant" is selected.

For "OpenID connect scopes", make sure OpenID is selected.

Scroll down and click "Create app client".

Click on the created app client and make a note of the Client ID and Client Secret.

Install and configure the AWS Cognito integration

Navigate to integrations within the GitBook app, select authenticated access as the category, and install the AWS Cognito integration.

Once you've installed it on your site, go to configuration and make a note of the Callback URL right above the Save button. We will need it to set up Cognito.

Open up the Cognito integration's configuration screen for the space you installed the integration on.

It should look like the following image:

For Client ID, Cognito Domain, and Client Secret, paste in the values you got from Cognito.

Hit Save.

Now, in GitBook, close the integrations modal and click on the Manage site button. Navigate to Audience, select Authenticated access, and choose Cognito as the backend. Then, click Update audience. Go to the site’s screen and click Publish. The site is now published behind authenticated access controlled by your Auth0 application. To try it out, click on Visit. You will be asked to sign in with Cognito, which confirms that your site is published behind authenticated access using Auth0.

Configure AWS Cognito for adaptive content

To leverage Adaptive Content with authenticated access in GitBook, you’ll need to configure your Amazon Cognito user pool to include custom claims in the ID token.

Here’s an example of what that could look like:

Once added, these key-value pairs are included in the authentication token and passed to GitBook, allowing your site to dynamically adapt its content based on the authenticated user’s profile.

Site insights

View analytics and insights related to your published documentation’s traffic

Insights give you information on the content you've published and how it performs. It's split up between different sections — Traffic, Pages & feedback, Search, Ask AI, Links, and OpenAPI.

You can see a top-level overview of your insights on the Overview tab of your site’s dashboard, with a globe that shows views in the last hour by location.

Click the Insights tab in the site header to find more detailed insights for your site.

Filters & groups

You can add filters or group your data to view it in specific ways. For example, you could look at search data within a specific site section, or filter your traffic data by country, device, browser and more.

By combining filters and groups, you can drill down in to precise analytics data to track the events that you are important to you.

Types of data

The Insights tab is split into six sections, each focused on a specific data type.

Traffic

GitBook tracks page views to help you understand the popularity and reach of your content. Each time a user visits a page on your docs site, it is counted as a page view.

Page views are critical for assessing the effectiveness of your content strategy and optimizing your documentation based on user interest. It’s split up between different views and profiles, including countries, languages, browsers, and more.

Throughout the insights tab you will see Events and Visitor metrics. Events indicate the total number of instances for any given category, while Visitors indicates the unique users performing the actions.

In the context of page views, Events would be total amount of page views, and Visitors would be the count of distinct users performing a page view.

Pages & Feedback

If you want to use or analyze this data further outside of GitBook, click Download CSV to download a .csv file to your device.

You can also see a list of comments left from visitors who rate your pages, to get actionable insights on how your docs can be improved.

Why can’t I see any feedback data for my site? We only display data for published sites with page ratings enabled. If your site is not published or does not have page ratings enabled, you won’t see any insights.

Broken URLs

Broken URLs shows any incoming links from external sources that are resulting in a ‘Page not found’ error. These may be mistyped URLs, outdated links with no redirects, or spam links.

Search

You can measure and improve your documentation by checking which keywords are used the most by users searching your documentation. This view allows you to see what keywords are performing the best, and which ones you could improve on.

The information here can be helpful for informing your content architecture, making certain parts of your documentation easier to find without search, or adding additional content to existing pages based on what your visitors are searching for.

Ask AI

By looking at these queries, you can refine your documentation structure, enhance discoverability, and provide more relevant information to your audience.

Links

GitBook tracks links to help you understand how users interact with external resources in your documentation. This feature provides insights into external links, their domains, and their placement within your docs, such as in the header, footer, or sidebar. Analyzing link usage can help you optimize navigation, improve content accessibility, and refine your documentation strategy based on user engagement.

OpenAPI

It tracks interactions such as endpoint views, parameter searches, and request explorations, helping you understand which parts of your API are most accessed and where users may need more clarity. These insights enable you to refine your documentation, improve developer experience, and ensure your API content is effectively meeting user needs.

In the space you want to sync with your GitHub repo, head to the in the top right, and select Configure. From the provider list, select GitHub Sync.

Read more on our .

If you haven’t already done so, you’ll see a prompt to add the to your GitHub account.

Can’t see your repository? If you can't find your repository in the list, make sure that you've installed the in the right scope (i.e. your personal account or the GitHub org where the repository lives). You should also check that you’ve configured the correct repository access in the GitBook GitHub app.

You’re good to go. You’ll notice that if your space was in mode, live edits are now locked. This allows us to reliably sync content to your repository when someone in your team merges a in GitBook.

Some content blocks capture the editing cursor to allow you to add content in the context of that block. For example, when you’re writing in , hitting Enter will add a new line within the hint block, rather than a new paragraph below.

To make a block full width, click on the Options menu next to your block and select Full width. This feature is available for the following block types:

There are four different hint styles — you can change the style by clicking the colored icon, or by opening the block’s Options menu and selecting the style you want.

Hint blocks support and , as well some specific block types. To see which block types you can use in a hint, hit / on an empty line and check the .

This is an inline image

You can also add files to your space when you add an or an . When you create one of these blocks, the Files panel will open, so you can either select a file, or upload a new file.

To rename a file, open the Actions menu for the file, and click Edit. In the dialog prompt, enter the new name of your file.

To delete a file, open the Actions menu for the file and click Delete. After confirming in the dialog that you’re sure you want to delete the file, your file will be deleted.

To replace a file, open the Actions menu for the file and click Replace. In the file replacement dialog that appears, select the new file and wait for the upload indicator to complete. Your file will automatically update everywhere it appeared in your space.

We always follow to keep your data private.

GitBook AI does not use your data to train AI models. We will only share the information you add to GitBook AI with OpenAI for the sole purpose of providing you with GitBook AI’s features. Take a look at for more information.

GitBook AI is available as part of GitBook’s Pro and Enterprise plans. If you have a Free or Plus plan, you’ll need to upgrade to use GitBook AI writing and editing. to find out more about upgrading to Pro.

If your site has multiple , you can use the drop-down menu in this modal to add a custom social preview image for each one, or for your entire site.

Note: Deleting a site is a permanent action and cannot be undone. Any settings and customizations will be lost, but your content will remain in its .

Turn on adaptive content for your site pages, variants, and sections. lets you hide or show content for different visitors, depending on their permissions.

You can review the results of these ratings by opening the section of your docs site dashboard and selecting the tab.

Configure MCP servers that the AI assistant can use when answering user questions inside your docs. See for more info.

GitBook supports or compliant files.

Powered by , you won't need to leave the docs in order to see your API methods in action. See and example of this above.

In addition to , you can create a redirect from any path in your site’s domain.

Click Add redirect to begin. Fill in the source path — i.e. the URL slug that you wish to redirect somewhere else — and the destination content you wish to link to. You can pick any , , or on to your site. Click Add to create the redirect.

To edit a redirect, press the Edit icon next to it in the list. Update the redirect and hit Save.

Whenever pages are moved or renamed, their canonical URL changes with them. In order to keep your content accessible, GitBook automatically creates a redirect from the old URL to the new one.

If the URL cannot be resolved, the URL is checked against , defined in your repository's .gitbook.yaml file.

Finally, the URL is checked against site-level redirects, created via .

To publish your docs privately, head to the settings, click Audience settings button, and choose the Share links option.

You can and regenerate share links at any time.

Is there a language we don’t yet offer that you’d like to see included? , or !

You can link to your own privacy policy to help visitors understand how your GitBook content uses cookies and how you protect their privacy. If you choose not to set one, your site will default to .

Endpoints added from your spec will continue to be updated anytime your spec is updated. See the section for more info.

After you’ve , you can generate endpoint pages by inserting an OpenAPI Reference in the table of contents of a Space.

In the space you’d like to generate endpoint pages, click the Add new... button from the bottom of your space’s .

You can also . Doing so will create a drop-down menu in your navigation bar — ideal for adding hierarchy to your site sections.

If you want to add variations of the same content — such as localizations or historical versions of the same product — consider using instead.

You can change the name, icon and slug of each of your sections by tapping the Edit button in the table row of the section you’d like to edit. This will open a modal. Edit the field(s) you’d like to change, then click the Save button. You can also delete the variant by clicking the Delete variant button in the lower left.

Changing a section’s slug will change its canonical URL. GitBook will create an automatic redirect from the old URL to the new one. You can also .

Your site displays sections in the order that they appear in your Site structure table. Sections can be reordered by grabbing the Drag handle and moving it up or down. All the spaces within that section will be moved with it. The changed order will be reflected on your site immediately.

To set a section as default, click on the Actions menu in the section's table row and then click Set as default.

To remove a section from a site, click the Settings button from your docs site dashboard, then click Structure to find the content you want to remove. Click the Edit button next to the section you want to remove, then click the Delete button in the lower left of the modal. This will remove the section, along with all the variants within it, from the published site. It will not delete the spaces itself, or the content within them.

Open the Actions menu for the space you want to remove and choose Remove.

Head to our guides to find a on setting up adaptive content with cookies.

Method
Use-cases
Ease of setup
Security
Format

Query parameters visitor.<prop>=

Feature flags, roles

Easy to use

Visitor can override the properties

JSON

Data passed through query parameters must be defined in your visitor schema through an object. Additionally, query parameters can be easily changed by the visitor and are best suited for non-sensitive information.

This guide takes you through setting up a protected sign-in screen for your docs. Before going through this guide, make sure you’ve first gone through the process of .

By default, every member of your organization can see all the content in your organization. However, their permissions are inherited from the assigned to them within your .

You can also add a by typing the team name and hitting Invite.

Alternatively, toggle this off to invite them as a . Guests only have access to the individual spaces that you invite them to, and can be given a specific role within that space — whether it’s to edit the content, or only view and comment on it.

The cost for this will depend on .

It is also possible to from within the Organization settings area.

When you share this link, anyone who clicks on it will be able to sign up, join your organization as a , and get access to just this single space and its content.

You can revoke the link at any time by opening the Actions menu next to the link and choosing Revoke.

Adaptive content is slightly different from , although they can work together.

Head to to start setting up adaptive content for your site.

You can learn more about Markdown itself by visiting .

Formatting
Markdown version
Result

We use for syntax highlighting. You can use to check which languages Prism supports. If you notice a mismatch between GitBook and Prism, there’s a chance we’re a version or two behind. We’ll catch up soon!

With variables you can create reusable text that can be conditionally referenced in and .

To create a new variable, Click the Variables icon in the upper right corner when editing an open . This will open the Variables side panel.

Variables can be referenced and used within an — which you can insert into your content inline. After inserting an expression, double click it to open the expression editor.

The spaces you link can contain any content, but it’s recommended to use variants as variations of the same content. If the spaces you link are semantically different from each other, consider adding them as instead.

You can change the name and slug of each of your variants by clicking the Edit button in the table row of the variant you’d like to edit. This will open a modal. Edit the field(s) you'd like to change, then click the Save button to save. You can also delete the variant by clicking the Delete variant button in the lower left.

Changing a linked space's slug will change the space's canonical URL. GitBook will create an automatic redirect from the old URL to the new one. You can also .

To replace a variant’s linked space with a different space, first delete it by clicking its Edit button, then click the Delete button in the lower left of the modal. Once the variant is deleted, click the Add variant button to add the new space.

Your site displays variants in the order that they appear in your Site structure table. Variants can be reordered by grabbing the Drag handle and moving it up or down. The changed order will be reflected on your site immediately.

To set a variant as default, click on the Actions menu in the variant’s table row and then click Set as default.

Open the Actions menu for the variant you want to remove and choose Remove.

GitBook offers three levels of headings. Heading levels 1 (H1) and 2 (H2) will appear in the .

If you want to link to a particular anchor from a page within your GitBook space, you can use a , which will update if you change the heading to prevent the link from breaking.

To avoid this, you can manually set the anchor link by opening the Options menu for the header, then choosing Edit anchor. You can then enter the anchor link you wish to use — this will remain the anchor even if you change the header itself.

This means that if you , page headers added through the editor will be represented as one level lower:

You can reset customization overrides back to the site-wide default by clicking the Reset button next to the space selector.

The options above provide lots of ways for you to customize your space, but there are a few things that you won’t be able to customize, regardless of .

It’s not possible to customize the layout of the elements on the page (However, it is possible to ).

It’s not possible to insert custom code (such as CSS, HTML or JS) directly into your GitBook site. We already integrate with a number of popular tools, and offer for many more.

If you created your docs for a public audience, you can publish it on the web. Spaces that you publish on the web can be indexed by search engines and will be available to anyone. If you don’t want your content to be indexed by search engines, you can disable that too — read more about that .

However you publish your content, you’ll still retain control over who can edit your content. And only your primary content branch will be published, so any will remain private until merged.

This feature is available on .

The "Project directory" option at the Git Sync level differs from the in the .gitbook.yaml configuration file. The first is used to lookup .gitbook.yaml itself, then both are combined to lookup the rest of the files in the directory. If no .gitbook.yaml exists in the "Project directory", the synchronization will use the default configuration scoped to this directory.

You can adjust and link them to the relevant resources.

Hover over a card and open its Options menu . Here you can add a target link, so users can jump directly to a location when they click the card.

Hover over a card and open its Options menu . Here you can add a cover image to your card. Alternatively, just click the Add cover image option on the card itself.

You can select the card size by opening the Options menu to the left of your card block. The Medium option creates three cards in one horizontal line, while the Large option shows two larger cards on each line.

You can make card blocks by clicking on the Options menu next to the block and choosing Full width.

You’re good to go. You’ll notice that if your space was in mode, live edits are now locked. This allows GitBook to reliably sync content to your repository when someone in your team merges a in GitBook.

When someone made to the space.

When someone merged a .

When someone performed a operation.

To view past versions of your content and see the changes that were made, click the Version history button in the , or open the Actions menu next to the space or change request title and choose Version history.

Click on any item in the list to see how your content looked at the point this change was made. This is very similar to how you view .

When you are viewing an old version of your content, you can choose to highlight the differences between the old and current content — similar to .

To roll back to a previous version of your space, hover over the version in the side panel, click the Actions button and select Rollback.

You can enhance pages with titles, icons, and descriptions using custom extensions in the tags section. All are supported via x-page-icon.

Tag description fields support GitBook markdown, including like tabs:

This guide takes you through setting up a protected sign-in screen for your docs. Before going through this guide, make sure you’ve first gone through the process of .

Navigate to the Integrations tab in the site you want to publish and locate the Okta integration or navigate directly to this .

is a proposed standard for making web content available in text-based formats that are easier for LLMs to process. You can access the llms.txt page by appending /llms.txt to the root URL of your docs site.

This guide takes you through setting up a protected sign-in screen for your docs. Before going through this guide, make sure you’ve first gone through the process of .

This is typically done by creating a —specifically a Pre Token Generation Lambda—that returns a JSON payload overriding or appending custom claims. These claims might include user roles, subscription tiers, or any other metadata relevant to your content.

Pages & feedback allow you to see a high-level representation of how your users rate your content. You’ll see an overview of all of your site’s sections and variants, and after enabling in the Customize menu for a site, you can see each page’s average feedback rating.

If a broken link points to a topic that exists somewhere else in your documentation, or you simply want to direct the traffic to your primary docs, you can set up to point those visitors in the right direction.

The section allows you to see what your users are asking for when using GitBook AI. This insight helps you identify common questions, uncover gaps in your documentation, and improve content to better meet user needs.

The analytics view in GitBook provides insights into how users engage with your API documentation.

GitBook app
GitBook GitHub app
our data protection practices
OpenAI’s privacy policy
Visit our pricing page
Site redirects
Site structure
Plans
Swagger 2.0
OpenAPI 3.0
Scalar
automatic redirects created by GitBook
HTTP 301
the process above
revoked
Let us know
contribute your own translation
GitBook’s privacy policy
group site sections together
full walk-through
unsigned

Bold

**bold**

bold

Italic

_italic_

italic

Strikethrough

~strikethrough~

strikethrough

Inline code

`code`

code

# I'm a page title
## My heading 1
### My heading 2
#### My heading 3
/
  package.json
  packages/
     styleguide/
        .gitbook.yaml
        README.md
        SUMMARY.md
     app/
        README.md
        SUMMARY.md
     api/
        .gitbook.yaml
        README.md
        SUMMARY.md
openapi.yaml
paths:
  /pet:
    put:
      tags:
        - pet
      summary: Update an existing pet.
      description: Update an existing pet by Id.
      operationId: updatePet
openapi.yaml
tags:
  - name: pet
  - name: store
  - name: user
openapi.yaml
tags:
  - name: everything
  - name: pet
    x-parent: everything
  - name: store
    x-parent: everything
Everything
├── Pet
└── Store
openapi.yaml
tags:
  - name: pet
    # Page title displayed in table of contents and page
    -x-page-title: Pet
    # Icon shown in table of contents and next to page title
    -x-page-icon: dog
    # Description shown just above the title
    -x-page-description: Pets are amazing!
    # Content of the page
    description: Everything about your Pets
openapi.yaml
---
tags:
  - name: pet
    description: |
      Here is the detail of pets.

      {% tabs %}
      {% tab title="Dog" %}
      Here are the dogs
      {% endtab %}

      {% tab title="Cat" %}
      Here are the cats
      {% endtab %}

      {% tab title="Rabbit" %}
      Here are the rabbits
      {% endtab %}
      {% endtabs %}
openapi.yaml
---
tags:
  - name: pet
      description: |
          {% openapi-schemas spec="petstore" schemas="Pet" grouped="false" %}
              The Pet object
          {% endopenapi-schemas %}
export const handler = async (event, context) => {
  // Retrieve user attribute from event request
  const userAttributes = event.request.userAttributes;

  // Add additional claims to event response
  event.response = {
    "claimsAndScopeOverrideDetails": {
      "idTokenGeneration": {},
      "accessTokenGeneration": {
        "claimsToAddOrOverride": {
          "products": ['api', 'sites', 'askAI'],
          "isBetaUser": true,
          "isAlphaUser": true,
        }
      }
    }
  };
  // Return to Amazon Cognito
  context.done(null, event);
};
Check out the .md file for this page
Check out the /llms.txt for the GitBook docs
Check out the /llms-full.txt file for the GitBook docs
Using GitBook Assistant
❌
Common Mark
Prism
Test Drive Prism
below
Premium and Ultimate site plans
switch between medium or large cards
Font Awesome icons
llms.txt
Cognito Lambda trigger

Code blocks

Add a code block to a page to include sample code, configurations, code snippets and more

You can add code to your GitBook pages using code blocks.

A code block may be useful for:

  • Sharing configurations

  • Adding code snippets

  • Sharing code files

  • Showing usage examples of command line utilities

  • Showing how to call API endpoints

  • And much more!

Example of a code block

index.js
‌import * as React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(<App />, window.document.getElementById('root'));

Code block options

Set syntax…

You can set the syntax in your code block to any of the supported languages. This will enable syntax highlighting in that language, too.

filename.txt
// Some code

With line numbers

This will toggle line numbers for your code on and off.

Showing line numbers is useful when the code represents the contents of a file as a whole, or when you have long code blocks with lots of lines. Hiding line numbers is useful for snippets, usage instructions for command line or terminal expressions and similar scenarios.

With caption

This will toggle a caption that sits at the top of the block, above your lines of code.

Wrap code

This will toggle code wrapping on and off, so long lines of code will wrap to all be visible on the page at once.

Wrapping lines is useful when your code is long and you want to avoid having the viewer scroll back and forth to read it. If you toggle Wrap code on, you may also want to show line numbers — this will make it easier to read the code and understand where new lines start.

Code block actions

As well as the options above, you can also change the language the code block displays, and copy your code instantly.

Copy the code

Hover over a code block and a number of icons will appear. Click the middle icon to copy the contents of the code block to your clipboard.

Representation in Markdown

{% code title="index.js" overflow="wrap" lineNumbers="true" %}

```javascript
‌import * as React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(<App />, window.document.getElementById('root'));
```

{% endcode %}

Content configuration

Configure Git Sync with extra functionalities

If you’d like to configure Git Sync further, you can add a .gitbook.yaml file at the root of your repository to tell GitBook how to parse your Git repository.

.gitbook.yaml
root: ./

​structure:
  readme: README.md
  summary: SUMMARY.md​

redirects:
  previous/page: new-folder/page.md

Root

The path to lookup for your documentation defaults to the root directory of the repository. Here’s how you can tell GitBook to look into a ./docs folder:

.gitbook.yaml
root: ./docs/

All other options that specify paths will be relative to this root folder. So if you define root as ./docs/ and then structure.summary as ./product/SUMMARY.md, GitBook will actually look for a file in ./docs/product/SUMMARY.md.‌

​Structure‌

The structure accepts two properties:‌

  • readme: Your documentation’s first page. Its default value is ./README.md

  • summary: Your documentation’s table of contents. Its default value is ./SUMMARY.md

The value of those properties is a path to the corresponding files. The path is relative to the “root” option. For example, here’s how you can tell GitBook to look into a ./product folder for the first page and summary:

.gitbook.yaml
structure:
  readme: ./product/README.md
  summary: ./product/SUMMARY.md

When Git Sync is enabled, remember not to create or modify readme files through GitBook's UI. The readme file should be managed exclusively in your GitHub/GitLab repository to avoid conflicts and duplication issues.

Summary‌

The summary file is a Markdown file (.md) that should have the following structure:

./SUMMARY.md
‌# Summary​

## Use headings to create page groups like this one​

* [First page’s title](page1/README.md)
    * [Some child page](page1/page1-1.md)
    * [Some other child page](part1/page1-2.md)

* [Second page’s title](page2/README.md)
    * [Some child page](page2/page2-1.md)
    * [Some other child page](part2/page2-2.md)

## A second-page group​

* [Another page](another-page.md)

Providing a custom summary file is optional. By default, GitBook will look for a file named SUMMARY.md in your root folder if specified in your config file, or at the root of the repository otherwise.

If you don’t specify a summary, and GitBook does not find a SUMMARY.md file at the root of your docs, GitBook will infer the table of contents from the folder structure and the Markdown files below.‌

The summary markdown file is a mirror of the table of contents of your GitBook space. So even when no summary file is provided during an initial import, GitBook will create one and/or update it whenever you update your content using the GitBook editor.

Because of this, it’s not possible to reference the same Markdown file twice in your SUMMARY.md file, because this would imply that a single page lives at two different URLs in your GitBook space.

​Redirects

Redirects allow you to define redirects in your .gitbook.yaml configuration file. The path is relative to the “root” option. For example, here’s how you can tell GitBook to redirect users accessing a past url /help to a new url /support

.gitbook.yaml
root: ./

redirects:
  help: support.md

With Git, when a file is moved many times, the file is removed and a new one is created. This makes it impossible for GitBook to know that a folder has been renamed, for example. Make sure to double-check and add redirects where needed.

Enabling adaptive content

Choose an authentication method to pass user data to GitBook.

To start customizing your documentation experience for your readers, you'll need to enable adaptive content and decide how your visitor data is passed to GitBook. This lets your site's content dynamically adapt based on who's viewing it.

Enable adaptive content

Before you’re able to pass user data to GitBook, you’ll need to configure your site to use adaptive content.

Set your visitor schema

After enabling adaptive content, you’ll need to define a schema for the types of claims you expect GitBook to receive when a user visits your site.

The visitor schema should reflect how these claims are structured when sent to GitBook.

For example, if you expect a visitor to potentially be a beta user in your product, you would set a visitor schema similar to:

{
  "type": "object",
  "properties": {
    "isBetaUser": {
      "type": "boolean",
      "description": "Whether the visitor is a Beta user."
    }
  },
  "additionalProperties": false
}

Read claims being passed in as strings.

Strings must contain an enum key, which needs to contain any expected values that would be found on the key being read.

{
  "type": "object",
  "properties": {
    "language": {
          "type": "string",
          "description": "The language of the visitor",
          "enum": [
            "en",
            "fr",
            "it"
          ]
  },
  "additionalProperties": false
}

Read claims being passed in as booleans.

{
  "type": "object",
  "properties": {
    "isBetaUser": {
      "type": "boolean",
      "description": "Whether the visitor is a Beta user."
    },
  },
  "additionalProperties": false
}

Nest claims in an object to group similar values.

{
  // Top level claims
  "type": "object",
  "properties": {
    // Nested claims
    "access": {
      "type": "object",
      "description": "User’s access to product feature",
      "properties": {
        "isAlphaUser": {
          "type": "boolean",
          "description": "Whether the visitor is a Alpha user."
        },
        "isBetaUser": {
          "type": "boolean",
          "description": "Whether the visitor is a Beta user."
        },
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}

Set an unsigned claim

Unsigned claims are a specific type of claim that identifies claims coming through that might not be signed by a client application. It is required to set claims in your visitor schema as unsigned if you are passing claims through URL parameters, unsigned cookies, and feature flags.

If you intend to work with unsigned claims, you will need to declare the claims you are expecting in the schema under an “unsigned” prop alongside your signed claims.

{
  "type": "object",
  "properties": {
    "isBetaUser": {
      "type": "boolean",
      "description": "Whether the visitor is a Beta user."
    },
    // Add unsigned claims
    "unsigned": {
      "type": "object",
      "description": "Unsigned claims of the site visitor.",
      "properties": {
        "language": {
          "type": "string",
          "description": "The language of the visitor",
          "enum": [
            "en",
            "fr",
            "it"
          ]
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}

Pass visitor data to GitBook

GitBook provides different ways to pass visitor data to adapt your site's content. After defining your schema, you’ll need to decide how you want to pass your visitor data to GitBook.

Search & GitBook Assistant

Help your users find the information they need faster with powerful knowledge discovery tools for your published content

Choose your site’s search experience

GitBook sites offer different search experiences depending on what you want for your users:

  • Keyword search – A standard search experience based on keywords. Automatically enabled on all sites.

  • GitBook AI search – Users get short answers to questions directly from the search box.

  • GitBook Assistant – Users get an advanced, interactive chat experience with GitBook’s AI agent.

To choose your site’s search experience, open your site’s dashboard, navigate to the Settings page and choose AI & MCP from the menu on the left. Here you can choose your preferred experience.

When the GitBook Assistant is enabled, AI search is disabled. Standard keyword searches will always provide the results in the search bar no matter which experience you choose.

Searching published documentation

​Users can open the Ask or search… bar by pressing ⌘ + K on Mac or Ctrl + K on PC.

Your users can search for keywords within your docs site and jump quickly to specific pages or page sections across your entire site.

GitBook AI search

GitBook AI search offers basic AI-powered answers in the Search and find… bar of your site. It’s trained on the content of your docs site, but cannot pull in information from external sources.

Using GitBook AI search

If you have enabled GitBook AI search from your site’s settings page, your users can access it by asking a question directly in the Ask or search… bar at the top of the page.

They can open this by clicking it directly, or by pressing ⌘ + K on a Mac or Ctrl + K on a PC.

As well as a summarized answer, below your users will also see an expandable section that shows the sources that GitBook AI used to create its answer, plus related questions you can click as a follow-up.

GitBook Assistant

GitBook Assistant gives your users fast, accurate answers about your documentation using natural language. It’s embedded right into your docs site, so users can ask questions, request more information about the page they’re on, or get other contextual help.

The Assistant uses agentic retrieval to understand the context of the query based on the user’s current page, previously-read pages, and previous conversations they’ve had.

GitBook Assistant is trained on your documentation, but you can also add external sources to expand it’s context and knowledge and give better answers.

Try GitBook Assistant for yourself!

You can try GitBook Assistant for yourself right here in our docs. To get started, click the Assistant button next to the Ask or search… bar. Here are some ideas to test it out:

  • Ask a simple question about something on this page

  • Ask a technical question about our API

  • Ask follow-up questions or ask for more details about a specific part of Assistant’s answer

Using GitBook Assistant

Users can access GitBook Assistant in three ways:

  • Press ⌘ + J on Mac or Ctrl + J on PC

  • Type a question into the Ask or search… bar and choose the ‘Ask…’ option at the top of the menu.

Extend GitBook Assistant with MCP servers

You can also choose to add external data sources to GitBook Assistant to give it more context and data to pull answers from. You can do this by connecting Assistant to MCP servers for external platforms, such as:

  • Your community (Slack, Discord, GitHub Communities etc)

  • Support tools (Intercom etc)

  • Your future product roadmap (GitHub, Linear etc)

  • Docs for external integrations with products

To add an MCP server to GitBook Assistant, follow these steps:

1

Open your site’s settings

Navigate to your site dashboard and choose the Settings option from the site header. Then choose the AI & MCP section from the left-hand menu

2

Add a new server

At the bottom of the page is a table showing all the connected MCP servers. To add a new server, click Add MCP server

3

Choose your MCP server

To add your server you’ll need to give it a name, add the URL for the server, and configure the HTTP headers that will be sent along with the request to the server when a user submits a query.

FAQs

Integrating GitBook AI with your product

With our API, you can embed GitBook AI into your product or website! This opens up lots of possibilities, including in-app helpers and website chat bots that can respond to questions based on the content in your documentation.

Formatting your content

Format your content in various ways using the context menu or keyboard shortcuts

To format your text, simply select the words you want and choose one of the formats from the context menu — or format your text using a keyboard shortcut or through Markdown syntax.

Bold

Keyboard shortcut: ⌘ + B

Italic

Keyboard shortcut : ⌘ + I

Strikethrough

Keyboard shortcut: ⇧ + ⌘ + S

Code

Keyboard shortcut: ⌘ + E

Link

Keyboard shortcut: ⌘ + K

Color and background color

Click the color icon in the context menu, and choose a color for the text or its background.

This text is orange.

This text background is orange.

Pages

Add pages, page groups or external links — and learn about the options you have on each page

Table of contents

Create a new page

Can’t see the option to create a new page?

Organizing your content

There are three ways to organize your content in the table of contents:

Pages

A page has a title, and optional description, and an area where you can write and add any kind of content.‌

You can nest pages by dragging and dropping a page below an other in the table of contents. Doing this creates a subpage.

Tip: There’s no limit to page nesting, but we’d recommend you avoid more than three levels of nesting to avoid an overly-complex navigation.

When you change the title of a page, the page’s slug (the part at the very end of the URL, e.g. /hello-world) will also change — unless you’ve manually set the page’s slug previously.

Page groups

With page groups, you can bring pages together into sections that cover related content.

You can create a new page group by clicking Add new... > Group at the bottom of your table of contents.

Page groups can only live at the top level of the table of contents. You cannot nest page groups inside page groups.

External links

You can also add links to your table of contents. Clicking them will take people directly to the linked content.

Create new external link by clicking Add new... > External link at the bottom of your table of contents.

Page icons and emojis

To improve visibility for readers when skimming your table of contents, you can add an optional icon or emoji to individual pages. The icon or emoji will appear in the table of contents, and next to the title at the top of the page.

To add an icon or emoji, click the Add icon button when hovering the page title, or the emoji button to the left of the title.

Page options

In the Page options menu you can customize the look and feel of a selected page within a space, and control its visibility.

Layout

In the Page options side panel, you can select how each page is displayed to those who visit your published content. There are three layout presets to choose from, or you can create a custom layout.

Each layout preset will toggle on or off each of the following parts of the page:

  • Page title

  • Page description

  • Table of contents

  • Page outline

  • Next/previous links

Visibility

You can decide which pages you would like to show/hide in your published documentation, while also deciding if you would like the page to be indexed in your published doc’s search, and/or indexed by search engines.

If hidden the following will appear in the front matter of the markdown file when using Git Sync:

Page covers

  • Change the cover image

    Hover over the page cover and click Change cover, then select or upload an image. Based on how we currently display page covers, 1990x480 pixels is the ideal size.

  • Reposition the cover image

Tables

Keep information organized and make documenting data easier with tables

You can add tables to better organize your information in a GitBook page.

Table block options

When you open the Options menu to the left of a table block, you’ll have a number of options to change the appearance and manage the data inside the table:

  • Add column: Add a new column to the right of your table. You can choose column type using the menu, or just click Add column to add a text column.

  • Insert row: Add a new row to the bottom of your table.

  • Show header: Hide or show the top totle row of your table. Depending on the data you’re display, you may not need a title row in your table, so you can disable it here.

  • Reset column sizing: If you’ve changed the column widths, this will reset them all to be equal again.

  • Visible columns: Choose which columns are visible and which are hidden. If you have hidden columns in your table, this menu is where you can make them visible again.

  • Full width: Make your table span the full width of your window. This is great for tables with lots of columns.

  • Delete: Deletes the table block and all of it’s content.

Changing a column type

Depending on the data you want to display, you can set table columns can have different data types. These add formatting, embellishments or restrictions to every cell in the column:

  • Text: A standard text column, with standard formatting support.

  • Number: A number column, with or without floating digits.

  • Checkbox: A checkbox on each line that can be checked or unchecked.

  • Select: You can select data from a list of options that you can define by opening the Columns options menu and choosing Manage options. This can be single-choice or multiple-choice.

  • Users: You can add the name and avatar of a member of your organization. This can be single-choice or multiple-choice.

  • Files: You can reference a file in the space. You can upload new files when populating cells in the column.

  • Rating: A star rating. You can configure the maximum rating by opening the Column options menu and choosing Max.

Use the Column options menu to change a column’s type. When you change a column type, you’ll see a prompt asking you to confirm the change, as column data could be deleted or broken by this action.

Resizing columns

Hover over a column’s edge and drag to resize it. A pixel count appears above the cursor to help you set consistent column sizes.

GitBook stores column sizes as a percentage of the overall width, which allows for relative sizing based on the overall width of the table.

Scrolling tables

Tables that are wider than the editor container will be horizontally scrollable.

Column options

You can add new columns by clicking the Add column button that appears when you hover over the right edge of the table.

Inside the Column options menu you can also switch automatic sizing on and off, add a new column to the right, hide the column, or delete the column.

Row options

  • Open row: Open the row in a modal that shows all of its data. Here you can quickly change row types, edit data, and see data in hidden columns.

  • Insert above/below: Add a new row above or below the currently-selected row.

  • Add column: Add a new column on the right of the table.

  • Delete row: Permanently remove all the data in the row from your table.

Images in tables

When you click into a table cell, you can hit the / key to insert images. This will not work in the header row.

Representation in Markdown

Icons, colors, and themes

Customize icons, colors, themes and more.

Title, icon and logo

Title

You can set any title you choose for your space. Note: this setting will only affect the title that displays in the published documentation. If you want to edit the title in the GitBook app, close the customize menu and edit it at the top of the space.

Icon

You can set an emoji, or upload an icon of your own. The icon you set in the Customization menu will be used as the favicon for your docs site.

This setting will only affect the icon that displays in the published documentation. If you want to edit the icon used within the GitBook app, you can do so when editing content in the space itself.

Custom logo (Premium & Ultimate)

You can replace both the published space’s title and icon with a custom logo so that your documentation better reflects your own branding — and you can upload two versions: one for light mode, and one for dark mode.

What’s the difference between the icon and logo options?

The icon setting lets you upload a small, 132×132 px image, which will appear alongside your space title and function as your site’s favicon. The custom logo option lets you upload a larger image (we recommend at least 600 px wide), which will completely replace any icon and title you’ve set.

Themes

Themes let you customize the color scheme of your published content for both light and dark mode. There are four themes to choose from. The colors of your site will be directly impacted by the primary color and tint that you choose. These two selections affect various parts of the interface and can completely change the look and feel of your site.

Clean

A modern theme featuring translucency and minimally styled elements. Your primary color (or tint) affects links and other highlighted interface elements. Clean is available for all sites and is the default theme.

Muted

A sophisticated theme with decreased contrast between elements. The site background is more pronounced and blends in with the foreground, and some elements feature an inverted look — all based on your primary color (or tint). Muted is available for all sites.

Bold (Premium & Ultimate)

A high‑impact theme with prominent colors and strong contrasts. Your primary color (or tint) will be used for the header of the site, and other highlighted elements like icons are colored along with it. Bold is only available for Premium or Ultimate sites.

Gradient (Premium & Ultimate)

A trendsetting theme featuring a gradient background and splashes of color. The gradient and highlighted elements will be colored by your primary color (or tint). Gradient is only available for Premium or Ultimate sites.

Colors

Primary color

Your site’s primary color will affect the styling of highlighted interface items and navigational elements like links, the current page and section, breadcrumbs, and primary header buttons. GitBook automatically adjusts colors on individual elements for readability if the contrast with the background is too low or when a visitor’s system requests higher contrast.

Tint color

Your site’s tint color will subtly change the color of all text and icons across your entire site — including header links, icon color, and UI elements like the Ask or search bar. The tint color will not affect navigational elements like links and buttons, which always use the primary color. In the Tint color section you’ll see suggested colors based on your primary color selection; you can select one to preview it, choose your primary color as your tint, or pick a completely custom color with the color picker.

Semantic colors

Semantic colors are applied to hint blocks within your published content. You can change the background color of each hint style; these changes will only be reflected on the published site you’re customizing. Hint blocks in the GitBook editor will always remain in their assigned colors.

Modes

Show mode toggle

Enable this if you want visitors to manually toggle between light and dark mode. Readers can find the toggle at the bottom of any published page, on both desktop and mobile.

Default mode

Choose whether visitors see your content in light or dark mode by default. If Show mode toggle is enabled, they can switch modes; if disabled, they’ll only see the mode you choose here.

Note: to change the theme within the GitBook app, go to your Settings menu at the bottom of the sidebar.

Site styles

Font family (Premium & Ultimate)

Choose a font family for your published content from a curated list of popular options.

Custom fonts (Ultimate)

Upload your own fonts to align your published content with your brand’s style guide. To upload a font, click Add custom font and follow the instructions. You must upload a font file for both regular and bold weights.

Icons (Premium & Ultimate)

When using page icons, set the weight and style of the displayed icons here.

Corner style

Choose either rounded or straight corners to match your brand’s style preferences.

Link style

Choose between two link designs:

  • Default: highlights the entire link in your primary or tint color.

  • Accent: adds a colored underline to the link, leaving the text color unchanged.

Sidebar styles

Background style

Choose the background style for the sidebar container. The color is derived from your selected theme.

List style

Choose the style for the sidebar list and its selected items.

Site structure

Add structure to your published documentation using site sections and variants

Content types

Linked spaces can serve as one of two different content types, which determine how GitBook treats them in relation to each other and shows them to visitors.

Managing your site structure

From your docs site’s dashboard, open the Settings tab in the site header, then click Structure. Here you can see all the content of your site, divided into sections and variants.

Your site starts out with a single section with your site's name and a single variant with the space you linked during your site's set-up.

Linking a space to your docs site

When you add a space — as a variant or a section — a name and slug will be generated based on the space’s title.

Changing sections or variants

Reordering sections or variants

You can also use the keyboard to select and move content. Select a section or variant with the space bar, then use the arrow keys to move it up or down. Hit the space bar again to confirm the new position.

Setting default content

If you have multiple sections in your site, one section will be marked as Default. This section is shown when visitors arrive on your site, and is served from your site’s root URL. Other sections each have a slug that is appended to the root URL.

If you have multiple variants within a section, one variant will be marked as the default. Like sections, the default variant is shown when visitors arrive on your site, or when they visit a section. Other variants each have a slug that’s appended to the section’s URL.

Setting a space as default removes its slug field, as it will be served from the section root instead. GitBooks redirects the space’s slug to the appropriate path, to ensure visitors keep seeing your content.

Remove content from a site

To remove the content of a space from a site, open the Settings tab from your docs site dashboard, then click Structure to find the content you want to remove.

Removing a space from your site will remove it from the published site, but will not delete the space or the content within it.

Reusable content

Create reusable blocks of content that can be used across spaces, and all updated at once when you change an instance

Reusable content lets you sync content across multiple pages and spaces, so you can edit all instances of the block at the same time.

Fundamentals

Reusable content works just like any other content—you can modify it via change requests, include it in review workflows, and it will render correctly on any published site.

While reusable content can be referenced across multiple spaces, it belongs to a single parent space.

The "parent space" concept

The parent space is the space that owns the reusable content. It’s the only place where that content can be edited.

Even though updates to reusable content will appear instantly in all instances, all changes must originate from the parent space—either as a direct edit or through a change request.

Spaces are a core concept in GitBook, supporting both editorial workflows and security. Because GitBook enforces permission-based editing, reusable content can only be changed from its parent space. This ensures that editing rights are respected, even when the content is reused across the organization.

Known limitations

Integrations

Blocks provided by integrations are not supported in reusable content. This is because integrations in GitBook are installed per space, and limiting access ensures that third-party integrations only have the permissions you grant. Referencing reusable content across spaces would break this security boundary.

Search

Currently, reusable content only appears in search results within its parent space. We’re actively working to remove this limitation so that reusable content shows up in search results wherever it’s referenced.

In the app

Create reusable content

Alternatively, you can select one or more blocks and then hit Cmd + C to open a prompt asking if you want to create reusable content.

Insert reusable content

You can insert reusable content as you would with any other block. Hit / on an empty line to open the Insert palette and search for your content by its name or simply searching for “reusable”. Alternatively, click the + on the left of any block or empty line.

You will also find the reusable content panel in the pages sidebar, where you can find a list of previously created content blocks in your current space.

Edit reusable content

If you’re making changes inside a change request, the content will be synced to all other instances once that change request is merged.

Detach reusable content

Once detached, any changes you make to the block(s) will not be reflected across the other instances, and changes you make in those instances will not be reflected in the detached block(s). All other instances of the reusable content remain synced together.

Delete reusable content

Deleting reusable content will delete it from all pages it is used in. This action cannot be undone.

Syncing with GitHub & GitLab

Reusable content is fully supported when syncing to GitHub & GitLab. Your reusable content will be exported to a dedicated includes folder, each content being a separate Markdown file.

Your content is then referenced in your other pages using the include directive.

Example

If you're writing on the GitHub side, ensure the path to the include is relative to the file containing the reference (not the root of the repository).

Setting up Auth0

Set up an Auth0 login screen for visitors to your docs.

To setup your GitBook site with authenticated access using Auth0, the process looks as follows:

1

Create an Auth0 application in your Auth0 dashboard.

2

Install the Auth0 integration and add the required configuration to your GitBook site.

3

Configure Auth0 to work with adaptive content in GitBook.

1. Create a new application in Auth0

Start by creating a new application in your Auth0 platform dashboard. This application will allow the GitBook Auth0 integration to request tokens to validate user identity before granting them access to your site.

  1. Head to Applications > Applications section from the left sidebar.

  2. Click on the + Create Application button, and give your app a name.

  3. Under the Choose an application type, select Regular Web Applications.

  4. In the Quickstart screen of the newly created app, select Node.js (Express) and then I want to integrated my app.

  5. You should then see a configuration screen like below. Click Save Settings And Continue.

  6. Click on the Settings tab.

  7. Copy and make note of the Domain, Client ID and Client Secret.

Please ensure that you have at least one connection enabled for your Auth0 application under the Connections tab.

2. Install and configure the Auth0 integration

Once you've created the Auth0 application, the next step is to install the Auth0 integration in GitBook and link it with your Auth0 application using the credentials you generated earlier:

  1. Navigate to the site where you've enabled authenticated access and want to use Auth0 as the identity provider.

  2. Click on the Integrations button in the top right from your site’s settings.

  3. Click on Authenticated Access from the categories in the sidebar.

  4. Select the Auth0 integration.

  5. Click Install on this site.

  6. After installing the integration on your site, you should see the integration's configuration screen:

  7. Enter the Domain, Client ID and Client Secret values you copied after creating the Auth0 application earlier. For Auth0 Domain, enter the Domain copied from Auth0 (make sure to prefix it with https://).

  8. Copy and make note of the Callback URL displayed at the bottom of the dialog.

  9. Click Save.

  10. Head back to the Auth0 application you created earlier in the Auth0 dashboard.

  11. Browse to Applications > Applications in the sidebar and select the Settings tab.

  12. Scroll down to the Application URIs section of the settings

  13. Paste the Callback URL you copied earlier from the GitBook integration dialog into the Allowed Callback URL input field.

  14. Click Save.

  15. Head back to Auth0 integration installation screen in GitBook.

  16. Close the integration dialogs and click on the Settings tab in the site screen.

  17. Browse to Audience and select Authenticated access (if not already selected).

  18. Select Auth0 from the dropdown in the Authentication backend section.

  19. Click Update audience.

  20. Head to the site's overview screen and click Publish if the site is not already published.

Your site is now published behind authenticated access using your Auth0 as identity provider.

To test it out, click on Visit. You will be asked to sign in with Auth0, which confirms that your site is published behind authenticated access using Auth0.

3. Configure Auth0 for Adaptive content (optional)

Set a custom domain

Set a custom domain for your docs sites

By default, your sites are accessible on a [subdomain].gitbook.io domain.

You can customize this by setting a custom domain, meaning your audience can access your documentation on a chosen domain.

1

Choose a subdomain

When choosing a subdomain, you can either use www or a custom one. Some commonly used subdomains are:

  • docs.example.com

  • help.example.com

  • developers.example.com

2

Initiate the custom domain setup

Navigate to the site for which you want to set the custom domain. Click Settings, then choose Set up a custom domain.

From here, you'll see a window where you can enter the custom domain you chose in the first step. Type it out and click Next.

3

Configure the DNS

At this stage, you'll see a window with three fields: Type, Name, Target.

Those are the details you'll use to set your custom domain in your DNS provider. This is done outside GitBook, in the provider you are using for your domain.

Copy the contents of the Name and Target fields to use in your DNS provider. Each provider is different, so when in doubt, check directly with them how to add this record. You should be able to pick the Type of record from a list in your provider.

After adding the record, it might take some time for the changes to propagate. We recommend waiting at least 1 hour before moving to the next step. Click Next when you are ready.

4

Finalize your setup

After adding the record and it being propagated, it's time to go live! GitBook will verify the domain, the record you added and will automatically configure the SSL certificate for your domain.

Once done, you'll receive a notification and can click Finish. You can also close the window if you need, and we'll send you a notification once the process is done on our side.

Troubleshooting

Setting up a custom domain can occasionally run into obstacles. Below, we outline frequent problems encountered during this process and provide detailed solutions to each of them.

Domain already connected error: your subdomain is already configured for different content.

A custom domain assigned to a site must be unique. Attempting to use the same custom domain in more than one location will result in an error.

If this happens, you can click the link within the error message to look at the content the custom domain is already connected to. This may help you to decide what to do next.

It’s also possible that you might not have access to the content — if that’s the case, contact the support team and they can help you with your next steps.

The solution to this error will always be one of two things, however:

  1. Choose a different custom domain; or

  2. Disconnect the custom domain from the content it is already connected to, then reconnect it to the new content.

Cookies

Pass visitor data into your docs through a public or signed cookie.

Using adaptive content with feature flags requires adding code to your application.

You can pass visitor data to your docs through your visitors browser cookies. Below is an overview of the different methods.

Public cookie

To pass data to GitBook from a public cookie, you’ll need to send the data from your application by setting a public gitbook-visitor-public cookie.

Below is a simple JavaScript example:

Signed cookie

To set this up, you'll need to adjust your application’s login flow to include the following steps:

1

Generate a JWT when users logs in to your application

Whenever a user logs in to your product, generate a JWT that contains selected attributes of your authenticated user's info.

2

Sign the JWT using the site's visitor signing key

Then, make sure to sign the JWT using the site's visitor signing key, which you can find in your site’s audience settings after enabling Adaptive Content.

3

Store the JWT in a wildcard session cookie

Finally you need to store the signed JWT containing your user's info into a wildcard session cookie under your product domain.

For example, if your application is served behind the app.acme.org domain, the cookie will need to be created under the .acme.org wildcard domain.

Below is a simple TypeScript example:

Importing content

How to import existing content into GitBook from Confluence, Notion, Git and more

You can migrate and unify existing documentation in GitBook using the import tool.

Using the Import Panel

Supported import formats

GitBook supports imports from websites or files in the following formats:

  • Markdown (.md or .markdown)

  • HTML (.html)

  • Microsoft Word (.docx)

We also support imports from:

  • Confluence

  • Notion

  • GitHub Wiki

  • Quip

  • Dropbox Paper

  • Google Docs

If you want to import multiple pages, you can upload a ZIP file containing HTML or Markdown files.

GitBook is Markdown-based, so importing content in Markdown format will yield the best results. If your current tools support exporting in Markdown, we recommend using that format for a smoother import process.

The Import panel

When you create a new space, you’ll have the option to import content from the bottom sheet of the first empty page.

After choosing an input source, you can select the file you’d like to import.

GitBook imports content from various sources, but differences in product features and document formats may cause variations in the imported content compared to the original source.

Limitations

GitBook currently has the following limits for imported content:

  • The maximum number of pages that can be uploaded in a single import is 20.

  • The maximum number of files (images etc.) that can be uploaded in a single import is 20.


Import using Git Sync

Here’s how to do it:

1

Convert your content into Markdown

GitBook is Markdown-based, so importing content in Markdown format will yield the best results. If your current tools support exporting in Markdown, we recommend using that format for a smoother import process.

2

Organize your content in GitHub or GitLab

When setting up your GitBook site, it’s crucial to organize your content in your GitHub or GitLab repository efficiently. Since Git Sync occurs at the space level, carefully plan how to group your content. Create multiple repositories or folders, ensuring the necessary Markdown files are in the correct locations.

3

Set up spaces and Git Sync

4

Run Git Sync in the direction GitHub → GitBook

When following the configuration process, make sure you select the direction of GitHub → GitBook. This will result in the contents of your folder or repository being pulled from GitHub or GitLab into GitBook.

Adapting your content

Tailor your content for different users.

After setting up your authentication method, you’ll be able to use the data to adapt the content in your site for different users.

You can adapt and personalize many parts of your docs, including:

Working with the condition editor

Example

The data you pass through your users to GitBook is attached to an object called visitor.claims.

Let’s take a look at an example if we want to write a conditional statement to only show a page for users who are part of a beta program you might define.

The expression above means that any user who matches this claim (i.e. isBetaUser is true in the user’s claim), will be able to see and access the page. Any user who does not match this claim (including visitors without any claims set), will not be able to see or access the page.

The condition editor also comes built in with autocomplete, which suggests claims or attributes that have been found on previous visitors to your site, helping you craft the conditional statement for your pages, variants, or sections.

  1. Set a variable for the latest version of your product

  2. Then, configure a claim that shows which version of your product is being used by a visitor to your docs

  3. Finally, write an expression to only show certain pages when a user is on the latest version of your docs

Testing with segments

Segments represent mock user data that you can configure to test your conditions.

For example, you could set up a segment that represents a developer on your enterprise plan, or a sign-in user on a free plan, and then see which pages would be visible to them.

Conditional pages

Conditional variants

Conditional sections

Conditional page header links

Inline expressions

Working with Git Sync

Conditions set in GitBook are synced through Git Sync and appear in the synced Markdown pages. This means blocks and pages with conditions set on their visibility are still visible in your synced repo.

Data passed through claims is never visible in Markdown, and is securely passed to GitBook.

Cover

Integrations

Integrate with your favorite tools and applications.

Cover

Collaboration

Invite your team and collaborate in GitBook.

Cover

Install an integration

Integrate your favorite tools with your published site.

When you add a code block, you can choose to , , , and . It’s also easy to , so you can use it elsewhere

You can also combine code blocks with a to offer the same code example in multiple different languages:

You can make code blocks by clicking on the Options menu next to the block and choosing Full width.

When you click on the Options menu next to the code block, or the Actions menu in the block itself, you’ll see a number of options you can set.

We use for syntax highlighting. You can use to check which languages Prism supports. If you notice a mismatch between GitBook and Prism, there’s a chance we’re a version or two behind. We’ll catch up soon!

The caption is often the name of a file as shown in , but you can also use it as a title, description, or anything else you’d like.

Redirects you define in a space’s configuration file are scoped to the corresponding space. We recommend creating for most cases as they apply to the whole site, across spaces.

Head to your , and enable “Adaptive content” from your site’s audience settings. Once enabled, you’ll get a generated “Visitor token signing key”, which you’ll need in order to continue the adaptive content setup.

This will also help you use autocomplete when configuring your claims in the . Visitor schemas only support the following types:

If your docs site has multiple , the search results will contain pages from all of these sections so that you users can jump straight to the page they need.

GitBook AI does not work across individual published spaces on different .

Multi-space search is only available when viewing published spaces that live as within the same site.

Ask a question about conversations in our GitHub Community, which we’ve — something like “What discussions have there been about customization options?”

Click the GitBook Assistant button next to the Ask or search… bar

Head to to find out more.

We’ve written these shoradolestcuts using Mac keys. Use Control in place of ⌘ (Command) on Windows or Linux operating systems. Check out our section to see all the shortcuts for all operating systems.

When you add a link to text on your page, you’ll be prompted to provide the link. You can add any URL, but if you’re linking to another page or section in your space, we recommend .

This is .

This is a .

This is a .

This is .

A page is the place where you can add, edit and embed content. Pages always live inside a , allowing you to group related content and create different sections for the topics or areas you’re covering.

When publishing your documentation, each space will be its own or , and the pages inside the space will all appear on that site.

You can create as many pages as you need in a space. They’re all visible on the left side of your screen in your space’s . The table of content will appear in the same place when you publish your space, unless .

When in mode or in a , you can create a new page by clicking Add new... > Page at the bottom of your table of contents. Alternatively, you can hover between pages in the table of contents and click the + icon that appears.

If are disabled for your space, you’ll need to create or edit a . Once you’re in a change request, the New page button (which allows you to create pages, page groups and links) will be available in the table of contents.

Alternatively, you may not have the correct to edit a page.

You can change the title and the slug of a page at any time by clicking opening the page’s Action menu and choosing Rename.

To change the title and slug of a page group, click the Action menu icon next to the group title in the table of contents and choose Rename.

You can open the Page options menu or change a page’s cover by hovering over the page title. You’ll see the buttons appear just above the page title.

You can hide a page or group of pages from your site's table of contents by opening the page’s Actions menu and toggling Hide page.

You can also set a page cover for each page of your documentation. When you click the Page cover option, a default cover will be added immediately. From here, you can:

Hover over the page cover and open the Actions menu . Click Reposition, then drag the image as you wish and click Save.

Remove the cover image Hover over the page cover and open the Actions menu , then click Remove.

Full width and hero width You can change the style of your page cover to span the full width of your screen or just the width of your content. Hover over the page cover and open the Actions menu , then choose your preferred option from the menu.

Company
Status
Contact
MRR

Table/Cards: Choose to display your data as either a table block or . GitBook populates both these blocks using the same data, so you can switch between them depending on the look and design you want.

To reorder columns, click and drag on the drag handle at the top of the column you want to move.

Hover over the row and click the Row options button that appears on the left of it to open the Row options menu. You’ll see a number of options:

GitBook currently supports .woff and .woff2. For other formats, please contact .

The content on your site comes from in your organization. You can link one or multiple spaces. GitBook will publish each one and handle the navigation between spaces.

To add a , click the Add section button underneath the table and choose a space to link as a section. The new section is then added to the table and will be available to visitors as a tab at the top of your site.

To add a , click the Add variant button in the section you’d like to add to, then choose a space to link. The new variant is then added to the list of variants within the chosen section and will be available to visitors in the variant dropdown on your site.

You can change the name and slug of each of sections and variants by clicking the Edit button in the table row of the item you’d like to edit. This will open a modal. Edit the field(s) you’d like to change, then click the Save button to save.

Changing a linked space's slug will change the space's canonical URL. GitBook will create an automatic redirect from the old URL to the new one. You can also .

To replace a section or variant, first delete it by clicking its Edit button, then click the Delete button in the lower left of the modal. Once the item is deleted, click the Add section or Add variant button to add it again.

Your site displays sections and variants in the order that they appear in your Site structure table. They can be reordered by grabbing the Drag handle and moving it up or down. The changed order will be reflected on your site immediately.

To set a space as default, click on the Actions menu in the space’s table row and then click Set as default.

Open the Actions menu for the space you want to remove and choose Remove.

To create reusable content, , then open the Actions menu , select Turn into, and choose Reusable content. You can also give your block a name to make it easier to find and reuse later.

Reusable content is like any other content — you can edit any instance directly if are enabled, or through if not. Any changes you make will be synced everywhere the content is used.

You can detach reusable content by opening the Actions menu and selecting Detach. Detaching will convert the content back to regular blocks.

You can delete reusable content from your space entirely, if you wish. Find the reusable content in the page’s table of contents, then open the Actions menu next to the content you’d like to delete, and select Delete.

Head to our guides to find a on setting up authenticated access and adaptive content with Auth0.

This guide takes your through setting up a protected sign-in screen for your docs. Before going through this guide, make sure you’ve first gone through .

Sign in to your Auth0 .

(optional) Enable the Include claims in JWT token option at the bottom of the dialog if you have enabled your site for .

To leverage the Adaptive Content capability in your authenticated access site, to include additional user information in the authentication token as claims.

These claims, represented as key-value pairs, are passed to GitBook and can be used to dynamically for your site visitors.

This page shows how to configure a custom domain and subdomain. If you would like to configure a custom subdirectory (such as example.com/docs), see the page.

SSL error: an error occurred when provisioning your SSL certificate.

When a custom domain is set for your organization, collection, or space, we set up an SSL certificate on our end so that your documentation will load securely, over HTTPS. This happens automatically when you set your custom domain — you do not need to purchase or configure an SSL certificate.

Occasionally errors occur at this stage, usually when the CNAME record for the custom domain hasn't propagated.

In these cases, we can recommend the following:

  1. Check that your CNAME record is set up correctly. Please review our page about configuring DNS to help you with this. If the CNAME record is incorrect, we won't be able to configure the SSL certificate and complete the custom domain set-up.

  2. Allow at least one hour between configuring the CNAME record and finalizing the custom domain setup.

  3. Verify if the CNAME has propagated. You can try using a third-party DNS lookup tool, such as , to find out what the servers believe to be correct for your correct CNAME record.

  4. If you are using Cloudflare, please confirm that you don’t have the record proxied .

Head to our guides to find a on setting up adaptive content with cookies.

This method only works if your site is served under a .

Method
Use-cases
Ease of setup
Security
Format

Data passed through public cookies must be defined in your visitor schema through an object.

To pass data to GitBook more securely, you’ll need to send the data as a from your application in a cookie named gitbook-visitor-token tied to your domain.

You have the option to import single or multiple pages using our built-in import tool — or .

Alternatively, you can always import a page or subpage by selecting New page > Import new pages in the , or opening the Actions menu for a page and choosing Import subpages.

For importing large volumes of content into GitBook, we recommend using . Unlike our integrated import tool, Git Sync is better suited for handling larger migrations efficiently.

You’ll find the essential steps to import your content below. For more detailed steps and a video demo, head over to our dedicated guide to .

If your content isn’t already in Markdown files, we recommend using a script (like ) or an online tool to convert your content.

To organize your content, create one or more spaces in GitBook as needed. Install the or integrations in your organization and configure it for those spaces. You’ll need to synchronize your space with the folder or repository you set up in the previous step.

Hiding or showing

Hiding or showing site

Hiding or showing site

Hiding or showing

Adding personalized content to

The condition editor is where you’ll set the conditions for showing or hiding a page, variant, or section. After opening the condition editor, you’ll be able to write your condition as an that will run against data coming from visitors to your site.

As you use the autocomplete, you'll notice that are also available to use. You can combine variables that you have defined together with claims that come from user data to write conditional expressions. For example, you could:

You can write many different kinds of expressions , as long as they are written in valid Javascript. For instance, you can combine multiple claims into the condition editor to match specific users by using the && or || operator. You can read more about operators .

To launch the condition editor for a page, head to the actions menu next to a page, and click Add condition. You can also launch the condition editor from a .

You can see which pages in your space have conditions set if the page has a page condition icon next to it.

To launch the condition editor for a variant, head to the actions menu next to a variant, and click Add condition.

You can see which variants in your docs have conditions set if the variant has a page condition icon next to it.

To launch the condition editor for a section, head to the actions menu next to a section, and click Add condition.

You can see which sections in your docs have conditions set if the section has a page condition icon next to it.

To launch the condition editor for a page header link, head to the actions menu next to a header link, and click Add condition.

You can see which links in your docs have conditions set if the section has a page condition icon next to it.

In addition to controlling the visibility of content, you can also use claims inline using , just like page and space variables.

To reference a claim inline using an expression, type / in the editor, then select Expression. Claims will be accessible in the expression editor as properties on visitor .

set the syntax
show line numbers
show a caption
wrap the lines
copy the contents of a code block to the clipboard
Prism
Test Drive Prism
our example above
connected to Assistant using an MCP server
our developer documentation
a link to an external page
link to a section on this page
a link that starts an email to a specific address

Cookies

Pass visitor data into your docs through a public or signed cookie.

URL

Pass visitor data into your docs through URL query parameters.

Feature flags

Pass visitor data into your docs through a feature flag provider.

Authenticated access

Pass visitor data into your docs through an authentication provider.

page.md
---
hidden: true
---
# Table

|   |   |   |
| - | - | - |
|   |   |   |
|   |   |   |
|   |   |   |
{% include "../../.gitbook/includes/reusable-block.md" %}
import Cookies from 'js-cookie';

const cookieData = {
  isLoggedIn: true,
  isBetaUser: false,
};

Cookies.set('gitbook-visitor-public', JSON.stringify(cookieData), {
  secure: true,
  domain: '*.acme.org',
})
import * as jose from 'jose';

import { Request, Response } from 'express';

import { getUserInfo } from '../services/user-info-service';
import { getFeatureFlags } from '../services/feature-flags-service';

const GITBOOK_VISITOR_SIGNING_KEY = process.env.GITBOOK_VISITOR_SIGNING_KEY;
const GITBOOK_VISITOR_COOKIE_NAME = 'gitbook-visitor-token';


export async function handleAppLoginRequest(req: Request, res: Response) {
   // Your business logic for handling the login request
   // For example, checking credentials and authenticating the user
   //
   // e,g:
   // const loggedInUser = await authenticateUser(req.body.username, req.body.password);

   // After authenticating the user, retrieve user information that you wish
   // to pass to GitBook from your database or user service.
   const userInfo = await getUserInfo(loggedInUser.id);
      
   // Build the JWT payload with the user's information
   const gitbookVisitorClaims = {
       firstName: userInfo.firstName,
       lastName: userInfo.lastName,
       isBetaUser: userInfo.isBetaUser
       products: userInfo.products.map((product) => product.name),
       featureFlags: await getFeatureFlags({userId: loggedInUser.id})
   }
   
   // Generate a signed JWT using the claims
   const gitbookVisitorJWT = await new jose.SignJWT(gitbookVisitorClaims)
     .setProtectedHeader({ alg: 'HS256' })
     .setIssuedAt()
     .setExpirationTime('2h') // abritary 2 hours expiration
     .sign(GITBOOK_VISITOR_SIGNING_KEY);
     
  // Include a `gitbook-visitor-token` cookie including the encoded JWT in your
  // login handler response
  res.cookie(GITBOOK_VISITOR_COOKIE_NAME, gitbookVisitorJWT, {
     httpOnly: true,
     secure: process.env.NODE_ENV === 'production',
     maxAge: 2 * 60 * 60 * 1000, // abritary 2 hours expiration
     domain: '.acme.org' //
  });
  
  // Rest of your login handler logic including redirecting the user to your app
  res.redirect('/'); // Example redirect
}
visitor.claims.isBetaUser == true
Setting a custom subdirectory

Publishing documentation

Publish your docs site to share with others.

Account management

Manage your organization, account, and billing.

Creating content

Edit pages, content and more in GitBook.

Cover
Cover
Cover
Cover

Git Sync

Sync with a Git repository to enable advanced workflows.

An image of GitBook icons demonstrating side by side column functionality
A GitBook screenshot showing the modal for generating API docs automatically
Drawing
A diagram drawn in GitBook
A GitBook screenshot showing footer customization settings
support@gitbook.com
full walk-through
dashboard
configure the Auth0 application
WhatsMyDNS
as explained here
unsigned
JSON Web Token
an entire Git repository using Git Sync
Markitdown
GitHub Sync
GitLab Sync
here

Ace AI – Design

In progress

$450

Discrete Data – API

$100

Signed cookie gitbook-visitor-token

API test credentials, customer identification

Require signing and a custom domain

JWT

Public cookie gitbook-visitor-public

Feature flags, roles

Easy to set up

JSON

Troubleshooting

I have a GitHub sync error

Be sure to only create readme files in your repo

When Git Sync is enabled, be careful not to create readme files through the GitBook UI. Creating readme files through the GitBook UI:

  • Creates duplicate README files in your repository

  • Causes rendering conflicts between GitBook and GitHub

  • May break builds and deployment processes

  • Results in unpredictable file precedence

This includes files named README.md, readme.md, Readme.md, and README (without extension). Instead, remember to manage your README file directly in your git repository.

Still facing errors?

Make sure that:‌

​GitBook is not using my docs folder

GitBook is creating new markdown files

When synchronizing and editing from GitBook with an existing Git repository, GitBook may create new markdown files instead of using the existing ones.‌ This is done to ensure GitBook doesn't overrite files that existed in your repository before.

Redirects aren't working correctly

When setting redirects, do not add any leading slashes. For example, trying to redirect to ./misc/support.md will not work.

It's also important to consider that as long as a page exists for a path, GitBook won’t be looking for a possible redirect. So if you're setting up a redirect for an old page to a new one, you will need to remove the old page in order for the redirect to work.

​My repository is not listed

For GitHub repositories

Make sure that you have installed the GitBook GitHub app to the correct locations (when installing the app, you can choose to install it to your personal GitHub, or to any organization you have permissions for) and that you have given the app the correct repository permissions.

For GitLab repositories

Make sure that your access token has been configured with the following access:

  • api

  • read_repository

  • write_repository

​Nothing happens on GitBook after adding a new file to my repository

This section specifically addresses problems when a SUMMARY.md file already exists

If your repository does not include a SUMMARY.md file, GitBook will automatically create one upon the first sync. This means that if you edited your content from GitBook at least once after setting up Git sync, GitBook should have created this file automatically.‌

This could either be because you created the file manually, or because you made an edit on GitBook and the GitBook to Git export phase of the sync created it for you.

GitHub preview is not showing

If your GitHub preview is not showing, it might be because your GitSync integration was configured before January 2022. Versions of GitSync configured before this date do not include GitHub Preview.

You should have received a notification requesting you to accept an updated permission request to enable read-only access to PRs.

In case you did not receive the notification, to troubleshoot you need to update to the new version:

  1. Uninstall the GitSync integration from your organization.

  2. Reinstall the new version with the updated permissions.

Please note that uninstalling the GitSync integration will require reconfiguring the integration again on any spaces it was previously connected to.

Potential duplicated accounts when signing in

This error usually occurs when the GitHub account that you use to set up the sync is already associated with a different GitBook user account.

A good way to identify which GitBook account the GitHub account is already linked to is:

  1. Log out from your current GitBook user session (i.e. name@email.com)

  2. Log out from any GitHub user sessions.

  3. Select the "Sign in with GitHub" option.

  4. Enter your GitHub credentials.

    1. Unlink the account from the "Third-party Login > GitHub" section in the Personal setting

    2. Delete the account altogether if you do not need it.

  5. Log out from the session.

  6. Log back in using your name@email.com GitBook account.

  7. Try to set up Git Sync again.

Inline content

Use the inline palette to add images, links, math & TeX, and more

The inline palette lets you quickly add extra content to your text block without moving your hands away from the keyboard. Simply hit / on any text block to open the inline palette. The forward slash will be replaced by the content you choose to insert.

Annotations

With annotations, you can add extra context to your words without breaking the reader’s train of thought. You can use them to explain the meaning of a word, insert extra information, and more. Readers can hover over the annotated text to show the annotation above the text.

Create an annotation

To create an annotation, select the text you would like to annotate and click the Annotate option in the context menu. Once you’ve written your annotation, click outside of it to continue writing in the text block.

Markdown representation

Here's a simple footnote,[^1] and here's a longer one.[^bignote]

[^1]: This is the first footnote.

[^bignote]: Here's one with multiple paragraphs and code.

    Indent paragraphs to include them in the footnote.

    `{ my code }`

    Add as many paragraphs as you like.

Images

Inline images will sit alongside your text on the page.

By default, images are set to their original size with a maximum width of 300px. You can change the size by clicking the image to open the formatting palette, then choosing one of the three options:

  1. Inline size: The image is proportionally sized to the font — great for icons and badges.

  2. Original size: The image will remain inline at its original size, with a maximum width of 300 pixels.

Emojis

You can add emojis by hitting / to open the inline palette. Alternatively, type : and a list of emojis will pop up directly in line — you can start typing the name of an emoji to narrow down the selection.

Links

You can insert three different types of links:

Relative links

Here’s how to insert a relative link:

  1. Click somewhere in your paragraph where you want to insert the link, or select some text.

  2. Hit / to open the inline palette and choose Link, click the Link button in the context menu, or hit ⌘ + K.

  3. Start typing the title of the page you want to link to.

  4. Select the page from the drop-down search results.

  5. Hit Enter.

Absolute links

Absolute links are external links that you can copy and paste into your content. They’re great when you want to link to something outside your documentation.

To insert an absolute link:

  1. Click somewhere in your paragraph where you want to insert the link, or select some text.

  2. Hit / to open the inline palette and choose Link, click the Link button in the context menu, or hit ⌘ + K.

  3. Paste the URL you want to link to.

  4. Hit Enter.

Why don't external links open in a new tab?

When you add a link to an external site in your docs, it will open in the same tab.

Email address mailto links

Email address mailto links are useful when you want your visitors to click on a link that will open up their default email client and fill in the To field with the email address of your link, so they can write an email to send.

Here’s how to insert an email address mailto link:

  1. Click somewhere in your paragraph where you want to insert the link, or select some text.

  2. Hit / to open the inline palette and choose Link, click the Link button in the context menu, or hit ⌘ + K.

  3. Paste or type mailto:something@address.com, replacing something@address.com with the email address you would like to use.

  4. Hit Enter.

Math & TeX

Buttons

Buttons are a great way to describe calls to action. You can use them to send users to other pages in GitBook, or to external URLs.

Buttons have both primary and secondary styles. Here are a couple of examples:

Sign up to GitBook Go to top

Icons

Expressions

Change requests

Collaborate on content edits through change requests

In a change request, you can edit, update and delete elements of your content, request reviews on your changes, then merge them back into your main version to apply all the changes you made.

Creating a change request

This will open a new change request, where you can edit or delete content as needed. Your changes are saved automatically, and other people can join you in a change request to collaborate in real-time.

Once you’re happy with your changes, you can use the button in the header bar to Request a review of your change request, or Merge it directly into the main branch.

Preview a change request

If your content is published using share links or authenticated access, the preview function won't appear.

Request a review on a change request

Request a review on your change request when you want to ask members of your team to check your content before you merge the changes into the main branch.

You can add a description to your change request to give your reviewers some context, and tag specific people that you want to check your work.

When you click Request a review, the change request’s status will change to In review, and anyone you tagged in your review request will get a notification.

If your changes don’t require a review, you can merge your changes into the main version directly instead.

If you don’t tag anyone in your review request, everyone with reviewer permissions or higher will get a notification about your request.

Reviewing a change request

If you get a request to review a change request, you'll be able to edit the content and leave feedback to make sure it's in good shape before it’s merged to the main version. You can either request changes if you think it still needs work, or approve the change request, to signal it's ready to merge.

Diff view

When you open the Changes tab in the space header, the diff view will appear. Diff view highlights every page and block that’s been edited in a change request. It will highlight any edited pages in the table of contents, and on the pages it will show the specific blocks that have been added, edited or removed.

There are two options when using diff view:

  1. Show all pages – This is the default mode for diff view, which will show both modified and non-modified pages in the table of contents. This is good for seeing which pages have been edited in the context of the entire space.

  2. Show only changed pages – This mode will show only the modified pages in the table of contents, which helps you focus on the changed content. This is particularly helpful in larger spaces with many pages and sub-pages.

You can switch to the Changes tab to check the diff view in any change request.

Merging a change request

Scheduling merges

As an example, adding this GitHub workflow would merege a change request once a week:

Handling merge conflicts

Sometimes, when you want to merge a change request, you may discover conflicts between the main content and the content you’re trying to merge. In the simplest form, a conflict is a piece of content that could not be merged automatically.

If this happens, you’ll be presented with a conflict alert, and a list of the conflicts you’ll need to resolve before continuing the merge.

Resolving merge conflicts

You have two options when it comes to resolving a merge conflict — selecting a version to merge or manually editing the content.

Selecting a version to merge

You can resolve a merge conflict by selecting a version you want to merge — either your incoming content, or the content that was previously there. This allows you to choose between one change and another — either your recent work, or the original content.

If you’re dealing with a merge conflict that can be resolved this way, you can select the version you want to keep, and the other version will be deleted.

Manually editing

If you don’t want to choose between versions, you can resolve a merge conflict by manually editing the conflict. You’ll be able to delete the blocks you don’t need, or even rewrite them entirely. Once you’re happy with the changes, you can move on to the next conflict until they’re all resolved.

Archiving a change request

If you decide not to merge a change request and want to remove it from the queue, you can archive it.

Public

Publish your docs publicly to the web.

Cover

Setting up Azure AD

Cover
Cover

Setting up Auth0

Cover

Setting up AWS Cognito

Setting up Azure AD

Configure Azure AD with authenticated access and adaptive content.

Cover
Cover

Setting up Auth0

Configure Auth0 with authenticated access and adaptive content.

Cover

Setting up AWS Cognito

Configure AWS Cognito with authenticated access and adaptive content.

Customize your site

Customize the look and feel of your site.

Cover
Cover

Configuring a subdirectory with Vercel

Cover

Spaces

Create a space to organize your documentation in one place.

Cover

Add an OpenAPI spec

Add API methods directly into your docs.

you choose to hide it
Add a sign in to your published documentation.
Ask questions or search through your content using the built in search bar.
Add an OpenAPI specification modal.
Set up Git Sync for your GitBook space.
The segment editor in GitBook.
Add structure to your docs with site sections.
Update the settings for your published documentation.

Properties can only be defined by the backend

Visitor can override the properties

Your repository has a README.md file at its root (or at the root folder specified in your .gitbook.yaml) that was created directly in your git repository. This file is required and is used as the homepage for your documentation. For more details, refer to our .

If you have YAML frontmatters in your Markdown files, make sure they are valid using a .​

By default, GitBook uses the root of the repository as a starting point. A specific directory can be specified to scope the markdown files. Take a look at our documentation on for more details.‌

The YAML file needs to be correctly formatted for the redirects to work. Errors such as incorrect indentation or whitespace can result in your redirects not working. can ensure that the redirects will work smoothly.

If after updating your repository by adding or modifying a markdown file, you do not see the update reflected on GitBook and the sidebar doesn’t indicate an error during the sync, your modified file(s) is probably not listed in .‌

The content of this file mirrors your on GitBook and is used during the Git to GitBook import phase of the sync to recreate your table of contents and re-conciliate upcoming updates from the repository with your existing content on GitBook.‌

If after ensuring that all your files are included in the SUMMARY.md file there’s still nothing happening on GitBook, don’t hesitate to for assistance.

Go to .

Once logged in, go to and either:

You can write content as to add them as annotations in GitBook.

Convert to block: This turns an inline image into a , which is as wide as your content.

offer more options, including more sizes and the ability to add a caption — but will not appear inline with your text.

Relative links are links created by linking to that already exist in your space. The advantage of using relative links is that if the page’s URL, name, or location changes, its reference will be kept up to date — so you’ll end up with fewer broken links.

GitBook follows this to support and ensure a consistent, inclusive experience for your readers.

Using this option, you can create an inline math formula in your content, like this: f(x)=x∗e2piiξxf(x) = x * e^{2 pi i \xi x}f(x)=x∗e2piiξx. We use the library to render formulas.

You can also insert by opening the command palette in an empty block and choosing the second Math & TeX option.

Icons allow you to add extra visual indications to your site. You can add them inline to paragraphs, inside a card, or anywhere else you need to add some flair. They will use the visual style defined in your .

Visit to explore the different icons available.

Expressions allow you to dynamically display content defined in a . Expressions can be inserted from the / menu. Once inserted, double clicking on the expression will bring up the expression editor, allowing you to reference and your variable.

A change request is a copy of your main content. It comes from the simple concept of , and will feel familiar to anyone who uses pull requests in GitHub or merge requests in GitLab.

Inside a space where live edits are disabled, click the Edit button in the to start a new change request.

You can preview the changes you've made in a change request through the preview button in the . This will switch you to a view with your docs and the proposed changes in a preview window, so you can see your changes in the entire context of your published documentation.

You can only preview change requests for spaces added to a .

Most reviews will take place in the change request’s , where collaborators can share feedback and have discussions about specific content blocks, or the change request as a whole.

Merging a change request will add the change request’s changes into the main branch of content, creating an updated version and a new entry in the space’s .

If you prefer to merge change requests at a scheduled time—for example, to align with your product release cycles—you can use external tools like GitHub Actions or automation platforms such as Zapier, connected through .

Only can merge change requests.

To archive a change request, first open it up. Then click the Actions menu next to the change request’s title and choose Archive. You can find and reopen archived change requests later by opening the Change Requests menu and selecting the Archived tab.

✅
❌
rena@ace.ai
dave@dd.inc
linter
Validating your YAML file
contact support
the Log in page
the account settings
Markdown footnotes
Relative links
Absolute links
Email address mailto links
W3C-recommended behavior
accessibility
KaTeX
Font Awesome
.github/workflows/scheduled-gitbook-merge.yml
name: Scheduled GitBook Merge

on:
  schedule:
    - cron: '0 9 * * 3'  # Runs every Wednesday at 09:00 UTC

jobs:
  merge_changes:
    runs-on: ubuntu-latest
    steps:
      - name: Merge Change Request
        run: |
          curl -X POST https://api.gitbook.com/v1/spaces/{space-id}/change-requests/{change-request-id}/merge \
          -H 'Authorization: Bearer YOUR_API_KEY' \
          -H 'Content-Type: application/json'

Start a change request

Collaborate on content with your team.

Cover

Setting up a custom backend

Configure a custom backend with authenticated access and adaptive content.

Setting up Okta

Configure Okta with authenticated access and adaptive content.

Cover
Cover
A screenshot showing a login screen for docs behind authenticated access
A GitBook screenshot showing the search bar
A GitBook screenshot showing the spaces sidebar
A GitBook screenshot showing the Add an OpenAPI specification modal
A GitBook screenshot showing the Git Sync setup
A GitBook screenshot showing the segment editor
A GitBook screenshot showing header customization settings
A GitBook screenshot showing site section structure
A GitBook screenshot showing site settings
A GitBook screenshot showing autolink setup
Autolink setup.
A GitBook screenshot showing the docs sites homepage
GitBook's docs sites homepage.
Cover

Configuring a subdirectory with Cloudflare

Setting up a custom backend

Setting up Okta

Cover
Cover
Cover

Setting up OIDC

A GitBook screenshot showing the publishing step of the docs site wizard
Publish your first site in just a few minutes using the docs site wizard.
A GitBook screenshot showing how to insert API references into the table of contents of a space
Insert API References in the table of contents of a Space.
A GitBook screenshot showing site sections on a docs site
Example of a GitBook site with site sections
A GitBook screenshot showing site redirects
Site redirects are useful when migrating documentation or restructuring content to avoid broken links, which can impact SEO.
A GitBook screenshot showing how to test a segment
Testing a segment in GitBook.

Pages

Create pages to split up and edit the content in your documentation.

Cover
Cover

Collections

Create collections to group spaces together.

Cover

Update your site's settings

Update settings related to your published site.

Cover

Add a custom domain

Set up a custom domain for your site.

A GitBook screenshot showing card images on mobile
On mobile, square or portrait images will displayed as shown on the left. Landscape images will be displayed as shown on the right.
A GitBook screenshot showing the Add variables screen. The variable Name box has been filled with the text ‘latest_version’ and the Value box has been filled with the text ‘v3.04.1’
You can add variables to a single page or an entire space. When you update the value of a variable, every instance of it will update.
A GitBook screenshot showing an expression block within the editor. The expression editor is open below it and the ‘space.vars.latest_version’ variable has been selected
You can add variables to your content within expresions. The expression editor offers autocomplete options to help you find the variable you need.
A GitBook screenshot showing the site insights dashboard
The site insights dashboard.
A GitBook screenshot showing a customized docs site
You can create all kinds of site designs using GitBook’s built-in customization options.
A GitBook screenshot showing GitLab Sync configuration options
GitLab Sync configuration options.
A GitBook screenshot showing the customization panel
The customization panel in GitBook.
branching
GitBook’s API
2MB
example.pdf
pdf
This is a caption on a file.

Extensions reference

The complete reference of OpenAPI extensions supported by GitBook.

You can enhance your OpenAPI specification using extensions—custom fields that start with the x- prefix. These extensions let you add extra information and tailor your API documentation to suit different needs.

GitBook allows you to adjust how your API looks and works on your published site through a range of different extensions you can add to your OpenAPI spec.

x-codeSamples

Show, hide, or include custom code samples for an OpenAPI block.

Fields

Field Name
Type
Description

lang

string

label

string

Code sample label, for example Node or Python2.7, optional, lang is used by default

source

string

Code sample source code

openapi.yaml
openapi: '3.0'
info: ...
tags: [...]
paths:
  /example:
    get:
      summary: Example summary
      description: Example description
      operationId: examplePath
      responses: [...]
      parameters: [...]
      x-codeSamples:
        - lang: 'cURL'
          label: 'CLI'
          source: |
            curl -L \
            -H 'Authorization: Bearer <token>' \
            'https://api.gitbook.com/v1/user'
x-enumDescriptions

Add an individual description for each of the enum values in your schema.

openapi.yaml
openapi: '3.0'
info: ...
components:
  schemas:
    project_status:
      type: string
      enum:
        - LIVE
        - PENDING
        - REJECTED
      x-enumDescriptions:
        LIVE: The project is live.
        PENDING: The project is pending approval.
        REJECTED: The project was rejected.
x-internal | x-gitbook-ignore

Hide an endpoint from your API reference.

openapi.yaml
openapi: '3.0'
info: ...
tags: [...]
paths:
  /example:
    get:
      summary: Example summary
      description: Example description
      operationId: examplePath
      responses: [...]
      parameters: [...]
      x-internal: true
x-stability

Mark endpoints that are unstable or in progress.

Supported values: experimental, alpha, beta.

openapi.yaml
openapi: '3.0'
info: ...
tags: [...]
paths:
  /example:
    get:
      summary: Example summary
      description: Example description
      operationId: examplePath
      x-stability: experimental
deprecated

Mark whether an endpoint is deprecated or not. Deprecated endpoints will give deprecation warnings in your published site.

openapi.yaml
openapi: '3.0'
info: ...
tags: [...]
paths:
  /example:
    get:
      summary: Example summary
      description: Example description
      operationId: examplePath
      responses: [...]
      parameters: [...]
      deprecated: true
x-deprecated-sunset

Add a sunset date to a deprecated operation.

Supported values: ISO 8601 format (YYYY-MM-DD)

openapi.yaml
openapi: '3.0'
info: ...
tags: [...]
paths:
  /example:
    get:
      summary: Example summary
      description: Example description
      operationId: examplePath
      responses: [...]
      parameters: [...]
      deprecated: true
      x-deprecated-sunset: 2030-12-05

Feature flags

Pass visitor data into your docs through a feature flag provider.

Using adaptive content with feature flags requires adding code to your application.

Currently, the GitBook helper only supports React based setups.

This allows you to read the feature flags users have access to in your product, as they read your docs. This is useful if you need to show documentation for features that are only available to a specific group of people.

LaunchDarkly

If you’re using LaunchDarkly feature flags in your product already, chances are you already have this package configured.

To pass you these feature flags as claims to GitBook, follow these steps:

1

Install the LaunchDarkly integration

2

Set up your project and access keys

3

Install and add the GitBook helper to your application

After setting up the LaunchDarkly integration, you’ll need to install the GitBook adaptive content helper in your application.

npm install @gitbook/adaptive
4

Configure your application

You’ll need to use the withLaunchDarkly helper with the LaunchDarkly React SDK to pass context into GitBook.

import { render } from 'react-dom';
import { withLaunchDarkly } from '@gitbook/adaptive';
import { asyncWithLDProvider, useLDClient } from 'launchdarkly-react-client-sdk';
import MyApplication from './MyApplication';

function PassFeatureFlagsToGitBookSite() {
    const ldClient = useLDClient();
    React.useEffect(() => {
        if (!ldClient) {
            return;
        }
        return withLaunchDarkly(ldClient);
    }, [ldClient]);
    return null;
}
(async () => {
    const LDProvider = await asyncWithLDProvider({
        clientSideID: 'client-side-id-123abc',
        context: {
            kind: 'user',
            key: 'user-key-123abc',
            name: 'Sandy Smith',
            email: 'sandy@example.com'
        },
        options: { /* ... */ }
    });
    render(
        <LDProvider>
            <PassFeatureFlagsToGitBookSite />
            <MyApplication />
        </LDProvider>,
        document.getElementById('reactDiv'),
    );
})();
5

Check your visitor schema

6

Personalize your content

After setting your visitor schema, you’re ready to tailor your docs experience for the users visiting your site, using the feature flags the user has access to.

Bucket

If you’re using Bucket feature flags in your product already, chances are you already have this package configured.

To pass you these feature flags as claims to GitBook, follow these steps:

1

Install the Bucket Integration

2

Set up your secret key

3

Install the GitBook helper to your application

After setting up the Bucket integration, you’ll need to install the GitBook adaptive content helper in your application.

npm install @gitbook/adaptive
4

Configure your application

You’ll need to use the withBucket helper with the Bucket React SDK to pass context into GitBook.

import { withBucket } from '@gitbook/adaptive';
import { BucketProvider, useClient } from '@bucketco/react-sdk';
import MyApplication from './MyApplication';

function PassFeatureFlagsToGitBookSite() {
    const client = useClient();
    React.useEffect(() => {
        if (!client) {
            return;
        }
        return withBucket(client);
    }, [client]);
    return null;
}
export function Application() {
    const currentUser = useLoggedInUser();
    const appConfig = useAppConfig();
    return (
        <BucketProvider
            publishableKey={appConfig.bucketCo.publishableKey}
            user={{
                id: currentUser.uid,
                email: currentUser.email ?? undefined,
                name: currentUser.displayName ?? '',
            }}
            company={{
                id: currentUser.company.id,
            }}
        >
            <PassFeatureFlagsToGitBookSite />
            <MyApplication />
        </BucketProvider>
    );
}
5

Check your visitor schema

6

Personalize your content

After setting your visitor schema, you’re ready to tailor your docs experience for the users visiting your site, using the feature flags the user has access to.

Feature flag values are evaluated on the client side, so avoid using this method to pass sensitive or security-critical data.

Setting up Azure AD

Set up an Azure AD login screen for visitors to your docs.

There is a known limitation with the Azure integration where heading URL fragments will be removed upon authentication. The user will still land on the correct page, but will be taken to the top of the page instead of the heading in the URL. Once a user is authenticated this behavior will no longer occur during a session and the user would be directed to the correct heading.

This is due to a security measure put in place by Microsoft.

Overview

To setup your GitBook site with authenticated access using Azure AD, the process looks as follows:

1

Create an Azure AD application registration in your Microsoft Entra ID admin dashboard.

2

Install the Azure AD integration and add the required configuration to your GitBook site.

3

Configure your Azure AD to work with Adaptive content in GitBook.

1. Create an app registration in Azure AD

Start by creating an app registration in your Microsoft Entra ID dashboard. This application registration will allow the GitBook Azure AD integration to request tokens to validate user identity before granting them access to your site.

  1. Head to Identity > Applications > App registrations from the left sidebar.

  2. Click on + New registration, and give your registration a name.

  3. Under Supported account types, select “Accounts in this organizational directory only (Default Directory only - Single tenant)”.

  4. Leave the Redirect URI field empty for now—you will need to fill this in later.

  5. Click Register to complete the app registration.

  6. You should then see your new app registration Overview screen. Copy and make note of the Application (client) ID and Directory (tenant) ID.

  7. Click on Add a certificate or secret. You should see the following Certificates & Secrets screen:

  8. Click on + New client secret.

  9. Enter suitable description for the secret and click Add.

  10. Copy and make note of the Value field (not the Secret ID) of the secret you just created.

2. Install and configure the Azure AD integration

Once you've created the Azure AD app registration, the next step is to install the Azure AD integration in GitBook and link it with your Azure application using the credentials you generated earlier:

  1. Click on the Integrations button in the top right from your site’s settings.

  2. Click on Authenticated Access from the categories in the sidebar.

  3. Select the Azure integration.

  4. Click Install on this site.

  5. After installing the integration on your site, you should see the integration's configuration screen:

  6. Copy the URL displayed at the bottom of the dialog.

  7. Head back to the Azure AD app registration you created earlier in the Microsoft Entra ID dashboard.

  8. Browse to Manage > Authentication in the sidebar.

  9. Click + Add a platform and select Web card in the panel that opens.

  10. Paste the GitBook integration URL you copied earlier in the Redirect URI field, and click “Configure”

  11. Head back to Azure integration installation screen in GitBook.

  12. Close the integration dialogs and click on the Settings tab in the site screen.

  13. Browse to Audience and select Authenticated access (if not already selected).

  14. Select Azure from the dropdown in the Authentication backend section.

  15. Click Update audience.

  16. Head to the site's overview screen and click Publish if the site is not already published.

Your site is now published behind authenticated access using your Azure AD as identity provider.

To test it out, click on Visit. You will be asked to sign in with Azure, which confirms that your site is published behind authenticated access using Azure.

Upon accessing the published content URL and after logging in with your Azure credentials, you may see a screen telling you that you need to "Request approval" from your admin. Your admin can grant this request by accessing the published content URL, logging in, and granting approval on behalf of the organization.

3. Configure Azure AD for Adaptive content (optional)

To leverage the Adaptive Content capability in your authenticated access site, configure the Azure AD app registration to include additional user information in the authentication token as claims.

Azure AD supports different types and levels of claims, each with its own method of setup:

  • Standard Claims: Common claims that may be included in tokens but are not always present by default.

Azure AD keeps token sizes optimized for performance. As a result, many claims are not included in the token by default and must be explicitly requested by the application. To ensure claims like email , groups or roles are included, they must be explicitly requested as optional claims.

  • Optional Claims: Additional predefined claims that can be enabled for an application.

  • Custom Claims: Claims sourced from custom user attributes in Azure AD or external systems via a custom claims provider.

For more details on how to include these different types of claims in the tokens generated by your Azure AD app, refer to the following Microsoft Entra documentation guides:

Images

Add an image or a gallery of images to a page, add image variants for dark mode, and resize and align images to your needs

You can insert images into your page, then choose their size and whether to align them to the left, center, or right. You can also optionally include alt text and/or a caption on your image block.

Tip: For accessibility purposes, we recommend setting alt text for your images.

Example of an image block

Uploading an image

There are two ways to add images to your content:

  1. Drag and drop the image from your file management system directly into an empty block on your page.

GitBook allows you to upload images up to 100MB per file.

Create an image gallery

Adding images for light & dark mode

You can set different images for the light and dark mode versions of your published site. GitBook will automatically display the correct image depending on the mode your visitor is in.

In the drop-down menu, choose Add image for Dark mode. Once you’ve set this, you can replace either image from this same menu.

Light and dark mode images through GitHub/GitLab Sync

You can also add light and dark mode images in Markdown through HTML syntax (<picture> and <source>).

For block images, use the <figure> HTML element with a <picture> and <source> in it:

For inline images (images that sit inline with text), use the <picture> HTML element with a <source> in it:

Resizing

  • Small – 25% of the image size

  • Medium – 50% of the image size

  • Large – 75% of the image size

  • Fit – Removes all size specifications and displays either at full size or capped at a maximum width of 735 pixels for larger images.

If your image is wider than the editor, GitBook will limit the image’s width to the editor’s width instead, and resizing will be based on this limit.

Note: When resizing images in an image gallery, the results can differ from resizing an individual image.

Resizing images through Git Sync

If you want more control over the sizing of your image, you can specify the exact size using Markdown in GitHub or GitLab.

When we export an image, we use the HTML tag <img/>. As per the specifications, we can specify the dimensions of the image using the width and height attributes, which only accept values in pixels or a combination of a number and a % sign. Valid variants for specifying the image dimensions are: <img width="100" /> Sets the image to 100 pixels wide <img width="100%" /> Sets the image to full size (although this will be limited by the editor)

Aligning images

By default, image blocks will show your image at its full size, aligned centrally.

Representation in Markdown

conditionally format

Privately with share links

Publish your docs with private share links.

Cover

GitBook homepage

Visit our website and find out more about GitBook.

Cover
Cover

Developer docs

Build you own GitBook integration!

let greeting = function (name) {
  console.log(`Hello, ${name}!`);
};
greeting("Anna");
Invite your team to GitBook to collaborate on pages, spaces, and published sites.
Personalize your user’s documentation experience through adaptive content
Write with GitBook AI.
GitHub Sync configuration options.
GitBook's built in content blocks.
Write Markdown in GitBook.
On desktop, all card images will display in a landscape 16:9 ratio, regardless of their dimensions. We recommend using the same dimensions for consistency.

Head to our to learn more about using OpenAPI extensions to configure your documentation.

x-page-title | x-displayName

Change the display name of a tag used in the navigation and page title.

x-page-description

Add a description to the page.

x-page-icon

Add a Font Awesome icon to the page. See available icons .

x-parent | parent

Add hierarchy to tags to organize your pages in GitBook.

x-hideTryItPanel

Show or hide the “Test it” button for an OpenAPI block.

Code sample language. Value should be one of the following

GitBook provides helper functions and integrations for popular feature flag service providers like and .

LaunchDarkly allows you to send feature flag access as claims through the and GitBook’s package.

To get started, you’ll first need to into your GitBook site.

Add your project key and your service access token from your to the integration’s configuration.

A is required in order for your claims to be able to be read in your published site. Installing and configuring the LaunchDarkly integration should automatically set your visitor schema for you.

Any feature flag value available in LaunchDarkly will be exposed as part of the visitor schema under the unsigned.launchdarkly.flags object. Read more about unsigned claims .

Head to to learn more about personalizing your docs for your users.

Bucket allows you to send feature flag access as claims through the and GitBook’s package.

To get started, you’ll first need to into your GitBook site.

Add your secret key from your to the integration’s configuration.

A is required in order for your claims to be able to be read in your published site. Installing and configuring the Bucket integration should automatically set your visitor schema for you.

Any feature flag value available in Bucket will be exposed as part of the visitor schema under the unsigned.bucket.flags object. Read more about unsigned claims .

Head to to learn more about personalizing your docs for your users.

This guide takes you through setting up a protected sign-in screen for your docs. Before going through this guide, make sure you’ve first gone through the process of .

Sign in to your Microsoft Entra ID admin .

Navigate to the site where you’ve and want to use Azure AD as the identity provider.

Enter the Client ID, Tenant ID, and Client Secret values you copied after earlier, and click “Save”.

These claims, represented as key-value pairs, are passed to GitBook and can be used to dynamically for your site visitors.

After setting up and configuring the right claims to send to GitBook, head to “” to continue configuring your site.

to your page and use the Select images side panel that appears on the right of the window.

If you follow the second process, you can choose to upload a file, select a previously-uploaded file, paste an image URL or add an image from using the built-in search.

Adding more than one image to an image block will create a gallery. To do this, open the block’s Options menu and choose Add images… to open the Select images side panel again.

To delete an image from a gallery, open the Actions menu on the image you want to delete and press the Delete ⌫ key.

To add an image for dark mode, hover over your image, open the Actions menu and click Replace image .

Note: GitBook doesn’t currently support light and dark mode images for certain cases, including page covers or image covers on .

Note: We don’t yet support through #gh-dark-mode-only or #gh-light-mode-only.

To resize your image, hover over it and open the Actions menu . Click the Size button to change the size of your image from the available options.

You can make image blocks by clicking on the Options menu next to the block and choosing Full width.

To change the alignment of an image, open the block’s Options menu and choose the alignment you want. This will only affect images that are narrower than the editor, or images you’ve .

LaunchDarkly
Bucket
install the LaunchDarkly integration
LaunchDarkly settings
@bucketco/react-sdk
@gitbook/adaptive
install the Bucket integration
Bucket settings
Create an app registration in Azure AD
Install and configure the Azure AD integration on your site
Configure Azure AD for adaptive content (optional)
dashboard
creating the Azure AD app registration
User Attributes
Optional Claims
Custom Claims
Text before

<figure>
  <picture>
    <source
      srcset="
        https://user-images.githubusercontent.com/3369400/139447912-e0f43f33-6d9f-45f8-be46-2df5bbc91289.png
      "
      media="(prefers-color-scheme: dark)"
    />
    <img
      src="https://user-images.githubusercontent.com/3369400/139448065-39a229ba-4b06-434b-bc67-616e2ed80c8f.png"
      alt="GitHub logo"
    />
  </picture>
  <figcaption>Caption text</figcaption>
</figure>

Text after
Text before the image
<picture
  ><source
    srcset="
      https://user-images.githubusercontent.com/3369400/139447912-e0f43f33-6d9f-45f8-be46-2df5bbc91289.png
    "
    media="(prefers-color-scheme: dark)" />
  <img
    src="https://user-images.githubusercontent.com/3369400/139448065-39a229ba-4b06-434b-bc67-616e2ed80c8f.png"
    alt="The GitHub Logo"
/></picture>
and text after the image
//Simple Block
![](https://gitbook.com/images/gitbook.png)

//Block with Caption
![The GitBook Logo](https://gitbook.com/images/gitbook.png)

//Block with Alt text

<figure><img src="https://gitbook.com/images/gitbook.png" alt="The GitBook Logo"></figure>

//Block with Caption and Alt text

<figure><img src="https://gitbook.com/images/gitbook.png" alt="The GitBook Logo"><figcaption><p>GitBook Logo</p></figcaption></figure>

//Block with different image for dark and light mode, with caption

<figure>
  <picture>
    <source srcset="https://user-images.githubusercontent.com/3369400/139447912-e0f43f33-6d9f-45f8-be46-2df5bbc91289.png" media="(prefers-color-scheme: dark)">
    <img src="https://user-images.githubusercontent.com/3369400/139448065-39a229ba-4b06-434b-bc67-616e2ed80c8f.png" alt="GitHub logo">
  </picture>
  <figcaption>Caption text</figcaption>
</figure>

Authenticated Access

Protect your published docs behind an OAuth sign in.

Cover

Sign up to GitBook

Click here to get started for free.

Cover
A GitBook screenshot showing the invite team dialog
A GitBook screenshot showing adaptive content controls
A GitBook screenshot showing the AI writing options
A GitBook screenshot showing GitHub Sync configuration options
A GitBook screenshot showing the available content blocks
An image containing the markdown logo
A GitBook screenshot showing card images on desktop
A GitBook screenshot showing a docs site's structure
A GitBook screenshot showing the enable adaptive content toggle
Enable adaptive content
GitBook Assistant
The GitBook Assistant
A GitBook screenshot showing title, icon and logo customization
A GitBook screenshot showing the import panel
The import panel in GitBook.
A GitBook screenshot showing theme options
A GitBook screenshot showing color customization
A GitBook screenshot showing an empty page listed in the table of contents
An empty page in GitBook. You can see it listed in the table of contents on the left-hand side.

Add a new pet to the store.

post

Add a new pet to the store.

Authorizations
Body
idinteger · int64OptionalExample: 10
namestringRequiredExample: doggie
photoUrlsstring[]Required
statusstring · enumOptional

pet status in the store

Possible values:
Responses
200
Successful operation
400
Invalid input
422
Validation exception
default
Unexpected error
post
POST /api/v3/pet HTTP/1.1
Host: 
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 133

{
  "id": 10,
  "name": "doggie",
  "category": {
    "id": 1,
    "name": "Dogs"
  },
  "photoUrls": [
    "text"
  ],
  "tags": [
    {
      "id": 1,
      "name": "text"
    }
  ],
  "status": "available"
}
{
  "id": 10,
  "name": "doggie",
  "category": {
    "id": 1,
    "name": "Dogs"
  },
  "photoUrls": [
    "text"
  ],
  "tags": [
    {
      "id": 1,
      "name": "text"
    }
  ],
  "status": "available"
}
list
Unsplash
GitHub-only syntax
resized

Setting up a custom backend

Set up an custom login screen for visitors to your docs.

This guide walks you through setting up a protected sign-in screen for your GitBook documentation site using your own custom authentication backend.

Overview

To setup a custom authentication system for your GitBook site, follow these key steps:

1

Implement a backend that prompts users to login and authenticate them.

2

Create a JWT token and sign it with your site’s private key.

3

Configure a URL to be used when an unauthenticated visitor access your site.

4

Configure your backend to handle authentication across multiple GitBook sites.

5

Configure your backend to work with adaptive content in GitBook.

1. Create a custom backend to authenticate your users

In order to start authenticating users before they can visit your documentation, you’ll need to set up a server that can handle login and authentication of users.

Your backend should:

  • Prompt users to log in using your preferred authentication method.

  • Validate user credentials and authenticate them.

  • Generate and sign a JSON Web Token (JWT) upon successful authentication.

  • Redirect users to GitBook with the JWT included in the URL.

2. Sign and pass a JWT token to GitBook

The following example should demonstrate how a login request handler in your custom backend could look like:

index.ts
import { Request, Response } from 'express';
import * as jose from 'jose';

import { getUserInfo } from '../services/user-info-service';
import { getFeatureFlags } from '../services/feature-flags-service';

const GITBOOK_VISITOR_SIGNING_KEY = process.env.GITBOOK_VISITOR_SIGNING_KEY!;
const GITBOOK_DOCS_URL = 'https://mycompany.gitbook.io/myspace';

export async function handleAppLoginRequest(req: Request, res: Response) {
    // Your business logic for handling the login request
    // For example, checking credentials and authenticating the user
    //
    // e.g.:
    // const loggedInUser = await authenticateUser(req.body.username, req.body.password);
    
    // Generate a signed JWT
    const gitbookVisitorJWT = await new jose.SignJWT({})
        .setProtectedHeader({ alg: 'HS256' })
        .setIssuedAt()
        .setExpirationTime('2h') // Arbitrary 2-hour expiration
        .sign(new TextEncoder().encode(GITBOOK_VISITOR_SIGNING_KEY));
    
    // Redirect the user to GitBook with the JWT token in the URL
    const redirectURL = `${GITBOOK_DOCS_URL}/?jwt_token=${gitbookVisitorJWT}`;
    res.redirect(redirectURL);
}

3. Configure a fallback URL

The fallback URL is used when an unauthenticated visitor tries to access your protected site. GitBook will then redirect them to this URL.

This URL should point to a handler in your custom backend, where you can prompt them to login, authenticate and then redirect them back to your site with the JWT included in the URL.

For instance, if your login screen is located at https://example.com/login, you should include this value as the fallback URL.

You can configure this fallback URL within your site’s audience settings under the "Authenticated access" tab.

When redirecting to the fallback URL, GitBook includes a location query parameter to the fallback URL that you can leverage in your handler to redirect the user to the original location of the user:

const gitbookVisitorJWT = await new jose.SignJWT({})
    .setProtectedHeader({ alg: 'HS256' })
    .setIssuedAt()
    .setExpirationTime('2h') // Arbitrary 2-hour expiration
    .sign(new TextEncoder().encode(GITBOOK_VISITOR_SIGNING_KEY));
    
// Redirect to the original GitBook docs URL with the JWT included as jwt_token query parameter
// If a location is provided, the user will be redirected back to their original destination
const redirectURL = `${GITBOOK_DOCS_URL}/${req.query.location || ''}?jwt_token=${gitbookVisitorJWT}`;
res.redirect(redirectURL);

Because GitBook relies on the location search param - you cannot use it in your fallback URL. For example, https://auth.gitbook.com/?location=something is not a valid fallback URL.

4. Set up multi-tenant authenticated access (optional)

If you’re using GitBook as a platform to provide content to your different customers, you probably need to set up multi-tenant authenticated access. Your authentication backend needs to be responsible for handling authentication across multiple different sites. This is possible in GitBook with a few small tweaks to your custom authentication backend code.

Adding all tenants to your authentication server

Your authentication backend will need to know the JWT signing keys and the URLs of all the GitBook sites you expect it to handle. If you have two sites in your organization for Customer A and Customer B, you can imagine your authentication code storing such mapping:

const CUSTOMER_A = {
  jwtSigningKey: 'aaa-aaa-aaa-aaa',
  url: 'https://mycompany.gitbook.io/customer-a'
};

const CUSTOMER_B = {
  jwtSigningKey: 'bbb-bbb-bbb-bbb',
  url: 'https://mycompany.gitbook.io/customer-b'
};

Giving your authentication server additional context

When GitBook is unable to authenticate a user's request, it redirects them to the fallback URL. This URL points to your authentication backend, which is responsible for authenticating the user and redirecting them back to the requested content.

To support multiple tenants, your authentication backend needs to know which GitBook site the user is meant to access. This information can be passed in the fallback URL.

So for example, you could setup the fallback URLs for each sites as follow:

GitBook Site
Fallback URL

Customer A site

https://auth-backend.acme.org/login?site=customer-a

Customer B site

https://auth-backend.acme.org/login?site=customer-b

Your authentication backend can then check this information and handle the redirection to the correct site accordingly:

const customerInfo = req.query.site === 'customer-a' ? CUSTOMER_A : CUSTOMER_B;
  
const gitbookVisitorJWT = await new jose.SignJWT({})
    .setProtectedHeader({ alg: 'HS256' })
    .setIssuedAt()
    .setExpirationTime('2h') // Arbitrary 2-hour expiration
    .sign(new TextEncoder().encode(customerInfo.jwtSigningKey));
    
// Redirect to the original GitBook docs URL with the JWT included as jwt_token query parameter
// If a location is provided, the user will be redirected back to their original destination
const redirectURL = `${customerInfo.url}/${req.query.location || ''}?jwt_token=${gitbookVisitorJWT}`;
res.redirect(redirectURL);

5. Configure your backend for adaptive content (optional)

To leverage the Adaptive Content capability in your authenticated access setup, you can include additional user attributes (claims) in the payload of the JWT that your custom backend generates and include in the URL when redirecting the user to the site.

Putting it all together, the following code example demonstrates how you could include these claims in the JWT, which can then be used by GitBook to adapt content for your visitors:

index.ts
import { Request, Response } from 'express';
import * as jose from 'jose';

import { getUserInfo } from '../services/user-info-service';
import { getFeatureFlags } from '../services/feature-flags-service';

const GITBOOK_VISITOR_SIGNING_KEY = process.env.GITBOOK_VISITOR_SIGNING_KEY!;
const GITBOOK_DOCS_URL = 'https://mycompany.gitbook.io/myspace';

export async function handleAppLoginRequest(req: Request, res: Response) {
    // Your business logic for handling the login request
    // For example, checking credentials and authenticating the user
    //
    // e.g.:
    // const loggedInUser = await authenticateUser(req.body.username, req.body.password);
    
    // For the purpose of this example, assume a logged-in user object
    const loggedInUser = { id: '12345' }; // Replace with actual authentication logic

    // Retrieve user information to pass to GitBook
    const userInfo = await getUserInfo(loggedInUser.id);
    
    // Generate a signed JWT and include the user attributes as claims
    const gitbookVisitorClaims = {
        firstName: userInfo.firstName,
        lastName: userInfo.lastName,
        isBetaUser: userInfo.isBetaUser,
        products: userInfo.products.map((product) => product.name),
        featureFlags: await getFeatureFlags({ userId: loggedInUser.id })
    };
    
    const gitbookVisitorJWT = await new jose.SignJWT(gitbookVisitorClaims)
        .setProtectedHeader({ alg: 'HS256' })
        .setIssuedAt()
        .setExpirationTime('2h') // Arbitrary 2-hour expiration
        .sign(new TextEncoder().encode(GITBOOK_VISITOR_SIGNING_KEY));
    
    // Redirect the user to GitBook with the JWT token in the URL
    const redirectURL = `${GITBOOK_DOCS_URL}/?jwt_token=${gitbookVisitorJWT}`;
    res.redirect(redirectURL);
}
here
launchdarkly-react-client-sdk
A photograph taken from space looking back towards Earth. A satellite is in the foreground, and in the background is an ocean-covered part of our planet with patchy clouds.
Choose the search experience you want in your published docs
Create reusable content within a space.
The structure of a published docs site.
Update a site section or variant.

This feature is available on .

This feature is available on .

This feature is available on .

This feature is available on .

Edit your content through change requests.

This guide takes you through setting up a protected sign-in screen for your docs. Before going through this guide, make sure you’ve first gone through the process of .

If you are using one of the authentication providers we support or have an (OIDC) compliant backend, check out our integration guides for a more streamlined setup: | | | |

Once your backend authenticates a user, it must generate a JWT and pass it to GitBook when redirecting them to your site. The token should be signed using the private key provided in your site's audience settings after .

These claims when included in the JWT are used by GitBook to dynamically for your site visitors.

After setting up and configuring the right claims to send to GitBook, head to “” to continue configuring your site.

Create a custom backend to authenticate your users
Sign and pass a JWT token to GitBook
Configure a fallback URL
Set up multi-tenant authenticated access (optional)
Configure your backend for adaptive content (optional)

Content variants

Publish multiple versions of the same content — ideal for localization, versioning, and more.

Site sections

Split your site into distinct parts — ideal for multiple products or parts of your organization.

Cover
Cover
A GitBook screenshot showing sidebar style options
A GitBook screenshot showing site style settings
A GitBook screenshot showing reusable content
A GitBook screenshot showing a docs site's structure
A GitBook screenshot showing how to edit a variant
A GitBook screenshot showing the site settings overview
A GitBook screenshot showing the change requests panel
A GitBook screenshot showing inline content options
Add inline elements to your content.
**Bold**
_Italic_
~~Strikethrough~~
`Code`
openapi.yaml
openapi: '3.0'
info: ...
tags:
  - name: users
    x-page-title: Users
openapi.yaml
openapi: '3.0'
info: ...
tags:
  - name: "users"
    x-page-title: "Users"
    x-page-description: "Manage user accounts and profiles."
openapi.yaml
openapi: '3.0'
info: ...
tags:
  - name: "users"
    x-page-title: "Users"
    x-page-description: "Manage user accounts and profiles."
    x-page-icon: "user"
openapi.yaml
openapi: '3.0'
info: ...
tags:
  - name: organization
  - name: admin
    x-parent: organization
  - name: user
    x-parent: organization
openapi.yaml
openapi: '3.0'
info: ...
tags: [...]
paths:
  /example:
    get:
      summary: Example summary
      description: Example description
      operationId: examplePath
      responses: [...]
      parameters: [...]
      x-hideTryItPanel: true
Pro and Enterprise plans
Pro and Enterprise plans
Pro and Enterprise plans
Pro and Enterprise plans
OpenID Connect

This feature is available on the .

This feature is available on the .

This feature is available on the .

This feature is available on the .

This feature is available on the .

This feature is available on the .

This feature is available on the .

Certain customization features are only available on .

Certain customization features are only available on .

This feature is still under development and coming soon to the .

Please sign up for the waitlist at

This feature is still under development and coming soon to the .

Please sign up for the waitlist at

This feature is still under development and coming soon to the .

Please sign up for the waitlist at

This feature is available on .

This feature is available on .

This feature is available on .

This feature is available on .

This feature is available on .

This feature is available on .

Overview of the newly created app registration.
Ultimate site plan
Ultimate site plan
Ultimate site plan
Ultimate site plan
Ultimate site plan
Ultimate site plan
Ultimate site plan
Premium and Ultimate site plans
Premium and Ultimate site plans
An Azure screenshot showing the app registration overview
A GitBook screenshot showing installation of the Azure AD integration
A GitBook screenshot showing authenticated access settings
A GitBook screenshot showing the Azure AD configuration dialog
Ultimate site plan
https://www.gitbook.com/#alpha-waitlist
Ultimate site plan
https://www.gitbook.com/#alpha-waitlist
Ultimate site plan
https://www.gitbook.com/#alpha-waitlist
Premium and Ultimate site plans
Premium and Ultimate site plans
Premium and Ultimate site plans
Premium and Ultimate site plans
Premium and Ultimate site plans
Premium and Ultimate site plans
Register an app for the GitBook VA integration.
Add a certificate or secret.
An Azure screenshot showing how to register an Azure AD app
An Azure screenshot showing where to add a certificate or secret
An Azure screenshot showing where to enter the redirect URI
An Azure screenshot showing authentication platform settings
A GitBook screenshot showing the AWS Cognito integration install screen
A GitBook screenshot showing the OIDC configuration screen
A GitBook screenshot showing the site settings page
greeting = fn name -> IO.puts("Hello, #{name}!") end
greeting.("Anna")
A GitBook screenshot showing the Okta credentials modal
An Okta screenshot showing the create app integration screen
A screenshot showing creation of an OAuth client in an identity provider
An Okta screenshot showing where to copy client credentials
A GitBook screenshot showing the AWS Cognito configuration screen
An Okta screenshot showing the integration setup
Configure a fallback URL
A GitBook screenshot showing where to configure a fallback URL
A GitBook screenshot showing the OIDC integration installation
An Okta screenshot showing the sign-in redirect URI configuration
Resize an image
A GitBook screenshot showing how to resize an image
greeting = lambda {|name| puts "Hello, #{name}!"}
greeting.("Anna")