> ## Documentation Index
> Fetch the complete documentation index at: https://docs.integrateledger.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Build with AI agents

> Machine-readable docs, the OpenAPI spec, a docs MCP server and copy-paste prompts for integrating Ledger with a coding agent.

Everything in these docs is available to agents as well as people. Point your coding agent at the sources below, or paste one of the prompts into it, and it can integrate Ledger the same way this site teaches you to.

## Sources for agents

| Source | URL | Use it for |
| - | - | - |
| Docs index | [`/llms.txt`](https://docs.integrateledger.com/llms.txt) | Every page with a one-line description. Start here. |
| Full docs | [`/llms-full.txt`](https://docs.integrateledger.com/llms-full.txt) | Every page in one Markdown file. |
| Any page as Markdown | Add `.md` to its URL, for example [`/getting-started/setup.md`](https://docs.integrateledger.com/getting-started/setup.md) | One page, without the site around it. |
| OpenAPI spec | [`/openapi.json`](https://docs.integrateledger.com/openapi.json) | Every endpoint, field and response, for codegen and tool definitions. |
| Docs MCP server | `https://docs.integrateledger.com/mcp` | Search and read these docs from Claude, Cursor or any MCP client. |

Every page also has a menu at the top, next to the title, to copy it as Markdown, open it in Claude or ChatGPT, or connect the MCP server to Cursor or VS Code.

## Connect the docs MCP server

```bash Claude Code theme={"system"}
claude mcp add --transport http ledger-docs https://docs.integrateledger.com/mcp
```

```json Cursor (.cursor/mcp.json) theme={"system"}
{
  "mcpServers": {
    "ledger-docs": {
      "url": "https://docs.integrateledger.com/mcp"
    }
  }
}
```

The server answers questions from these docs. It can't see your workspace or call the Ledger API.

## Integrate Ledger with a prompt

Paste this into your coding agent in your app's repository. It plans first, then builds the integration in Sandbox.

```text Prompt wrap theme={"system"}
Integrate Ledger, credit billing with docs at https://docs.integrateledger.com, into this app.

Read https://docs.integrateledger.com/llms.txt first, then the pages you need as Markdown (append .md to a page URL). The OpenAPI spec is at https://docs.integrateledger.com/openapi.json.

1. Propose a catalog for this app: features (actions and their credit cost), plans (monthly credits and price, with one free plan) and credit packs. Wait for my approval.
2. Use the official SDK for this codebase's language (`integrateledger` on npm or PyPI). Read the key from the LEDGER_API_KEY environment variable on the server. Never send it to the browser.
3. Write the approved catalog to ledger.catalog.json (or ledger.config.ts in a JavaScript project) and publish it with `npx integrateledger-cli push`, using the Sandbox key.
4. Create or get a Ledger customer for each user, with our own user ID as customerId. Attach the free plan on signup.
5. Gate each metered action with POST /v1/check, then call POST /v1/track after it succeeds, with a request_id unique to that action. Handle 409 insufficient_credits from track.
6. Add a billing page: plan, balance, purchase history, plan Checkout and upgrades, a credit pack top-up, and stop or resume renewal. Re-read state from the backend after Checkout; never trust the redirect.
7. Write tests for the metering path, and tell me how to try it with Stripe test cards.
```

## Ledger skills

Three [agent skills](https://agentskills.io) take your agent through onboarding. Start one in your app's repository with:

```text Prompt wrap theme={"system"}
Add Ledger billing to my app: docs.integrateledger.com/skill.md
```

| Skill | What it does | Where it comes from |
| - | - | - |
| `ledger-setup` | Runs onboarding from start to finish: reads your pricing, connects to your Sandbox, then hands over to the other two | [`/skill.md`](https://docs.integrateledger.com/skill.md) |
| `ledger-catalog` | Interviews you about your pricing, writes `ledger.catalog.json`, shows the table and diff, and publishes to Sandbox after your yes | `npx integrateledger-cli skills` |
| `ledger-integrate` | Adds check and track to one flow in your backend, verifies it in Sandbox, and measures the latency | `npx integrateledger-cli skills` |

The CLI writes `ledger-catalog` and `ledger-integrate` to `.agents/skills/` in your repository (`ledger init` does too), so they match the CLI version that runs their commands. Codex, Cursor and other agents read that folder. For Claude Code, link them with `npx skills add ./.agents/skills --agent claude-code --skill '*' -y`. Run `ledger skills` again after upgrading the CLI.

The skills work only in Sandbox: they refuse Live keys, never print your key, and publish nothing until you approve the diff.

## Next steps

> [card] [Setup](https://docs.integrateledger.com/getting-started/setup.md)
>
> The same integration, step by step.

> [card] [API reference](https://docs.integrateledger.com/api-reference/introduction.md)
>
> Every endpoint, with requests and responses.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.