Skip to content
Last updated

servers

The servers option sets the GraphQL endpoints that the Try it button sends requests to. The Try it button on GraphQL query and mutation samples opens Replay, where users can edit the operation and send it. Replay lists each endpoint as an environment, so users can switch between endpoints such as production and sandbox. Without servers, Replay uses the address of your documentation site, and users have to type the endpoint before they send a request.

Early access

This is a feature in early access. It may not be available for your organization yet, and its behavior may change before general availability.

To request access to this feature, contact our Support team.

The servers setting is not available in Redoc Community Edition.

Options

OptionTypeDescription
servers[Server object]List of GraphQL endpoints for the Try it button. A list in an API entry replaces the list under the root graphql key.

Server object

OptionTypeDescription
urlstringREQUIRED. Full URL of the GraphQL endpoint, including the path, for example https://api.example.com/graphql. The URL must start with http:// or https://.
descriptionstringName of the endpoint in Replay. Replay shows the URL when you don't set a description.

Examples

Set endpoints for all GraphQL APIs

The following example adds a production and a sandbox endpoint to every GraphQL API in the project:

redocly.yaml
graphql:
  servers:
    - url: https://api.example.com/graphql
      description: Production
    - url: https://sandbox.example.com/graphql
      description: Sandbox

Set the endpoint for one GraphQL API

The following example sets the endpoint for the library API only. The list replaces the root graphql.servers list for this API:

redocly.yaml
apis:
  library@v1:
    root: ./graphql/library.graphql
    graphql:
      servers:
        - url: https://library.example.com/graphql
          description: Library API

Resources

  • GraphQL - Official GraphQL specification and documentation for understanding query language fundamentals
  • Configuration options - All the other options for your project
  • hideReplay - Hide the Try it button when you don't want users to send requests from the docs
  • corsProxyUrl - Choose the proxy that Replay uses for cross-origin requests to your endpoints
  • GraphQL configuration - All the options you can set under graphql
  • Replay API explorer - How users test APIs from the reference docs