SR
Usage

Headless

API endpoints for serving LLMify Markdown from a headless frontend.


When your frontend is rendered by a separate app (Nuxt, Next, Astro, ...) instead of Craft, enable headlessMode. LLMify then fetches your front-end URLs, converts them to Markdown, caches the result for cacheDuration and exposes it through the API endpoints below, so your frontend can pull the content and re-serve it under its own domain. If the frontend is protected with HTTP Basic Auth, set the basicAuthUsername and basicAuthPassword settings so LLMify can fetch it.

Note

The auto-serve, bot detection and discovery-tag features rely on Craft rendering the frontend and are disabled in headless mode. Your frontend is responsible for serving llms.txt, the .md pages and the discovery tag. See the example implementation.

Authentication

The API is only available while headlessMode is enabled, otherwise every endpoint returns 403.

Protection with a token is optional:

  • No token configured (default): the endpoints are reachable without authentication. The content they expose (llms.txt, page Markdown) is public anyway.
  • Token configured via the apiToken setting: every request must send it in the X-Llmify-Token header. Requests with a missing or wrong token return 403.
curl -H "X-Llmify-Token: <your-token>" \
  "https://cms.example.com/actions/llmify/api/llms-txt"

llms.txt

Returns the llms.txt content for a site.

GET /actions/llmify/api/llms-txt?site=<handle|id>
ParameterRequiredDescription
siteNoSite handle or id. Defaults to the primary site.

Responses

StatusMeaning
200text/markdown body
400Unknown site
404No content available for the site
curl "https://cms.example.com/actions/llmify/api/llms-txt?site=default"

page

Returns the Markdown for a single page, identified by its URI. The response includes front matter, and only pages whose section is enabled are served. This is the recommended way to serve individual .md files: the first request of a page fetches and converts your front end, every request after that is served from the cache until it expires or gets cleared.

Because Craft does not render the front end, its element cache tags cannot see what a page shows. Saving the entry itself clears its Markdown, changes to related content only show up once cacheDuration has passed. Lower it if your pages show a lot of related content.

Note

In LLMify 1.x this endpoint read Markdown that queue jobs had stored in the database.

GET /actions/llmify/api/page?uri=<uri>&site=<handle|id>
ParameterRequiredDescription
uriYesThe Craft URI of the page, e.g. blog, news/my-post. The home page is __home__.
siteNoSite handle or id. Defaults to the primary site.

Responses

StatusMeaning
200text/markdown body (with front matter)
400Missing uri or unknown site
404No page for the URI, or it has no Markdown
curl "https://cms.example.com/actions/llmify/api/page?uri=blog&site=default"

convert

Fetches a front-end URL and returns its converted Markdown on the fly, without caching it or adding front matter. Use this for ad-hoc conversion; prefer page for serving pages.

POST /actions/llmify/api/convert
Content-Type: application/json

{ "url": "https://www.example.com/blog/my-post" }
ParameterRequiredDescription
urlYesThe front-end URL to fetch and convert.
Caution

The target url must resolve to one of your configured site Base URL hosts (SSRF guard). Other hosts return 403.

Responses

StatusMeaning
200text/markdown body
400Missing or invalid url
403url host is not an allowed site host
404URL could not be fetched
405Method other than POST
curl -X POST "https://cms.example.com/actions/llmify/api/convert" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://www.example.com/blog/my-post"}'

Example Implementation

The llmify-headless-showcase repository shows a complete Nuxt integration: server routes that proxy llms.txt, serve individual .md pages via the page endpoint, and inject the discovery <link> tag.


Copyright © 2026 Samuel Reichör