Extensions reference
You can enhance your OpenAPI specification using extensions—custom fields that start with thex- 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.
Head to our guides section to learn more about using OpenAPI extensions to configure your documentation.
Page customization
x-page-title | x-displayName
Change the display name of a tag used in the navigation and page title.openapi.yaml
x-page-description
Add a description to the page.openapi.yaml
x-page-icon
Add a Font Awesome icon to the page. See available icons at fontawesome.com/search.openapi.yaml
parent | x-parent
Add hierarchy to tags to organize your pages in GitBook.parent is the official property name in OpenAPI 3.2+. If using OpenAPI versions prior to 3.2 (3.0.x, 3.1.x), use x-parent instead.openapi.yaml
Operation visibility
x-hideTryItPanel
Show or hide the “Test it” button for an OpenAPI block.openapi.yaml
x-internal | x-gitbook-ignore
Hide an endpoint from your API reference.openapi.yaml
Code samples
x-codeSamples
Show, hide, or include custom code samples for an OpenAPI block. Fields:| Field Name | Type | Description |
|---|---|---|
lang | string | Code sample language. Value should be one of the linguist popular languages |
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
Enum descriptions
x-enumDescriptions
Add an individual description for each of theenum values in your schema.
openapi.yaml
Operation lifecycle
x-stability
Mark endpoints that are unstable or in progress. Supported values:experimental, alpha, beta
openapi.yaml
deprecated
Mark whether an endpoint is deprecated or not. Deprecated endpoints will give deprecation warnings in your published site.openapi.yaml
x-deprecated-sunset
Add a sunset date to a deprecated operation. Supported values: ISO 8601 format (YYYY-MM-DD)openapi.yaml
Response customization
x-hideSample
Hide response samples for specific response codes.openapi.yaml
Authentication customization
x-gitbook-prefix
Customize the authorization prefix shown in security schemes.openapi.yaml
x-gitbook-token-placeholder
Set the default token placeholder value shown in examples.openapi.yaml
Extension compatibility matrix
| Extension | Applies To | OpenAPI Versions | Description |
|---|---|---|---|
x-page-title / x-displayName | Tags | 2.0, 3.0, 3.1, 3.2 | Custom page title |
x-page-description | Tags | 2.0, 3.0, 3.1, 3.2 | Page subtitle |
x-page-icon | Tags | 2.0, 3.0, 3.1, 3.2 | Font Awesome icon |
parent / x-parent | Tags | 3.2 / 2.0, 3.0, 3.1 | Hierarchical navigation |
x-hideTryItPanel | Operations, Root | 2.0, 3.0, 3.1, 3.2 | Hide test functionality |
x-codeSamples | Operations | 2.0, 3.0, 3.1, 3.2 | Custom code examples |
x-enumDescriptions | Schemas | 2.0, 3.0, 3.1, 3.2 | Enum value descriptions |
x-internal / x-gitbook-ignore | Operations | 2.0, 3.0, 3.1, 3.2 | Hide from docs |
x-stability | Operations | 2.0, 3.0, 3.1, 3.2 | Lifecycle status |
deprecated | Operations | 2.0, 3.0, 3.1, 3.2 | Deprecation flag |
x-deprecated-sunset | Operations | 2.0, 3.0, 3.1, 3.2 | Deprecation date |
x-hideSample | Responses | 2.0, 3.0, 3.1, 3.2 | Hide response samples |
x-gitbook-prefix | Security Schemes | 2.0, 3.0, 3.1, 3.2 | Auth prefix |
x-gitbook-token-placeholder | Security Schemes | 2.0, 3.0, 3.1, 3.2 | Token placeholder |
Further reading
Structuring API reference
Learn how to organize your API documentation
Custom code samples
Add language-specific examples
Managing operations
Control operation visibility and lifecycle
Test it button
Configure interactive testing