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

Insert API reference in your docs

Insert complete API reference from your OpenAPI spec or pick individual operation or schemas

GitBook allows you to automatically generate pages related to the endpoints you have in your OpenAPI spec. These pages will contain OpenAPI operation blocks, allowing you and your visitors to test your endpoints and explore them further based on the information found in the spec.

Automatically create OpenAPI pages from your spec

After you’ve added your OpenAPI spec, you can generate endpoint pages by inserting an OpenAPI Reference in the table of contents of a Space.

A GitBook screenshot showing how to insert API references into the table of contents of a space
Insert API References in the table of contents of a Space.
1

Generate pages from OpenAPI

In the space you’d like to generate endpoint pages, click the Add new... button from the bottom of your space’s table of contents.

From here, click OpenAPI Reference.

2

Choose your OpenAPI spec

Choose your previously uploaded OpenAPI spec. Then choose a Page structure:

  • One page per tag

  • One page per operation

You can also choose to add a models page and a download link. Click Insert to generate the reference.

3

Manage your API operations

GitBook will automatically generate pages based on your OpenAPI spec and the tags set inside its definition. If you choose One page per operation, GitBook groups the generated operation pages by tag.

Head to OpenAPI layouts to compare layouts, or Structuring your API reference to organize pages with tags.

Add an individual OpenAPI block

Alternatively, you can add OpenAPI operations or schemas from your spec individually to pages throughout your docs.

1

Add a new OpenAPI block

Open the block selector by pressing /, and search for OpenAPI.

2

Choose your OpenAPI spec

Choose your previously uploaded OpenAPI spec, and click Continue to choose your the endpoints you’d like to use.

3

Choose the operations or schemas you’d like to insert

Pick the operations and the schemas you want to insert in your docs and click Insert.

Last updated

Was this helpful?

Powered by GitBook