Skip to content

Commit 87a98ee

Browse files
docs: document api:apiName link syntax for API Reference sections
Co-Authored-By: Anar Kafkas <anarkafkas@gmail.com>
1 parent bf9f574 commit 87a98ee

4 files changed

Lines changed: 28 additions & 6 deletions

File tree

fern/products/docs/pages/api-references/api-ref-content.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ service:
5353
</CodeBlock>
5454
</CodeBlocks>
5555
56-
## Linking to API endpoints
56+
## API link syntax
5757
5858
<Markdown src="/snippets/api-link-syntax.mdx" />
5959
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
---
2-
tags: ["ai-features"]
2+
tags: ["ai-features", "api-reference", "mdx"]
33
---
44

55
## AI search model update
66

77
Ask Fern now uses [Claude 4.6 Sonnet](https://www.anthropic.com/news/claude-sonnet-4-6) and [Claude 4.5 Haiku](https://www.anthropic.com/news/claude-haiku-4-5).
88

99
<Button intent="none" outlined rightIcon="arrow-right" href="/learn/docs/ai-features/ask-fern/overview">Read the docs</Button>
10+
11+
## Link to API Reference sections with `api:` syntax
12+
13+
The `api:` link syntax supports linking to the root of an API Reference section in addition to individual endpoints. Use `api:apiName` to create a link that resolves to the landing page of a specific API Reference at build time.
14+
15+
```mdx Markdown
16+
Explore the [Plant Store API](api:plant-store) reference.
17+
```
18+
19+
<Button intent="none" outlined rightIcon="arrow-right" href="/learn/docs/writing-content/markdown-basics#api-link-syntax">Read the docs</Button>

fern/products/docs/pages/component-library/writing-content/markdown-basics.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Read the [Introduction](/learn/sdks/overview/introduction).
6363
```
6464
</CodeBlock>
6565

66-
### Link to an API endpoint
66+
### API link syntax
6767

6868
<Markdown src="/snippets/api-link-syntax.mdx" />
6969

fern/snippets/api-link-syntax.mdx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
Use the `api:` link syntax to link to an API endpoint in any Markdown content rendered by Fern. Fern resolves the link to the correct URL at build time, so you don't have to hardcode slugs.
1+
Use the `api:` link syntax to link to an API endpoint or API Reference section in any Markdown content rendered by Fern. Fern resolves the link to the correct URL at build time, so you don't have to hardcode slugs.
22

3-
The format is `api:METHOD/path`, where `METHOD` is an HTTP method (`GET`, `POST`, `PUT`, `PATCH`, `DELETE`) and `/path` is the endpoint path from your API definition. If your project has [multiple APIs](/learn/docs/api-references/generate-api-ref#include-more-than-one-api-reference), prefix the link with the API name: `api:API-NAME:METHOD/path`.
3+
To link to a specific endpoint, use `api:METHOD/path`, where `METHOD` is an HTTP method (`GET`, `POST`, `PUT`, `PATCH`, `DELETE`) and `/path` is the endpoint path from your API definition. If your project has [multiple APIs](/learn/docs/api-references/generate-api-ref#include-more-than-one-api-reference), prefix the link with the API name: `api:API-NAME:METHOD/path`.
44

55
For example:
66

@@ -14,4 +14,16 @@ View the [Current user information](api:mcp-tools:GET/api/fern-docs/whoami) endp
1414
</div>
1515
</div>
1616

17-
Path parameters are also supported. Include them in the endpoint path with curly braces, such as `api:GET/v2/payments/{paymentId}`.
17+
Path parameters are also supported. Include them in the endpoint path with curly braces, such as `api:GET/v2/payments/{paymentId}`.
18+
19+
To link to the root of an API Reference section, use `api:apiName`, where `apiName` matches the API name in your `generators.yml` file. This is useful when your project has multiple APIs and you want to link to the landing page of a specific API Reference.
20+
21+
```mdx Markdown
22+
Explore the [Plant Store API](api:plant-store) reference.
23+
```
24+
25+
<div className="highlight-frame">
26+
<div className="highlight-frame-content">
27+
Explore the [Plant Store API](api:plant-store) reference.
28+
</div>
29+
</div>

0 commit comments

Comments
 (0)