Jamdesk Documentation logo

API Playground

Let developers test your API endpoints directly from your docs with the interactive playground — fill in parameters, see live code examples, and send real requests.

The API playground adds an interactive "Try it" button to your API endpoint pages. Developers can fill in parameters, watch code examples update in real time, and send actual HTTP requests — all without leaving your docs.

API playground modal showing parameter form on the left and live code examples on the right

Quick Start

The playground is enabled by default. Every page with an openapi: or api: frontmatter field automatically gets a "Try it" button. CORS is handled automatically.

No docs.json configuration needed — just add an openapi: or api: field to your page frontmatter and the playground appears.

Display Modes

The display field controls what the playground can do:

Mode"Try it" ButtonFill ParamsLive CodeSend Request
"interactive" (default)
"simple"
"none"

Full playground experience. Developers fill in parameters, see code examples update live, and send real HTTP requests. Responses display inline with status codes, timing, and formatted bodies.

docs.json
{
  "api": {
    "playground": {
      "display": "interactive"
    }
  }
}

Authentication

If your API requires authentication (configured via api.mdx.auth.method in docs.json), the playground shows an auth input field at the top of the parameter form. Developers enter their API key or token directly in the modal.

Credentials are held in memory only for the current session — they are never saved to localStorage or persisted between visits.

Pre-filling Example Values

When your OpenAPI spec includes example values on parameters and request bodies, the playground can pre-fill them:

docs.json
{
  "api": {
    "examples": {
      "prefill": true
    }
  }
}

This saves developers time by showing realistic values they can modify rather than starting from empty fields.

Per-Page Override

Override the global display mode on individual pages using the playground frontmatter field:

---
title: Create Ticket
openapi: POST /tickets
playground: interactive
---

Useful when you want the playground disabled globally but enabled on specific demo endpoints, or vice versa.

FrontmatterBehavior
playground: interactiveFull playground on this page
playground: simpleCode-only playground on this page
playground: noneNo playground on this page

How It Works

1
Click 'Try it'

The playground opens as a full-screen modal overlay. Your docs page stays intact underneath.

2
Fill in parameters

Path, query, header, and body parameters are shown as form fields. Required fields are marked. The base URL is pulled from your OpenAPI spec's servers field.

3
Watch code update

As you type, code examples regenerate in real time across all configured languages. Copy any example with one click.

4
Send the request

In interactive mode, click Send (or press Ctrl/Cmd+Enter) to execute the request. The response displays below with status code, duration, and formatted body.

API playground showing a 201 Created response with JSON body after sending a request

When the playground is open, the URL updates to include ?playground=open. Share this URL to link someone directly to the playground view of an endpoint.

Keyboard Shortcuts

ShortcutAction
Ctrl/Cmd + EnterSend request
EscapeClose playground

Works With Both API Page Types

The playground works on pages using either the openapi: or api: frontmatter format:

Parameters and schemas are pulled automatically from your OpenAPI spec. No additional setup needed.

---
openapi: POST /tickets
---

Local Development

When running jamdesk dev, the "Try it" buttons are visible but the playground itself is a production-only feature. Clicking "Try it" in local dev shows a brief notification instead of opening the modal. Deploy your docs to use the full playground.

Try It Live

This documentation site has the playground enabled. Visit the OpenAPI Example page and click "Try it" to see it in action with the demo API.

What's Next?

OpenAPI Example

See a live playground on an auto-generated endpoint page

docs.json Reference

Full configuration reference including api.playground

Request/Response Examples

Hand-authored API endpoint pages with MDX components

Code Examples

Configure which languages appear in code examples