diff --git a/api-playground/mdx-setup.mdx b/api-playground/mdx-setup.mdx index f41a651ae..8f5b1cfd9 100644 --- a/api-playground/mdx-setup.mdx +++ b/api-playground/mdx-setup.mdx @@ -95,7 +95,75 @@ You can manually define API endpoints in individual MDX pages. This approach is ``` - Add your endpoint pages to the navigation by updating the `pages` field in your `docs.json`. Learn more about structuring your docs in [Navigation](/organize/navigation). + Add your endpoint pages to the navigation by updating the `pages` field in your `docs.json`: + + ```json docs.json + "navigation": { + "tabs": [ + { + "tab": "API Reference", + "groups": [ + { + "group": "Users", + "pages": [ + "api-reference/users/create-user", + "api-reference/users/get-user", + "api-reference/users/update-user" + ] + }, + { + "group": "Orders", + "pages": [ + "api-reference/orders/create-order", + "api-reference/orders/list-orders" + ] + } + ] + } + ] + } + ``` + + Each page path corresponds to an MDX file in your docs repository. For example, `api-reference/users/create-user.mdx`. Learn more about structuring your docs in [Navigation](/organize/navigation). + + ### Using OpenAPI endpoints in navigation + + If you have an OpenAPI specification, you can reference endpoints directly in your navigation without creating individual MDX files. Reference specific endpoints by including the OpenAPI file path and the endpoint: + + ```json docs.json + "navigation": { + "pages": [ + "introduction", + "/path/to/users-openapi.json POST /users", + "/path/to/orders-openapi.json GET /orders" + ] + } + ``` + + You can also set a default OpenAPI spec for a navigation group and reference endpoints by method and path: + + ```json docs.json + { + "group": "API reference", + "openapi": "/path/to/openapi-v1.json", + "pages": [ + "overview", + "authentication", + "GET /users", + "POST /users", + { + "group": "Orders", + "openapi": "/path/to/openapi-v2.json", + "pages": [ + "GET /orders", + "POST /orders" + ] + } + ] + } + ``` + + For more details on OpenAPI integration, see [OpenAPI setup](/api-playground/openapi-setup).