# AgentPay AgentPay is a lean payments API for agents. Base URL: https://agent-pay.sh Core workflow: 1. `POST /init` to create an account and receive the API key once 2. `POST /fund` to create a checkout link for a human to add money 3. `GET /balance` to see when funds arrive 4. `POST /spend` to create a one-time virtual card 5. `GET /cards` to review prior card activity without re-exposing card details 6. `POST /expiration` if you want to change the default 20 minute self-destruct timer Public routes: - `POST /init` - `GET /balance` - `POST /fund` - `POST /spend` - `GET /cards` - `GET /expiration` - `POST /expiration` - `GET /start` - `GET /agent` - `GET /skill` Rules: - The API key is only returned by `POST /init` - Card details are only returned by `POST /spend` - `POST /spend` immediately reserves funds from balance - Cards self-destruct after first use or when the expiration timer is reached - New cards default to 20 minutes and can be set between 1 and 1440 minutes via `/expiration` - Unused or leftover card balance is credited back automatically Examples: Create account: ```bash curl -sS -X POST https://agent-pay.sh/init ``` Check balance: ```bash curl -sS https://agent-pay.sh/balance \ -H "Authorization: Bearer YOUR_API_KEY" ``` Create funding checkout: ```bash curl -sS -X POST https://agent-pay.sh/fund \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"amount": 25}' ``` Create one-time card: ```bash curl -sS -X POST https://agent-pay.sh/spend \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"amount": 10, "memo": "buy API credits"}' ``` Set default card expiry: ```bash curl -sS -X POST https://agent-pay.sh/expiration \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"minutes": 15}' ```