Configuring the “Test it” button
You can configure the "Test It" button and accompanying window in GitBook using several OpenAPI extensions. These extensions can help improve and configure the testing suite for users.
Hiding the “Test it” button
You can hide the “Test it” button from your endpoints by adding the x-hideTryItPanel
to an endpoint, or at the root of your OpenAPI spec.
openapi: '3.0'
info: ...
tags: [...]
paths:
/example:
get:
summary: Example summary
description: Example description
operationId: examplePath
responses: [...]
parameters: [...]
x-hideTryItPanel: true
Enable authentication in the testing window
The request runner can only present and apply auth if your spec declares it. Define schemes under components.securitySchemes
, then attach them either globally via security
(applies to all operations) or per-operation (overrides global).
Declare your auth scheme
Below are common patterns. Use straight quotes in YAML.
openapi: '3.0.3'
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
Apply schemes globally or per operation
openapi: '3.0.3'
security:
- bearerAuth: []
paths: ...
Control the endpoint URL with servers
servers
The request runner targets the URL(s) you define in the servers
array. Declare one or more servers; you can also parameterize them with variables.
openapi: '3.0.3'
servers:
- url: https://instance.api.region.example.cloud
Last updated
Was this helpful?