Add an OpenAPI specification
If you have an OpenAPI spec, you can add it to your organization by uploading the file directly, linking to a hosted URL, or using the GitBook CLI.How to add a specification
Name your specification
Give your specification a descriptive name. This helps identify it, especially if you manage multiple specs across your documentation.
Your specification can be in JSON or YAML format. GitBook automatically detects and parses both formats.
Update your specification
You can update your OpenAPI specification at any time using the GitBook UI or the CLI, regardless of how it was initially added.In GitBook application
In the OpenAPI panel, you have different update options depending on how your spec was added: For URL-linked specs:- GitBook checks for updates automatically every 6 hours
- To fetch updates immediately, click Check for updates
- The spec will be re-fetched and all linked API blocks will update automatically
- Click Update to upload a new version of the file
- The new version will replace the existing specification
- You can switch from a file to a URL source (or vice versa) by clicking Edit in the breadcrumb actions menu
Using the CLI
Use the same command to update your specification as you used to create it:Running the publish command on the same URL will check for updates and refresh the specification if changes are detected.