llms.txt for API Documentation: What to Include (With a Real Example)

An llms.txt file is a plain-text, Markdown-formatted document placed at yourdomain.com/llms.txt that gives AI language models (LLMs) a curated map of your site: who you are, what your most important pages do, and which URLs to read when generating an answer about your product. For API documentation teams, it is quickly becoming the equivalent of robots.txt for the AI-answer era, and tools like Apidoke make it easy to publish the kind of structured, versioned docs that an llms.txt file can point to.
- llms.txt is a voluntary standard proposed by fast.ai's Jeremy Howard in 2024; it has no RFC yet, but adoption is growing fast among developer-tool companies.
- API docs benefit most because LLMs are frequently asked how to call an API; a well-formed llms.txt file helps the model cite your authoritative reference rather than guessing.
- The file uses plain Markdown: a one-paragraph description, then organized lists of URLs with short descriptions. No special syntax beyond what Markdown already provides.
- Apidoke's one-public-URL-per-project model is ideal for llms.txt: each project has a single canonical URL that always reflects current content, so your llms.txt never goes stale from versioned subpaths.
What is llms.txt, exactly?
The llms.txt specification (maintained at llmstxt.org) describes a lightweight convention: drop a file called llms.txt at the root of your domain, write it in Markdown, and use it to surface the most LLM-useful pages on your site. When an AI assistant crawls your domain or a user pastes your URL into a chat interface, the model can fetch /llms.txt first and immediately understand your content hierarchy without sifting through navigation menus, cookie banners, and marketing copy.
Think of it as a sitemap.xml optimized for language models rather than search crawlers. Where a sitemap lists every URL with a last-modified date, an llms.txt file lists only the pages that matter most, in plain English, with enough context for a model to decide which one to read for any given question.
There is also an optional companion file: llms-full.txt. This is the same information but with the full text of each important page concatenated, so a model can read everything in one request. For large API references this can grow very large, but it is useful when you want zero latency for LLM retrieval.
Why does this matter for API documentation teams?
Developers increasingly ask AI assistants questions like "How do I authenticate with the Payments API?" or "What does a 422 response body look like for the Orders endpoint?" If the model has no reliable pointer to your authoritative docs, it may hallucinate a plausible but wrong answer, or cite a competitor's docs by accident.
An llms.txt file gives the model a direct path to your canonical reference. That matters for three practical reasons:
- Citation accuracy: Models that follow the llms.txt convention will cite your actual endpoint URLs in their answers, not an approximation.
- Freshness: Because llms.txt points to live URLs rather than a training snapshot, models using retrieval-augmented generation (RAG) will pull current content.
- Coverage: Your authentication guide, error codes, rate-limit headers, and pagination patterns all get surfaced, not just your landing page.
This connects directly to the developer experience principle that good API docs should be findable from wherever a developer is working, including inside an AI chat interface.
What should an API documentation llms.txt file include?
The spec defines a loose structure. Here are the components, in order:
| Section | Markdown element | What to write |
|---|---|---|
| Title | # H1 | Your product or API name |
| Summary | Blockquote (>) | One paragraph describing what the API does and who it is for |
| Body text | Plain paragraphs | Any background an LLM needs: base URL, auth scheme, versioning policy |
| Important pages | ## H2 sections, each with a list of - [Title](URL): description | Your most critical reference sections, grouped logically |
| Optional pages | An ## Optional section | Pages useful only for deeper questions; models may skip these if context is short |
For an API docs site the most useful groupings are usually: Getting Started, Authentication, Core Resources (each endpoint group), Error Reference, and Rate Limits. Keep descriptions to one sentence. The model will fetch the linked page for detail; the description just tells it when to bother.
A real llms.txt example for an API documentation site
Below is a copy-paste example for a fictional "Parcel Tracking API" documented with Apidoke. The pattern works for any REST API; swap out the URLs and descriptions for your own content.
# Parcel Tracking API
> The Parcel Tracking API lets logistics platforms create shipments, update tracking
> events, and retrieve delivery status in real time. All endpoints return JSON.
> Base URL: https://api.parceltrack.example.com/v1
> Authentication: Bearer token sent in the Authorization header.
> Rate limit: 300 requests per minute per token; exceeded requests return HTTP 429.
This documentation is published with Apidoke. Each endpoint page includes
a live try-it console where you can fire real HTTP requests from the browser.
Tokens stay client-side and never reach Apidoke servers.
## Getting Started
- [Quickstart](https://docs.parceltrack.example.com/): Create your first shipment in under five minutes.
- [Authentication](https://docs.parceltrack.example.com/#authentication): How to obtain and send a Bearer token.
## Core Resources
- [Shipments](https://docs.parceltrack.example.com/#shipments): POST /shipments to create, GET /shipments/{id} to retrieve.
- [Tracking Events](https://docs.parceltrack.example.com/#tracking-events): POST /shipments/{id}/events to append a scan or delivery event.
- [Webhooks](https://docs.parceltrack.example.com/#webhooks): Subscribe to status-change events delivered via HTTP POST to your endpoint.
## Error Reference
- [HTTP Status Codes](https://docs.parceltrack.example.com/#errors): Full list of 400, 401, 403, 404, 409, 422, and 429 responses with example bodies.
- [Error Object Schema](https://docs.parceltrack.example.com/#error-schema): The JSON structure returned on every 4xx and 5xx response.
## Rate Limits and Pagination
- [Rate Limiting](https://docs.parceltrack.example.com/#rate-limits): 429 Too Many Requests, Retry-After header, and backoff strategy.
- [Pagination](https://docs.parceltrack.example.com/#pagination): Cursor-based pagination using the next_cursor field.
## Optional
- [Changelog](https://docs.parceltrack.example.com/changelog): Version history and breaking-change notices.
- [API Style Notes](https://docs.parceltrack.example.com/#style): Naming conventions, date formats (ISO 8601), and ID formats (UUID v4).
Notice a few things about this file. The blockquote (the lines starting with >) is the summary the spec says models should read first. It answers the five questions a developer would ask an AI: what does it do, what format, what base URL, how do I auth, what are my limits. Everything under ## Core Resources maps to a named anchor in the Apidoke-published doc, because Apidoke renders each # Group and ## Resource from your API Blueprint as a named section with a stable URL fragment.
How to write the body text section well
The body text between the blockquote and the first ## heading is free-form prose. For an API, include:
- The base URL. Models will construct example curl commands; they need this.
- The auth scheme. State it plainly: "Bearer token in the
Authorizationheader" or "API key in theX-Api-Keyheader". - The versioning strategy. Is the version in the path (
/v1/), a header, or a query parameter? Say so. - Content type. If every request must include
Content-Type: application/json, say that once here rather than repeating it in every description. - Any critical quirks. For example: "Monetary amounts are integers in the smallest currency unit (cents, pence). Never send floats."
Keep this section to three to six sentences. Its purpose is to make every answer the model gives about your API more accurate, not to replace your full reference docs.
How does llms.txt relate to robots.txt and sitemap.xml?
These three files serve different audiences and should all coexist. robots.txt tells search crawlers which paths to skip; sitemap.xml tells them which paths exist and when they changed; llms.txt tells language models which paths are most worth reading and what they contain. You would never replace one with another. Place all three at your domain root.
One important distinction: robots.txt can instruct crawlers to block themselves. llms.txt has no equivalent access-control mechanism. It is a hint, not a gate. If you need to restrict AI crawlers from accessing content, you do that via robots.txt (using relevant user-agent strings like GPTBot or ClaudeBot) and llms.txt then becomes moot for those crawlers.
Writing the URL descriptions: what actually works
Each line in your llms.txt link list follows this pattern:
- [Page Title](https://example.com/path/): One sentence about when to read this page.
The description is what the model uses to decide whether to fetch the page. Write it from the model's perspective: "when should I fetch this URL?" rather than "what is on this page?" Some practical patterns:
| Weak description | Better description |
|---|---|
| Authentication information. | How to obtain a Bearer token and send it in every request header. |
| Errors page. | Full list of 4xx and 5xx responses with JSON error body examples. |
| Shipments endpoint. | POST to create a shipment; GET /{id} to retrieve status; DELETE to cancel. |
| Rate limits. | What HTTP 429 means here, the Retry-After header value, and exponential backoff guidance. |
Concrete HTTP methods (GET, POST, DELETE), status codes (200, 401, 429), and header names turn a vague description into a retrieval signal the model can act on.
Where does Apidoke fit into this workflow?
Apidoke publishes each project as a single live URL with a 3-column interactive reference: navigation on the left, content in the centre, and a live try-it console on the right. Because each project has one canonical public URL that always reflects the current saved state, your llms.txt links never point to stale or versioned subpaths. The model fetches the URL and gets the current spec.
Apidoke's version history keeps the last 50 saves per project (each with a timestamp, author, and optional comment), so you can restore any previous state in one click if a doc change was premature. That means you control what the live URL shows, which is exactly what your llms.txt is pointing an AI model to. For more on structuring good developer-facing content, see how to make your API docs rank, since many of the same canonicalization principles apply to both search and LLM retrieval.
When you write your API Blueprint in Apidoke's split-pane editor, every # Group heading becomes a navigation section and a URL fragment. Use those fragments as the anchors in your llms.txt link list. For example, if your blueprint has:
# Group Shipments
## Shipment [/shipments/{id}]
### Retrieve a Shipment [GET]
+ Response 200 (application/json)
+ Body
{
"id": "shp_01HZXKQ8M4N",
"status": "in_transit",
"eta": "2026-11-14T18:00:00Z"
}
Then your llms.txt entry can read:
- [Shipments](https://docs.parceltrack.example.com/#shipments): GET /{id} returns a shipment object with status and eta; POST creates a new shipment.
The model now knows the HTTP method, the path shape, and the key response fields before it even fetches the page.
Should you also create an llms-full.txt file?
The spec allows an optional llms-full.txt at the same root path. This file contains the full Markdown text of every important page concatenated, so a model can ingest everything in a single request. For a small API with a focused reference, this is worth creating. For a large API with dozens of endpoint groups, the file can exceed 100,000 tokens, which pushes the limits of most model context windows.
A practical middle ground: create an llms-full.txt that includes only the reference sections (authentication, error codes, all endpoint descriptions with example request and response bodies) and omit the tutorial and changelog content. This keeps the file useful without being overwhelming.
Step-by-step: creating your first API docs llms.txt
- Audit your published docs. List every page or section in your API reference. For an Apidoke project, this means listing every
# Groupin your Blueprint. - Rank by LLM-query relevance. Authentication, endpoint descriptions with request/response examples, and error codes are highest priority. Marketing copy and changelog are lowest.
- Write the blockquote summary. One paragraph: what the API does, the base URL, the auth scheme, and the rate limit. This is the most-read section.
- Group your links. Use
##headings that match how developers think: Getting Started, Resources, Errors, Limits. - Write action-oriented descriptions. Lead with the HTTP method or the action, not the page title repeated.
- Place the file at
/llms.txt. No subdirectory. Plain UTF-8 text. Served withContent-Type: text/plain. - Optionally create
/llms-full.txt. Concatenate the full Markdown of your reference pages below a brief preamble. - Verify by fetching it. Run
curl https://yourdomain.com/llms.txtand confirm it renders as expected plain text.

What about privacy and security?
An llms.txt file is public by definition: it is an unauthenticated plain-text file at your domain root. Only link to pages you are comfortable with any AI model (and therefore any user) reading. Never include internal staging URLs, admin paths, or anything behind authentication in an llms.txt file. If part of your API reference is private, omit those sections entirely and add a note in the body text that some endpoints require a separate NDA or partner agreement.
This is worth emphasising because some API docs tools, including Apidoke, support both public and private projects. If your project is published publicly in Apidoke, its URL is fair game for llms.txt. If it is not published, there is nothing to link to, and the question does not arise.
Is there a validator or tooling for llms.txt?
As of late 2026, the ecosystem is still early. The llmstxt.org site maintains the spec and a directory of sites that have adopted the convention. There is no official validator, but because the format is Markdown, any Markdown linter will catch structural errors. The main things to check manually are that every URL in the file returns a 200 status code and that the file itself is served as text/plain.
Some static site generators are adding automatic llms.txt generation as a plugin. If you host your Apidoke-published docs behind a custom web server or reverse proxy, you can add the file as a static asset at the root path and serve it alongside your Apidoke public URL. It is a plain text file; no build step needed.
Frequently asked questions
What is the difference between llms.txt and a sitemap.xml for API docs?
A sitemap.xml lists all URLs for search engine crawlers, with no context about what each page means. An llms.txt lists only the most important pages, in plain English, with descriptions that help a language model decide which page answers a specific question. For an API reference, sitemap handles SEO discovery while llms.txt handles AI-answer accuracy.
Do I need to update my llms.txt every time I update my API docs?
Only if you add or remove major sections, change your base URL, or alter your authentication scheme. Descriptions pointing to a live URL are always current as long as the URL is current. If you use Apidoke, the public URL for each project always reflects the latest saved state, so the pointer stays valid without editing the file.
Will Google use my llms.txt file for search ranking?
Google has not confirmed any use of llms.txt for traditional search ranking as of late 2026. The file targets AI retrieval systems (ChatGPT's browsing mode, Perplexity, Claude's web access, Google AI Overviews via RAG) rather than the classic PageRank algorithm. That said, clean content structure helps both.
How long should my llms.txt file be?
The spec recommends keeping the file short enough that a model can process it within a small portion of its context window. In practice, 50 to 150 lines covers most API references comfortably. If you need more coverage, use the optional llms-full.txt for the extended version and keep llms.txt as the concise index.
Can I use llms.txt with API Blueprint-based docs?
Yes, and it pairs particularly well. API Blueprint's # Group structure creates predictable, named anchors in Apidoke's published output, so each Group maps cleanly to one line in your llms.txt link list. You end up with a file where every URL and anchor is derived directly from your Blueprint headings, making both the docs and the llms.txt easy to maintain together.
Ready to publish the kind of structured, versioned API reference that an llms.txt file is worth pointing to? Sign in to Apidoke and publish your first interactive API doc, no credit card required.
Technically reviewed by the Apidoke engineering team.