The State of Docs Report 2025 is live! Dive in and see why docs matter more than ever:
Read the report
LogoLogo
ProductPricingLog inSign up
  • Documentation
  • Developers
  • Guides
  • Changelog
  • Help Center
  • Getting Started
    • GitBook Documentation
    • Quickstart
    • Importing content
    • GitHub & GitLab Sync
      • Enabling GitHub Sync
      • Enabling GitLab Sync
      • Content configuration
      • GitHub pull request preview
      • Commit messages & Autolink
      • Monorepos
      • Troubleshooting
  • Creating Content
    • Formatting your content
      • Inline content
      • Markdown
    • Content structure
      • Spaces
      • Pages
      • Collections
    • Blocks
      • Paragraphs
      • Headings
      • Unordered lists
      • Ordered lists
      • Task lists
      • Hints
      • Quotes
      • Code blocks
      • Files
      • Images
      • Embedded URLs
      • Tables
      • Cards
      • Tabs
      • Expandable
      • Stepper
      • Drawings
      • Math & TeX
      • Page links
    • Reusable content
    • Broken links
    • Searching content
      • Search & Quick find
      • GitBook AI
    • Writing with GitBook AI
    • Version control
  • API References
    • OpenAPI
      • Add an OpenAPI specification
      • Insert API reference in your docs
    • Guides
      • Structuring your API reference
      • Adding custom code samples
      • Managing API operations
      • Describing enums
      • Integrating with CI/CD
  • Extensions reference
  • Publishing Documentation
    • Publish a docs site
      • Public publishing
      • Private publishing with share links
    • Site structure
      • Content variants
      • Site sections
    • Site customization
      • Icons, colors, and themes
      • Layout and structure
      • Extra configuration
    • Set a custom domain
    • Setting a custom subdirectory
      • Configuring a subdirectory with Cloudflare
      • Configuring a subdirectory with Vercel
    • Site settings
    • Site insights
    • Site redirects
    • Visitor authentication
      • Enabling visitor authentication
      • Setting up Auth0
      • Setting up Azure AD
      • Setting up AWS Cognito
      • Setting up Okta
      • Setting up OIDC
      • Setting up a custom backend
  • LLM-ready docs
  • Collaboration
    • Live edits
    • Change requests
    • PDF export
    • Inviting your team
    • Comments
    • Notifications
  • Integrations
    • Install and manage integrations
    • GitHub Copilot
  • Account management
    • Plans
      • Legacy pricing
      • Sponsored site plan
      • Non-profit plan
      • Billing policy
    • Subscription cancellations
    • Personal settings
    • Organization settings
    • Member management
      • Invite or remove members
      • Roles
      • Teams
      • Permissions and inheritance
    • SSO & SAML
      • SSO Members vs non-SSO
  • Resources
    • GitBook UI
    • Keyboard shortcuts
    • Glossary
Powered by GitBook
LogoLogo

Resources

  • Showcase
  • Enterprise
  • Status

Company

  • Careers
  • Blog
  • Community

Policies

  • Subprocessors
  • Terms of Service
On this page
  • How to add a specification
  • Update your specification

Was this helpful?

Edit on GitHub
  1. API References
  2. OpenAPI

Add an OpenAPI specification

Learn how to add and update an OpenAPI specification in GitBook application or from CLI.

Last updated 28 days ago

Was this helpful?

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 .

How to add a specification

  1. Open the OpenAPI section in the sidebar

  2. Click on Add specification

  3. Give your specification a name. This helps identify it, especially if you manage multiple specs

  4. Choose one of the following:

    • Upload a file (e.g. openapi.yaml)

    • Enter a URL to a hosted spec

    • Use the CLI to publish the spec

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:

  • If your spec is linked to a URL:

    • GitBook checks for updates automatically every 6 hours.

    • To fetch updates immediately, click Check for updates.

  • If your spec was uploaded as a file:

    • Click Update to upload a new version.

  • You can switch from a File to a URL source by clicking on Edit in the breadcrumb actions menu.

Using the CLI

Use the same command to update your specification:

gitbook openapi publish --spec api-spec-name --organization organization_id <path-or-url>

You can also use the CLI to Check for updates by running the publish command on the same URL.

Read our Integrating with CI/CD guide to learn how to automate the update of your specification.

Add an OpenAPI specification modal.
GitBook CLI