Overview

The API playground is an interactive environment that lets users test and explore your API endpoints. Developers can craft API requests, submit them, and view responses without leaving your documentation.
API playground for the trigger an update endpoint.API playground for the trigger an update endpoint.
The playground is automatically generated from your OpenAPI specification or AsyncAPI schema so any updates to your API are automatically reflected in the playground. You can also manually create API reference pages after defining a base URL and authentication method in your docs.json. We recommend generating your API playground from an OpenAPI specification. See OpenAPI Setup for more information on creating your OpenAPI document.

Getting started

1

Add your OpenAPI specification file.

Make sure that your OpenAPI specification file is valid using the Swagger Editor or Mint CLI.
/your-project
  |- docs.json
  |- openapi.json
2

Configure `docs.json`.

Update your docs.json to reference your OpenAPI specification. Add an openapi property to any navigation element to auto-populate your docs with pages for each endpoint specified in your OpenAPI document.This example generates a page for each endpoint specified in openapi.json and organize them under the “API reference” group in your navigation.
{
    "navigation": [
      {
        "group": "API reference",
        "openapi": "openapi.json"
      }
  ]
}

Customizing your playground

You can customize your API playground by defining the following properties in your docs.json.
playground
object
Configurations for the API playground.
examples
object
Configurations for the autogenerated API examples.

Example configuration

{
 "api": {
   "playground": {
     "display": "interactive"
   },
   "examples": {
     "languages": ["curl", "python", "javascript"],
     "defaults": "required"
   }
 }
}
This example configures the API playground to be interactive with example code snippets for cURL, Python, and JavaScript. Only required parameters are shown in the code snippets.

Custom endpoint pages

When you need more control over your API documentation, use the x-mint extension in your OpenAPI specification or create individual MDX pages for your endpoints. Both options allow you to:
  • Customize page metadata
  • Add additional content like examples
  • Control playground behavior per page
The x-mint extension is recommended so that all of your API documentation is automatically generated from your OpenAPI specification and maintained in one file. Individual MDX pages are recommended for small APIs or when you want to experiment with changes on a per-page basis. For more information, see x-mint extension and MDX Setup.

Further reading

  • AsyncAPI Setup for more information on creating your AsyncAPI schema to generate WebSocket reference pages.