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/sdk

2. 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/payments
  • GET /v1/payments/:id
  • GET /v1/payments
  • POST /v1/payments/:id/refund
Agents
Register and configure agents
  • POST /v1/agents
  • GET /v1/agents/:id
  • PATCH /v1/agents/:id
  • DELETE /v1/agents/:id
Wallets
Manage agent wallets
  • POST /v1/wallets
  • GET /v1/wallets/:id
  • POST /v1/wallets/:id/fund
  • GET /v1/wallets/:id/transactions
Escrow
Conditional fund releases
  • POST /v1/escrows
  • GET /v1/escrows/:id
  • POST /v1/escrows/:id/release
  • POST /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/sdk
Python
pip install agentpay
Go
go get agentpay.com/sdk

Need help?

Our team is here to help you integrate AgentPay.