AgentPay API Documentation
Everything you need to integrate autonomous payments into your AI agents.
v1.0Last updated: April 2026
Quick Start
1. Install the SDK
npm install @agentpay/sdk2. Initialize the client
import { AgentPay } from '@agentpay/sdk';
const agentpay = new AgentPay(process.env.AGENTPAY_SECRET_KEY);3. Create your first payment
const payment = await agentpay.payments.create({
agent_id: 'agent_abc123',
amount: 4999, // $49.99 in cents
currency: 'usd',
merchant: 'Amazon',
description: 'Office supplies',
});
console.log(payment.id); // 'pay_xyz789'
console.log(payment.status); // 'completed'API Reference
Payments
Create and manage payments
POST /v1/paymentsGET /v1/payments/:idGET /v1/paymentsPOST /v1/payments/:id/refund
Agents
Register and configure agents
POST /v1/agentsGET /v1/agents/:idPATCH /v1/agents/:idDELETE /v1/agents/:id
Wallets
Manage agent wallets
POST /v1/walletsGET /v1/wallets/:idPOST /v1/wallets/:id/fundGET /v1/wallets/:id/transactions
Escrow
Conditional fund releases
POST /v1/escrowsGET /v1/escrows/:idPOST /v1/escrows/:id/releasePOST /v1/escrows/:id/dispute
Authentication
Authenticate your requests by including your API key in the Authorization header:
curl https://api.agentpay.com/v1/payments \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json"Keep your API keys secure. Never expose them in client-side code or public repositories.
Webhooks
Receive real-time notifications when events happen in your account.
Example webhook payload:
{
"id": "evt_abc123",
"type": "payment.completed",
"created": 1714329600,
"data": {
"id": "pay_xyz789",
"amount": 4999,
"currency": "usd",
"status": "completed",
"agent_id": "agent_abc123"
}
}Verifying webhook signatures:
import { AgentPay } from '@agentpay/sdk';
const event = agentpay.webhooks.constructEvent(
payload,
signature,
webhookSecret
);
// Handle the event
switch (event.type) {
case 'payment.completed':
// Handle successful payment
break;
case 'escrow.released':
// Handle escrow release
break;
}SDKs & Libraries
Node.js
npm install @agentpay/sdkPython
pip install agentpayGo
go get agentpay.com/sdkNeed help?
Our team is here to help you integrate AgentPay.