API playground pages

Build Mintlify-style API reference pages in Plandalf with endpoint metadata, request fields, response fields, examples, multiple responses, SDK samples, schema notes, visibility, and troubleshooting.

OpenAPI endpoint API playground pages
POST /api/checkout/sessions
Request URL
https://api.plandalf.com/api/checkout/sessions
Authentication
Public offer route
Operation ID
createCheckoutSession

Use this page when an API doc needs to behave like a Mintlify API playground page: the method and path are visible, the request shape is beside the explanation, and the request or response example follows the active endpoint in the right rail.

Current support

Plandalf supports manual MDX API pages today. API playground overview structure, OpenAPI setup, AsyncAPI setup, live request execution, generated SDK examples, complex data types, multiple responses, page visibility, and troubleshooting should be documented from implementation evidence instead of assumed from Mintlify behavior.

The API page model

  1. Start with ApiEndpoint. Add method, path, title, description, operationId, and auth so the page has the same request information a generated API reference would expose.

  2. Use Fields with ParamField rows for headers, path parameters, query parameters, and request body fields. Prefer header, path, query, or body props over a generic name when the location matters.

  3. Use RequestExample for copyable cURL, JavaScript, or SDK calls. Multiple fenced code blocks become language choices and clone into the right rail on API pages.

  4. Use Responses and ResponseField for the returned shape. Use nested ResponseField rows for objects and arrays instead of describing JSON blobs only in prose.

  5. Add one ResponseExample per meaningful outcome: success, validation error, authentication failure, not found, or webhook retry. Include status and statusText when the HTTP result matters.

Mintlify API playground coverage

API playground parity areas

API playground overviewsupported manually

Use api, openapi, or ApiEndpoint metadata to make the request method, path, auth label, and examples visible before the reader reaches field details.

OpenAPI setupplanned

Track OpenAPI source files only after the repo has a schema source and build step. Until then, use manual MDX endpoint pages.

AsyncAPI setupplanned

Use this label for WebSocket or event-stream references only after an AsyncAPI source exists. For now, document webhook and event payloads with manual pages.

Troubleshootingsupported manually

Add a short troubleshooting section to API pages when auth, missing headers, CORS, schema mismatch, or response-status confusion is likely.

Manual MDX endpoint

<ApiEndpoint
  id="create-checkout-session"
  method="POST"
  path="/api/checkout/sessions"
  title="Create checkout session"
  description="Creates a checkout session for a published offer."
  operationId="createCheckoutSession"
  auth="Public offer route"
>
  <Fields title="Request body" variant="list">
    <ParamField body="offer" type="string" required>
      Published offer slug, Sqid route key, or UUID.
    </ParamField>
    <ParamField body="metadata" type="object">
      Optional implementation metadata, such as source page or account ID.
    </ParamField>
  </Fields>

  <RequestExample title="Create a session" labels={["Shell", "JavaScript"]}>
    ```bash title="POST /api/checkout/sessions"
    curl -X POST "https://api.plandalf.com/api/checkout/sessions" \
      -H "Content-Type: application/json" \
      -H "Accept: application/json" \
      -d '{"offer":"pro-plan"}'
    ```

    ```js title="create-session.js"
    const response = await fetch("https://api.plandalf.com/api/checkout/sessions", {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        Accept: "application/json"
      },
      body: JSON.stringify({ offer: "pro-plan" })
    });
    ```
  </RequestExample>

  <Responses title="Response fields" variant="list">
    <ResponseField name="session" type="object" required expandable defaultOpen>
      The checkout session returned by the API.

      <ResponseField name="session.id" type="string">
        Public checkout session route key.
      </ResponseField>
    </ResponseField>
  </Responses>

  <ResponseExample title="Session response" status={201} statusText="Created" labels={["JSON"]}>
    ```json title="201 checkout session"
    {
      "session": {
        "id": "cs_123",
        "status": "open"
      }
    }
    ```
  </ResponseExample>
</ApiEndpoint>

Multiple responses

Multiple ResponseExample blocks inside one endpoint become separate response outcomes in the API example rail. Keep them close to the endpoint so the reader sees the success path and the likely failure path together.

Endpoint

Multiple response outcomes

A compact example showing success, validation, and authentication outcomes on one endpoint.

POST /api/checkout/sessions
Base URL
https://api.plandalf.com
Authentication
Public offer route
Operation ID
createCheckoutSession
Request URL
https://api.plandalf.com/api/checkout/sessions

Create a checkout session

Request
curl -X POST "https://api.plandalf.com/api/checkout/sessions" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"offer":"pro-plan"}'

Created

201 Response
{
  "session": {
    "id": "cs_123",
    "status": "open"
  }
}

Validation error

422 Response
{
  "message": "The offer field is required.",
  "errors": {
    "offer": ["The offer field is required."]
  }
}

Unauthorized

401 Response
{
  "message": "Unauthenticated."
}

Complex data types

Use nested response fields for objects and arrays. When a schema has alternatives, document the union in the type label and explain each branch in child fields or compact prose.

Complex response fields

sessionobjectrequired

Checkout session state returned after the request.

session.customerobject | null

Identified buyer context when identity is available.

session.line_itemsarray<object>

Products, add-ons, order bumps, or selected variants in the session.

next_actionredirect | render | null

The next UI action for a custom client. Use a union label when the value can take a small set of shapes.

SDK examples

Mintlify can generate SDK examples from external tooling. Plandalf docs should only show generated examples when that generator exists in the repo. Until then, use manually maintained examples and label them by runtime.

Server-side SDK style

Request
const response = await fetch("https://api.plandalf.com/api/checkout/sessions", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Accept: "application/json"
  },
  body: JSON.stringify({ offer: "pro-plan" })
});
Create a checkout session from the server.

- Do not expose API credentials in browser code.
- Send Content-Type and Accept headers.
- Handle 201, 401, and 422 responses.

OpenAPI planning

OpenAPI parity checklist

Source schemaplanned

Keep OpenAPI source files beside the API implementation once they exist. Do not imply automatic page generation until build code reads those files.

Manual page fallbacksupported

Use ApiEndpoint, Fields, RequestExample, Responses, and ResponseExample for hand-authored API references.

Page visibilitysupported

Use content/docs/docs.json for public navigation and Visibility for human-only or agent-only MDX sections. Do not hide operational API details in prose only.

Generated SDK samplesplanned

Only claim generated SDK examples after a generator such as Speakeasy or Stainless is actually configured in this repo.

AsyncAPI planning

AsyncAPI parity checklist

Event sourceplanned

Add AsyncAPI references only when Plandalf has a maintained event, channel, or message schema source in the repo.

Manual fallbacksupported

Use ApiEndpoint, Fields, Responses, and ResponseExample to document webhook-style event payloads until generated AsyncAPI pages exist.

Troubleshooting

Troubleshooting checklist

Missing auth401

Show the required auth method near the endpoint header and include the likely unauthenticated response.

Invalid payload422

Pair request fields with a validation response so developers can match field names to error keys.

Wrong route404

Keep method and path visible in the right rail and use stable endpoint IDs so deep links land on the intended operation.

Feature detail