# AgentPay Gateway — Budget-Capped x402 Spending Session

> AgentPay Gateway — Budget-Capped x402 Spending Session is a paid API for AI agents from agentpay.tools, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-14).

Creates a budget-capped USDC spending session for an AI agent, returning a session ID, verifiable on-chain receipt, and gateway URL for subsequent tool calls.

## Facts

- Endpoint: POST https://agentpay.tools/v1/session/create
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agentpay-gateway-budget-capped-x402-spending-session-44595350
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Ba0nmc8jZjI4-kl_JRAga

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agentpay-gateway-budget-capped-x402-spending-session-44595350 -d '<json body>'
```

Example prompt: Start a budget-capped AgentPay spending session for my agent wallet 0xABC123...def with a hard cap of 0.10 USDC and label it 'research-run-1', then give me the session ID and receipt.

## When to prefer this

Choose this endpoint when an AI agent needs a hard budget cap enforced at the protocol level before making multiple downstream paid API calls — especially in autonomous or unattended workflows where cost overruns are a risk. Prefer this over ad-hoc per-call x402 payments when you need a verifiable on-chain receipt and a single session token to govern a batch of tool calls. Best suited for Base (EVM) wallets paying in USDC.

## Known failure modes

- Insufficient USDC balance in agent wallet — payment cannot be processed
- Invalid or malformed EVM agent_address — returns 400 bad request
- max_spend value is not a valid decimal string — returns validation error
- x402 payment header missing or rejected — returns 402 Payment Required
- Network congestion on Base causing transaction confirmation delay
- Session creation idempotency not guaranteed — duplicate calls create duplicate sessions and charges

## How this service works

A stateful, multi-chain spending session for AI agents. One session enforces a hard USDC budget cap across every tool call, with a verifiable receipt and running ledger for each payment — not a one-shot budget check, but persistent spend governance with a full audit trail. USDC on Base (standard x402) or Stellar (via the AgentPay SDK).

## Output

Returns a JSON object containing a unique session_id (UUID), the hard budget max_spend in USDC, the gateway_url and tools_endpoint for subsequent calls, a created_at ISO timestamp, and a receipt object with the Base network identifier, the on-chain transaction hash, and the confirmed USDC amount charged to open the session.

## Example request

```json
{
 "label": "QA Test Session",
 "max_spend": "0.10",
 "agent_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f42bE5"
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "label": {
   "type": "string",
   "description": "Optional human-readable session label"
  },
  "max_spend": {
   "type": "string",
   "description": "Hard budget cap in USDC, e.g. '0.10'"
  },
  "agent_address": {
   "type": "string",
   "description": "Paying agent's EVM wallet address"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "receipt": {
  "network": "base",
  "tx_hash": "0x...",
  "amount_usdc": "0.01"
 },
 "max_spend": "0.10",
 "created_at": "2026-05-27T00:00:00Z",
 "session_id": "uuid",
 "gateway_url": "https://agentpay.tools",
 "agent_address": "G...",
 "tools_endpoint": "https://agentpay.tools/tools"
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agentpay-gateway-budget-capped-x402-spending-session-44595350/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agentpay.tools](https://www.zero.xyz/host/agentpay.tools/llms.txt)
