For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

To choose between One page per tag and One page per operation, see OpenAPI layouts.

This page explains how to control the generated navigation with tags.

Use tags to organize generated pages

GitBook uses tags to organize generated API reference pages in both layouts.

With One page per tag, GitBook creates one page for each tag. With One page per operation, GitBook creates one page for each operation and uses tags to group those pages in the table of contents.

To group related operations, assign the same tag to each operation:

openapi.yaml
paths:
  /pet:
    put:
      tags:
        - pet
      summary: Update an existing pet.
      description: Update an existing pet by Id.
      operationId: updatePet

Reorder pages in your table of contents

The order of generated tag pages or tag groups 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. This works with both page structures:

The above example creates a table of contents like this:

If GitBook generates a parent page and that page has no description, it shows a card-based layout for its sub-pages.

Customize page titles, icons, and descriptions

You can enhance generated tag pages and navigation labels with custom extensions in the tags section. All Font Awesome icons are supported via x-page-icon.

Build rich descriptions with GitBook Blocks

Tag description fields support GitBook markdown, including advanced blocks like tabs:

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:

Document a webhook endpoint

GitBook supports OpenAPI 3.1, including webhook endpoints.

The webhooks field is part of OpenAPI 3.1, so your specification must declare an OpenAPI 3.1 version. You can define webhooks directly in your OpenAPI file, and GitBook renders them alongside your other API operations. For version support across OpenAPI docs, see OpenAPI compatibility.

Last updated

Was this helpful?

Powered by GitBook