Using with AI agents
Feed these docs to Cursor, Claude Code, Copilot or any other coding agent.
Every page on this site is published as plain Markdown alongside its HTML, so a coding agent can read the documentation directly instead of scraping rendered pages.
Endpoints
| URL | Contents |
|---|---|
/llms.txt | Index of every page with titles, descriptions and URLs |
/llms-full.txt | The entire documentation as one Markdown document |
/docs/<path>.md | A single page as Markdown |
Start an agent with /llms.txt so it can see the structure, then let it fetch the specific
pages it needs. /llms-full.txt is the one-shot option when you would rather paste
everything into a single context window.
curl https://payload-auth.dev/llms.txt
curl https://payload-auth.dev/docs/reference/plugin-options.mdContent negotiation
Requesting a docs page with a Markdown Accept header returns Markdown rather than HTML,
so an agent's default fetch tool gets clean content without any special URL handling:
curl -H "Accept: text/markdown" https://payload-auth.dev/docs/getting-started/installationAppending .md to any docs URL does the same thing.
Copy from the page
Every page has a Copy Markdown button and a view-options menu in its header, for grabbing the source of the page you are reading and pasting it into a chat.
Wiring it into your editor
Add the documentation to your project's CLAUDE.md or AGENTS.md:
## Authentication
This project uses `payload-auth` — Better Auth running on Payload CMS.
Documentation: https://payload-auth.dev/llms.txt
Full text: https://payload-auth.dev/llms-full.txt
Rules:
- Auth collections (`users`, `sessions`, `accounts`, `verifications`) are generated by
the plugin. Do not declare them by hand; extend them with `collectionOverrides`.
- Never set `database` in `betterAuthOptions` — the plugin supplies the adapter.
- `nextCookies()` must be the last entry in the Better Auth `plugins` array.
- `user.role` is a string array, not a string.
- Re-run `payload generate:importmap` after changing login methods or Better Auth plugins.Facts worth pinning
Agents trained before this integration existed tend to make the same handful of mistakes. These are the corrections worth stating explicitly:
- The auth collections are generated.
users,sessions,accounts,verificationsandadmin-invitationsare injected by the plugin. Writing them by hand duplicates work and usually conflicts. databaseis not a valid option. The exportedBetterAuthOptionstype has it removed; the plugin supplies the Payload adapter.roleis an array. It is a Payload multi-select, so['admin'], not'admin'.- Foreign keys are relationships. In Payload queries use
user, notuserId, onsessionsandaccounts. Better Auth code still usesuserId. nextCookies()goes last.admin.loginMethodsis UI only. It changes which buttons the admin views render; it does not enable or disable providers.- Import from
payload-auth/better-auth, not frompayload-auth/better-auth/plugin, for ordinary use. getPayloadAuth<Config>(configPromise)is how you get a typedpayload.betterAuth.
Better Auth's own docs
payload-auth does not change Better Auth's API, so for anything about endpoints, client
methods or plugin options, Better Auth's documentation is authoritative:
https://www.better-auth.com/llms.txtGive an agent both sources: this site for the Payload integration, Better Auth's for the auth surface itself.