Setup
Configure your API settings
In your If you want to hide the API playground, set the Find a full list of API configurations in Settings.
docs.json file, define your base URL and authentication method.Example docs.json
display field to none. You don’t need to include an authentication method if you hide the playground.Create your endpoint pages
Create an MDX file for each endpoint. Define the The To override the global playground display mode for a specific page, add Options:
title and api in the frontmatter:api frontmatter field accepts either a full URL or a relative path:- Full URL like
POST https://api.acme.com/v1/users. Theserverfield indocs.jsonis ignored for that endpoint. - Relative path like
POST /v1/users. Requires aserverfield indocs.json. The server URL is prepended to the path.
{}:playground to the frontmatter:playground: 'interactive'- Display the interactive playground (default)playground: 'simple'- Display a copyable endpoint with no playgroundplayground: 'none'- Hide the playground entirely
Add parameters and responses
Use parameter and response fields to document your endpoint’s parameters and return values.
Authentication methods
You can set authentication globally indocs.json or override it on individual pages using the authMethod field in frontmatter. A page-specific method overrides the global setting.
Bearer token
Basic authentication
API key
None
To disable authentication on a specific page, setauthMethod to none:
Page Metadata
Mix with OpenAPI endpoints
If you have an OpenAPI specification, you can reference endpoints directly in your navigation without creating individual MDX files. This allows you to mix manually created pages with auto-generated ones.Reference OpenAPI endpoints in navigation
Reference specific endpoints by including the OpenAPI file path and the endpoint:docs.json
docs.json
Advanced examples
Path parameters
Document path parameters using theParamField component with the path attribute:
Query parameters
Document query parameters using theParamField component with the query attribute:
Request body parameters
Document request body parameters using theParamField component with the body attribute:
Response examples
Document response fields using theResponseField component:
When to use MDX vs OpenAPI
Use MDX when:- You have a small API with few endpoints
- You need maximum control over individual page layout and content
- You’re prototyping or experimenting with API documentation
- You want to add extensive custom content alongside API documentation
- You have a large API with many endpoints
- You want to auto-generate documentation from your API specification
- You want to keep your API documentation in sync with your API implementation
- You prefer maintaining a single source of truth for your API