The API Playground lets users test API endpoints directly from your documentation. It supports all HTTP methods, authentication, path/query/header parameters, and displays formatted responses.
Basic Usage
Get User
Retrieve a user by their ID.
/users/{id}POST Request with Body
When you define body parameters using PlaygroundParam, the API Playground renders individual form fields instead of a raw JSON textarea. Values are automatically converted to their correct types and assembled into a JSON request body.
Create Post
Create a new blog post.
/postsType Conversion
Body parameters are automatically converted based on their type:
- string — Input:
hello→ Output:"hello" - integer — Input:
42→ Output:42 - number — Input:
3.14→ Output:3.14 - boolean — Input:
true→ Output:true - array — Input:
["a","b"]ora, b→ Output:["a", "b"] - object — Input:
{"key": "value"}→ Output:{"key": "value"}
Complex Body Schema
Here's an example with multiple field types, pattern validation, and enum dropdowns:
Create User
Create a new user with various field types.
/usersRaw JSON Body
If you don't define any body parameters, a raw JSON textarea is shown instead, allowing users to enter custom JSON:
Update Post (Raw JSON)
Update a post using raw JSON input.
/posts/1With Query Parameters
List Posts
Get a list of posts with optional filtering.
/postsProps
ApiPlayground
When true, displays the full URL (baseUrl + endpoint) in the endpoint bar. The baseUrl appears dimmed while the endpoint path is highlighted.
Example responses keyed by HTTP status code. Supports any status code (200, 201, 400, 401, 403, 500, etc.). Displays as tabbed interface with color-coded status indicators.
Fixed headers to include with every request. These are automatically added to both the generated code and actual requests. Useful for User-Agent, API versioning, or custom headers.
PlaygroundParam
Regex pattern for input validation. Shows a warning if the value doesn't match, but doesn't block sending the request.
Custom error message to display when the pattern validation fails. Defaults to "Invalid format for {name}".
Showing Full URL
Use showBaseUrl to display the complete URL in the endpoint bar:
List All Posts
https://jsonplaceholder.typicode.com/postsAuthentication
The API Playground supports three authentication types:
- Bearer Token - Sent as
Authorization: Bearer <token> - API Key - Sent in a custom header
- Basic Auth - Base64 encoded credentials
Users can click the key icon to configure their authentication token, which is stored locally in their browser.
Get User (with Auth)
This endpoint works without auth, but demonstrates the authentication UI. Enter any token to see it in the generated code.
/users/1Enum Parameters
Use the enum prop to provide a dropdown of allowed values:
List Posts
/postsExample Responses
Use the examples prop to display example responses for different status codes. Each key is an HTTP status code, and the value is the example response body:
Create Post
Create a new blog post with example responses.
/postsStatus codes are color-coded:
- 2xx (Success) - Green
- 3xx (Redirect) - Blue
- 4xx (Client Error) - Amber
- 5xx (Server Error) - Red
Fixed Headers
Use the headers prop to include headers with every request. These appear in the generated code and are sent automatically:
List Posts with Custom Headers
/posts