API reference

Interactive documentation generated from your API specification
View as Markdown

Fern automatically generates interactive API reference documentation from your API specification. This starter template includes a sample Plant Store API to demonstrate the feature.

Supported specifications

Fern supports multiple API specification formats:

FormatDescriptionDocumentation
OpenAPIThe most widely used REST API specification format (versions 2.0, 3.0, and 3.1)OpenAPI docs
AsyncAPIFor event-driven and message-based APIsAsyncAPI docs
gRPCProtocol buffer definitions for gRPC servicesgRPC docs

How it works

Place your API specification file in the fern/ directory and reference it in your docs.yml navigation:

docs.yml
1navigation:
2 - section: Documentation
3 contents:
4 - page: Overview
5 path: docs/pages/overview.mdx
6 - api: API Reference

Fern parses your specification and generates:

  • Endpoint documentation with request/response schemas
  • Interactive API Explorer for testing endpoints
  • Code snippets in multiple languages
  • Type definitions and examples

API Explorer

The API Explorer lets users test API endpoints directly in the documentation. Users can fill in parameters, send requests, and see responses without leaving the page.

For advanced API Explorer features like auto-populating API keys, see the API Explorer documentation.

Customizing the API reference

Control how your API reference appears using the api configuration in docs.yml:

docs.yml
1navigation:
2 - api: API Reference
3 api-name: plantstore
4 paginated: true

You can also add custom content to API reference pages, organize endpoints into groups, customize section names, and control which endpoints are visible.

For detailed customization options, see the API reference documentation.

SDK code snippets

If you generate SDKs with Fern, code snippets automatically appear in your API reference showing how to call each endpoint using your SDK:

generators.yml
1groups:
2 python-sdk:
3 generators:
4 - name: fernapi/fern-python-sdk
5 version: 4.3.1
6 output:
7 location: pypi
8 package-name: plantstore

For more information on SDK generation, see the SDK documentation.