Managing API operations
It’s common to have operations that are not fully stable yet or that need to be phased out. GitBook supports several OpenAPI extensions to help you manage these scenarios.Marking operations as experimental, alpha, or beta
Usex-stability to communicate that an endpoint is unstable or in progress. It helps users avoid non-production-ready endpoints.
Supported values: experimental, alpha, beta
openapi.yaml
Use stability markers to set proper expectations with your API consumers. This is especially important for public APIs where users need to understand the maturity level of different endpoints.
Deprecating an operation
To mark an operation as deprecated, add thedeprecated: true attribute:
openapi.yaml
Adding a sunset date
Optionally specify when support ends by includingx-deprecated-sunset:
openapi.yaml
Hiding an operation from the API reference
To hide an operation from your API reference, addx-internal: true or x-gitbook-ignore: true:
openapi.yaml
- Internal-only endpoints that external users shouldn’t access
- Work-in-progress operations not ready for documentation
- Legacy endpoints you want to maintain but not promote
Hidden operations are completely excluded from your published documentation but remain in your OpenAPI spec for internal use.
Hiding response samples
Add thex-hideSample: true attribute to a response object to exclude it from the response samples section:
openapi.yaml
- Response payloads contain sensitive or complex data
- You want to simplify the documentation by hiding certain response codes
- Auto-generated samples don’t accurately represent your API
Customizing authorization prefix and token placeholder
You can customize the authorization prefix (for example,Bearer, Token, or a custom string) and the token placeholder shown when using security schemes in GitBook.
In your OpenAPI spec, under components.securitySchemes, define your scheme like this:
openapi.yaml
-
x-gitbook-prefix- Defines the prefix added before the token- Example:
Authorization: Token YOUR_API_TOKEN
- Example:
-
x-gitbook-token-placeholder- Sets the default token value shown in examples- Example:
Authorization: Bearer YOUR_CUSTOM_TOKEN
- Example:
Common patterns
Best practices
Use stability markers early
Mark new endpoints as
beta or experimental from the start. Promote them to stable only after thorough testing and validation.Provide migration paths
When deprecating an endpoint, always document the recommended alternative in the operation description.
Give adequate notice
Set sunset dates at least 6-12 months in the future to give users time to migrate their integrations.