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.
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
apiTokensetting: every request must send it in theX-Llmify-Tokenheader. Requests with a missing or wrong token return403.
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>
Responses
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.
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>
Responses
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" }
The target url must resolve to one of your configured site Base URL hosts (SSRF guard). Other hosts return 403.
Responses
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.