Markdown access
Fern serves clean Markdown for any documentation page — including API Reference pages — so agents can consume your content efficiently. Agents fetch the source by appending .md or .mdx to a page URL, or by sending an Accept: text/markdown header via content negotiation. Combined with llms.txt, this reduces token consumption by 90%+ compared to HTML.

For example, https://buildwithfern.com/learn/docs/ai-features/markdown.md displays the Markdown source for this page.
The same Markdown is used everywhere — single pages, llms.txt, and llms-full.txt — and respects the same <llms-only> and <llms-ignore> content controls.
A default per-page directive is automatically prepended to every page’s Markdown output when served to AI agents, pointing them to your .md URLs, llms.txt, and llms-full.txt. You can override or disable this directive in docs.yml. The directive is only visible to agents — human-facing documentation is unaffected.
Accessing protected docs
On sites with authentication enabled, agents must include a JWT on every Markdown request — whether for an individual page, llms.txt, or llms-full.txt. Exchange your Fern token for a JWT:
Send the returned JWT as the FERN_TOKEN header on subsequent requests:
JWTs are valid for 30 days — cache and refresh as needed.
Markdown for troubleshooting
Viewing the Markdown directly is also useful for troubleshooting layout problems. A View as Markdown button is enabled by default on every page and can be configured through the page actions configuration.