Decorative Curve
Back to Resources

How llms.txt Works, and What to Put in One for an API

A short field guide to writing an llms.txt for a developer-facing product, plus a sample.

April 15, 20262 min read

The llms.txt proposal is a small Markdown file you serve at the root of your site, like robots.txt. It is not a crawl directive. It is a curated index meant to help a language model find the parts of your site that are worth reading.

The format is simple. A top-level heading with the project name, a short paragraph that says what the project is, and then any number of sections of bullet links with a one-line description for each link.

Why this matters for an API

When a model is asked to use your API, it has to find the relevant docs first. If your site has fifty pages, the model may pick the marketing page instead of the reference. llms.txt lets you point it at the few pages that actually contain the answer: the quickstart, the auth section, the canonical reference, and the error catalog.

It also lets you separate the page a model should read from the page a human should land on. The model wants the raw reference. The human wants the explainer. llms.txt can point at both.

What to include

For a developer-facing product, the useful sections are usually:

  • Getting started. One link to the shortest path from zero to a working request.
  • Authentication. The canonical doc for auth headers, scopes, and token lifetime.
  • API reference. The single page or index that lists every endpoint.
  • Errors. A page that lists status codes and what they mean for your API.
  • Changelog. So the model can tell what is current.

Each link gets one short sentence describing it. No marketing language. The model is reading this to choose between links, not to be sold.

Where to host it

Serve it at /llms.txt on your primary domain. If your docs live on a subdomain, host one there too, pointing at the same set of links. Many crawlers and agent frameworks check both.

A sample

# Acme API

> Acme is a REST API for sending and tracking transactional email.

## Getting started

- [Quickstart](https://acme.dev/docs/quickstart): the shortest path from zero to a sent email.
- [Authentication](https://acme.dev/docs/auth): how to create and use an API key.

## Reference

- [API reference](https://acme.dev/reference): every endpoint, with request and response schemas.
- [Webhooks](https://acme.dev/docs/webhooks): event types and delivery semantics.
- [Errors](https://acme.dev/docs/errors): status codes and recovery guidance.

## Changes

- [Changelog](https://acme.dev/changelog): dated list of API changes.

That is the whole file. Keep it short. The point is to save the model a search step, not to mirror your sitemap.

Connector
Everything to Build Great Docs
Connector
The Full Documentation Stack
Decorative CurveReady?
Get a preview
of your docs
ConnectorConnector
Decorative Curve
Terms of ServicePrivacy Policy
MSA