DoryDocs

API Playground

The <APIPlayground> component embeds a fully interactive HTTP client inside your documentation. Readers can test API endpoints with real requests without leaving the page.

Live Demo#

Try it now — this makes a real HTTP request to a public API:

POST Request with Body#

Authenticated Endpoint#

Usage in MDX#

MDX

<APIPlayground
  method="GET"
  url="https://api.example.com/users"
  title="List Users"
  description="Returns a paginated list of users."
  parameters={[
    {
      name: "page",
      type: "number",
      required: false,
      description: "Page number (1-indexed).",
      defaultValue: "1"
    },
    {
      name: "limit",
      type: "number",
      required: false,
      description: "Items per page.",
      defaultValue: "20"
    }
  ]}
  headers={{
    "Accept": "application/json"
  }}
  authType="bearer"
/>

Features#

Query Parameters

Add, edit, and remove URL query parameters with a visual editor.

Request Headers

Set custom headers including Content-Type, Accept, and custom headers.

Request Body

Edit JSON request body with syntax highlighting.

Authentication

Supports Bearer token, API key, Basic auth, and no auth.

Multiple Servers

Switch between server environments (production, staging, etc.).

Response Display

Shows status code, response time, response headers, and formatted body.

Authentication Types#

authTypeDescriptionFields
noneNo authentication—
bearerBearer tokenToken field
apiKeyAPI key in headerKey name + value
basicHTTP Basic authUsername + password

Props Reference#

PropTypeRequiredDescription
method'GET' | 'POST' | 'PUT' | 'DELETE'YesHTTP method.
urlstringYesEndpoint URL.
titlestringNoDisplay title.
descriptionstringNoDescription shown above the playground.
parametersParameter[]NoPre-populated query parameters.
headersRecord<string, string>NoPre-populated request headers.
bodyobjectNoPre-populated JSON request body.
authType'bearer' | 'apiKey' | 'basic' | 'none'NoAuthentication method.
serversArray<{ url, description }>NoServer environment options.

Parameter Object

FieldTypeDescription
namestringParameter name.
typestringType hint (e.g. "string", "number").
requiredbooleanWhether the parameter is required.
descriptionstringParameter description.
defaultValuestringPre-populated value.

Was this page helpful?