You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
subtitle: Interactive documentation generated from your API specification
4
+
slug: api-reference
5
+
---
6
+
7
+
Fern automatically generates interactive API reference documentation from your API specification. This starter template includes a sample Plant Store API to demonstrate the feature.
8
+
9
+
## Supported specifications
10
+
11
+
Fern supports multiple API specification formats:
12
+
13
+
| Format | Description | Documentation |
14
+
|--------|-------------|---------------|
15
+
|**OpenAPI**| The most widely used REST API specification format (versions 2.0, 3.0, and 3.1) |[OpenAPI docs](https://buildwithfern.com/learn/api-definitions/openapi/overview)|
16
+
|**AsyncAPI**| For event-driven and message-based APIs |[AsyncAPI docs](https://buildwithfern.com/learn/api-definitions/asyncapi)|
17
+
|**gRPC**| Protocol buffer definitions for gRPC services |[gRPC docs](https://buildwithfern.com/learn/api-definitions/protobuf)|
18
+
19
+
## How it works
20
+
21
+
Place your API specification file in the `fern/` directory and reference it in your `docs.yml` navigation:
22
+
23
+
```yaml title="docs.yml"
24
+
navigation:
25
+
- section: Documentation
26
+
contents:
27
+
- page: Overview
28
+
path: docs/pages/overview.mdx
29
+
- api: API Reference
30
+
```
31
+
32
+
Fern parses your specification and generates:
33
+
34
+
- Endpoint documentation with request/response schemas
35
+
- Interactive API Explorer for testing endpoints
36
+
- Code snippets in multiple languages
37
+
- Type definitions and examples
38
+
39
+
## API Explorer
40
+
41
+
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.
42
+
43
+
<Note>
44
+
For advanced API Explorer features like auto-populating API keys, see the [API Explorer documentation](https://buildwithfern.com/learn/docs/api-references/api-explorer/overview).
45
+
</Note>
46
+
47
+
## Customizing the API reference
48
+
49
+
Control how your API reference appears using the `api` configuration in `docs.yml`:
50
+
51
+
```yaml title="docs.yml"
52
+
navigation:
53
+
- api: API Reference
54
+
api-name: plantstore
55
+
paginated: true
56
+
```
57
+
58
+
You can also add custom content to API reference pages, organize endpoints into groups, customize section names, and control which endpoints are visible.
59
+
60
+
<Note>
61
+
For detailed customization options, see the [API reference documentation](https://buildwithfern.com/learn/docs/api-references/generate-api-ref).
62
+
</Note>
63
+
64
+
## SDK code snippets
65
+
66
+
If you generate SDKs with Fern, code snippets automatically appear in your API reference showing how to call each endpoint using your SDK:
67
+
68
+
```yaml title="generators.yml"
69
+
groups:
70
+
python-sdk:
71
+
generators:
72
+
- name: fernapi/fern-python-sdk
73
+
version: 4.3.1
74
+
output:
75
+
location: pypi
76
+
package-name: plantstore
77
+
```
78
+
79
+
<Note>
80
+
For more information on SDK generation, see the [SDK documentation](https://buildwithfern.com/learn/sdks/overview/introduction).
0 commit comments