# bare.money (llms.txt) > Spending limits and a USDC vault for AI agents. Agents pay any x402 (HTTP 402) merchant with real USDC on Base; bare. enforces per-agent caps before the vault signs. ## Facts - Protocol: x402 v2, scheme "exact" (EIP-3009 transferWithAuthorization) - Network: Base Sepolia (testnet) (CAIP-2 eip155:84532, chain id 84532) -- TESTNET, test USDC only - Asset: native USDC 0x036CbD53842c5426634e7929541eC2318f3dCF7e - Headers: PAYMENT-REQUIRED (402 response), PAYMENT-SIGNATURE (paid retry), PAYMENT-RESPONSE (settlement result). All base64 JSON. - Payer: every account has its own vault (its own address). The vault an agent belongs to signs that agent's payments. Agents hold API keys, never wallets or private keys. - Explorer: https://sepolia.basescan.org ## Authentication Every agent endpoint takes `Authorization: Bearer `. Keys are issued by the vault's owner in Bare Cloud, or by an owner-approved pairing request (section 5). A key only ever spends from the vault it was issued by. ## 1. Paying an external x402 merchant 1. Call the merchant. It answers `402` with a base64 `PAYMENT-REQUIRED` header (x402 PaymentRequired). 2. Ask bare. to authorize it: ```http POST /api/v1/pay Authorization: Bearer Content-Type: application/json { "paymentRequired": "", "resourceUrl": "", "request": { "method": "POST", "body": "" } } ``` Before signing, bare. replays that same unpaid request to the merchant and checks it answers 402 with the same `payTo` and `amount`. If it does not, you get 403 `SPENDGUARD_CHALLENGE_UNVERIFIED`. The merchant host must be public https and in your agent's allowlist. Success (200): ```json { "status": "authorized", "authorizationId": "tx_...", "header": "PAYMENT-SIGNATURE", "paymentSignature": "", "amountUsdc": "0.05", "payTo": "0x...", "network": "eip155:84532", "validBefore": 1790000000, "confirmUrl": "/api/v1/pay/confirm" } ``` 3. Retry the original request with header `PAYMENT-SIGNATURE: `. The merchant's facilitator settles it on-chain. 4. Report the merchant's `PAYMENT-RESPONSE` header so the ledger records the real transaction: ```http POST /api/v1/pay/confirm Authorization: Bearer Content-Type: application/json { "authorizationId": "tx_...", "paymentResponse": "" } ``` bare. checks on-chain that the transaction consumed this authorization before accepting it. Authorizations the merchant never settles expire at `validBefore` and the budget is returned. A one-file client does all four steps. Download it from this site (there is no npm package; do not install one claiming to be bare.money): ```js // curl -O https://bare.money/sdk/bare.js import { bareFetch } from './bare.js'; const res = await bareFetch('https://merchant.example/api', { agentKey: process.env.BARE_AGENT_KEY }); ``` ## 2. SpendGuard rejections Rejected payments return 4xx with a machine-readable `spendguard` object. Read `spendguard.remediation.suggested_action`: - `SPENDGUARD_CAP_EXCEEDED` (403): over the single-transaction cap. Split the order or request an elevation. - `SPENDGUARD_DAILY_LIMIT_EXCEEDED` (403, Retry-After): over the UTC-day budget. Wait or request an elevation. - `SPENDGUARD_DOMAIN_NOT_ALLOWED` (403): merchant host not in this agent's allowlist. Ask the vault owner. - `SPENDGUARD_CHALLENGE_UNVERIFIED` (403): the merchant did not confirm this recipient and amount. Resend with the exact URL, method and body. Merchants that need a login before quoting a price must be marked trusted for your agent by the vault owner. - `SPENDGUARD_KILL_SWITCH_ACTIVE` / `SPENDGUARD_AGENT_FROZEN` (403): stop. A human must intervene. - `SPENDGUARD_INSUFFICIENT_VAULT_BALANCE` (402): the vault needs more USDC. ### Requesting a human-approved elevation ```http POST /api/v1/elevations Authorization: Bearer { "amount_usdc": 12.50, "resource": "GPU batch", "sku": "OPTIONAL-SKU", "quantity": 1, "reason": "why this is needed" } ``` Poll `GET /api/v1/elevations?id=` until `status` is `approved`, then retry with header `x-bare-elevation-id: `. An elevation is single-use and bound to its amount (and SKU/quantity if given). ## 3. Buying from the bare. storefront Catalog: `GET /.well-known/bare-products.json` (public; every storefront's SKUs, USDC prices and `merchantId`). One storefront only: `GET /.well-known/bare-products.json?merchant=`. ```http POST /api/v1/orders/checkout Authorization: Bearer { "sku": "API-CAD-01", "merchantId": "", "quantity": 1 } ``` `merchantId` is required when the same SKU exists in more than one storefront (409 `AMBIGUOUS_SKU` otherwise). Physical goods also need `"shipping": { "recipient_name", "address", "city", "postal_code", "country" }`. Your vault pays that storefront's treasury on-chain before the order is confirmed. Success returns the real `txHash` (verify at https://sepolia.basescan.org/tx/). If settlement fails you get 503 with code SETTLEMENT_FAILED (no funds moved, budget released) or SETTLEMENT_UNCONFIRMED (budget held until the payment settles or expires; check the order before retrying). Order status: `GET /api/v1/orders/:id`. Digital delivery: `GET /api/v1/orders/:id/download` (only after on-chain payment). History: `GET /api/v1/orders`. ## 4. Selling: put an x402 paywall on your own API ```js // curl -O https://bare.money/sdk/bare-gate.js import { requirePayment } from './bare-gate.js'; const gate = await requirePayment(request, { priceDollars: 0.05, payTo: '0xYourReceivingAddress', network: 'base-sepolia', facilitator: 'https://x402.org/facilitator' // testnet; use the Coinbase CDP facilitator on mainnet }); if (!gate.ok) return gate.response; // 402 with PAYMENT-REQUIRED return gate.withReceipt(Response.json(data)); // adds PAYMENT-RESPONSE with the settlement tx ``` The gate verifies the EIP-3009 signature and settles it on-chain before your handler runs. Live example: `GET /api/v1/cad-quote` ($0.05). ## 5. Pairing a new agent (operator approval required) ```http POST /api/v1/agents/pair { "vaultId": "", "name": "Research-Bot", "role": "market analysis", "dailyLimit": 5, "singleTxCap": 1 } ``` Poll `GET /api/v1/agents/pair/status?token=`. Once that vault's owner approves in Bare Cloud the response contains the API key. Limits: dailyLimit 0.01 to 500, singleTxCap up to dailyLimit; the owner can change them after approval. ## 6. Dry run `POST /api/v1/simulate` walks the full x402 handshake with real signatures from a throwaway key. Nothing is broadcast.