> For the complete index of the 402pay docs, see [llms.txt](https://developer.402pay.co/llms.txt).

# AI agents

Coming soon.

An MCP server for Claude Code, Codex and other agents is coming soon. Until then, agents can use the API.

When it's ready, any client that speaks the Model Context Protocol will be able to create payment links and check payments through 402pay. It isn't available yet, so there's nothing to connect today.

## Use the API today

Any agent that can make HTTP requests can use the API now. Create a restricted secret key with only the access the agent needs, such as write on links and read on payments, give it to the agent through its environment, and point it at these docs.

Create a link, cURL:

```bash
curl -X POST "https://dash.402pay.co/api/v1/links" \
  -H "Authorization: Bearer $PAY402_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Pro plan",
    "amount": 4900,
    "currency": "USD"
  }'
```

Create a link, Node.js:

```js
const response = await fetch("https://dash.402pay.co/api/v1/links", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.PAY402_SECRET_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    name: "Pro plan",
    amount: 4900,
    currency: "USD"
  }),
});
const { data } = await response.json();
```

Create a link, Python:

```python
import os

import requests

response = requests.post(
    "https://dash.402pay.co/api/v1/links",
    headers={
        "Authorization": f"Bearer {os.environ['PAY402_SECRET_KEY']}",
    },
    json={
        "name": "Pro plan",
        "amount": 4900,
        "currency": "USD"
    },
)
data = response.json()["data"]
```

To point an agent at these docs, give it [llms.txt](https://developer.402pay.co/llms.txt), which lists every page with a line about each, linked to its Markdown. Any page's Markdown is at its URL plus `.md`, [llms-full.txt](https://developer.402pay.co/llms-full.txt) has every page in one file, and the menu beside Copy page opens a page in Claude or ChatGPT.

## What to ask

- "Create a $49 payment link for the Pro plan."
- "Which payments are underpaid right now?"
- "What's my USDC balance on Polygon?"

> Money never moves on an API key. An agent can read your wallet's balances, but sends happen only in the dashboard, signed in your browser with your encryption password.

> An agent with a key acts as your business within that key's access. Only give keys to agents you trust, and revoke the key when you stop using it.
