codeExtensions 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.

Head to our guides section to learn more about using OpenAPI extensions to configure your documentation.

chevron-rightx-page-title | x-displayNamehashtag

Change the display name of a tag used in the navigation and page title.

openapi.yaml
openapi: '3.0'
info: ...
tags:
  - name: users
    x-page-title: Users
chevron-rightx-page-descriptionhashtag

Add a description to the page.

openapi.yaml
openapi: '3.0'
info: ...
tags:
  - name: "users"
    x-page-title: "Users"
    x-page-description: "Manage user accounts and profiles."
chevron-rightx-page-iconhashtag

Add a Font Awesome icon to the page. See available icons herearrow-up-right.

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"
chevron-rightx-parent | parenthashtag

Add hierarchy to tags to organize your pages in GitBook.

openapi.yaml
openapi: '3.0'
info: ...
tags:
  - name: organization
  - name: admin
    x-parent: organization
  - name: user
    x-parent: organization
chevron-rightx-hideTryItPanelhashtag

Show or hide the “Test it” button for an OpenAPI block.

openapi.yaml
openapi: '3.0'
info: ...
tags: [...]
paths:
  /example:
    get:
      summary: Example summary
      description: Example description
      operationId: examplePath
      responses: [...]
      parameters: [...]
      x-hideTryItPanel: true
chevron-rightx-codeSampleshashtag

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 following listarrow-up-right

label

string

Code sample label, for example Node or Python2.7, optional, lang is used by default

source

string

Code sample source code

chevron-rightx-enumDescriptionshashtag

Add an individual description for each of the enum values in your schema.

chevron-rightx-internal | x-gitbook-ignorehashtag

Hide an endpoint from your API reference.

chevron-rightx-stabilityhashtag

Mark endpoints that are unstable or in progress.

Supported values: experimental, alpha, beta.

chevron-rightdeprecatedhashtag

Mark whether an endpoint is deprecated or not. Deprecated endpoints will give deprecation warnings in your published site.

chevron-rightx-deprecated-sunsethashtag

Add a sunset date to a deprecated operation.

Supported values: ISO 8601 format (YYYY-MM-DD)

Last updated

Was this helpful?