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:

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 pages in GitBook matches the order of tags in your OpenAPI tags array:

openapi.yaml
tags:
  - name: pet
  - name: store
  - name: user

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

You can enhance pages with titles, icons, and descriptions using 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 also supports documenting webhook endpoints when using OpenAPI 3.1.

You can define your webhooks directly in your OpenAPI file using the webhooks field, which works similarly to paths for regular API endpoints:

Last updated

Was this helpful?