Structuring your API reference
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
All operations with the same tag will appear on the same page in your documentation.
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
Nest pages into groups
To build multi-level navigation, usex-parent (or parent in OpenAPI 3.2+) in tags to define hierarchy:
openapi.yaml
If a page has no description, GitBook will automatically show a card-based layout for its sub-pages, making it easy to navigate to child 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 viax-page-icon.
openapi.yaml
x-page-title(orx-displayName) - Override the display namex-page-icon- Add a Font Awesome iconx-page-description- Add a subtitle descriptiondescription- Page content shown below operations
Build rich descriptions with GitBook blocks
Tag description fields support GitBook markdown, including advanced blocks like tabs, hints, and code groups:openapi.yaml
Highlight schemas
You can highlight a schema in a GitBook description by using theopenapi-schemas block. Here’s an example that highlights the “Pet” schema from the “petstore” specification:
openapi.yaml
Document webhook endpoints
GitBook also supports documenting webhook endpoints when using OpenAPI 3.1. You can define your webhooks directly in your OpenAPI file using thewebhooks field, which works similarly to paths for regular API endpoints:
openapi.yaml
Webhook support requires OpenAPI 3.1 or later. They will not work with Swagger 2.0 or OpenAPI 3.0 specifications.
Best practices
Use meaningful tag names
Choose tag names that clearly describe the resource or feature area. These become page titles in your documentation.
Add descriptions to all tags
Provide context for each section of your API with tag descriptions. This content appears at the top of each generated page.
Organize hierarchically
Use parent-child relationships to create logical groupings and improve navigation for complex APIs.