Documentation

Everything you need to give your AI agents the ability to transact autonomously across crypto, card, and ACH payment rails.

Base URL: https://AgentPayment/api/v1

Quickstart

Get your first agent-to-agent payment running in under 5 minutes.

1. Sign up and get your API keys

Go to AgentPayment and sign up. Here's what happens:

  1. First email arrives immediately — contains your Sandbox Agent ID + API Key and a verification link
  2. Click the verification link — confirms your email (link expires in 24 hours)
  3. Second email arrives — contains your Live Agent ID + API Key for real payments
Start with sandbox immediately — no verification needed. Sandbox agents start with $1,000 simulated balance and use the same SDK calls as live.
Only real email addresses accepted — disposable and temporary email domains are blocked.

2. Install the SDK

terminal
pip install agent-payment-sdk

3. Make your first payment (sandbox)

quickstart.py
from agent_payment_sdk import AgentPaymentClient

# Use your sandbox credentials — no real money moves
consumer = AgentPaymentClient(api_key="apn_your_sandbox_api_key")
provider = AgentPaymentClient(api_key="apn_provider_sandbox_api_key")

# Step 1 — Consumer sets auto-billing rule once
consumer.set_billing_rule(
    max_amount=50.00,
    preferred_rail="card",  # card | crypto | bank
    approved_provider_id="sandbox_provider_agent_id"
)

# Step 2 — Provider creates invoice — auto-paid instantly
invoice = provider.create_invoice(
    to_agent_id="sandbox_consumer_agent_id",
    amount=3.00,
    description="API usage — 5 calls @ $0.60",
    payment_rail="card"
)

print(invoice["status"])      # PAID
print(invoice["invoice_id"])   # uuid
print(invoice["transaction_id"])  # uuid

4. Manage your agents

Visit your Agent Dashboard to create additional agents, rotate API keys, and monitor your account — no code needed.

Sandbox vs Live

AgentPayment provides two environments — sandbox for testing and live for real payments.

FeatureSandboxLive
Agent ID prefixsandbox_agent_
Real moneyNo — simulated balance ($1,000)Yes
Crypto paymentsSimulated tx hashReal ETH on Base Mainnet
Card paymentsStripe test modeStripe live mode
ACH paymentsPlaid sandboxPlaid production
Mixing sandbox/live❌ Not allowed — returns error
Never mix sandbox and live agents in the same payment or invoice. The API will return a sandbox_live_mismatch error.

Authentication

All API requests require an API key passed in the X-API-Key header.

terminal
curl https://AgentPayment/api/v1/agents/agent_abc123 \
  -H "X-API-Key: apn_your_api_key_here"
HeaderValueRequired
X-API-KeyYour agent API key (starts with apn_)Yes
Content-Typeapplication/jsonFor POST requests
Never expose your API key in client-side code or public repositories.

Crypto (ETH / USDC / Base)

Non-custodial crypto payments on Base Mainnet. Agents sign transactions client-side with their own private key — the platform never holds funds. Our router contract splits the payment atomically on-chain: receiver gets their amount, platform fee is taken in the same transaction.

Prerequisites

  • Both agents must have verified wallet addresses (see Wallet Verification)
  • Sending agent wallet must have sufficient ETH for payment + gas (~$0.001 on Base)
  • Install SDK with crypto support: pip install agent-payment-sdk[crypto]

Send a crypto payment (ETH)

crypto_payment.py
from agent_payment_sdk import AgentPaymentClient

# agent_private_key stays on your machine — never sent to the platform
client = AgentPaymentClient(
    api_key="apn_your_api_key",
    agent_private_key="0xYourAgentPrivateKey"
)

# Get nonce and gas price
nonce = client._request("GET", "/api/v1/payments/nonce", params={"address": "0xYourWalletAddress"})
gas = client._request("GET", "/api/v1/payments/gas-price")

# Send payment — router contract splits fee atomically on-chain
result = client.send_crypto_payment(
    from_agent_id="agent_sender_id",
    to_agent_id="agent_receiver_id",
    amount_wei=935860781350166,  # ~$2 in wei
    to_wallet_address="0xReceiverWalletAddress",
    gas_price=gas["gas_price_wei"],
    nonce=nonce["nonce"],
    chain_id=8453  # Base Mainnet
)
print(result["tx_hash"])       # 0xdf5a83a5...
print(result["basescan_url"])  # https://basescan.org/tx/0x...
print(result["message"])       # Transaction broadcast to Base Mainnet. Platform never held your funds.

USDC payments

usdc_payment.py
# USDC — stable value, 1:1 USD, no price volatility
payment = client._request("POST", "/api/v1/payments/create", json={
    "from_agent_id": "agent_sender_id",
    "to_agent_id": "agent_receiver_id",
    "amount": 10.00,
    "currency": "USDC",
    "payment_method": "crypto"
})
CurrencyUse CaseFee
ETHNative crypto, flexible amounts, on-chain fee split via router contract0.5%
USDCStable value, predictable billing, no price volatility0.5%

Router contract: 0xB4732569092a4DFfd18A2D1A37bD8d3A4B0C291e on Base Mainnet. View on BaseScan

Stripe Cards

Process card payments via Stripe Connect. Money flows directly from consumer's card to provider's Stripe account. AgentPayment fee: 0.5% (Free) / 0.3% (Pro) / 0.2% (Business). Stripe's processing fees are charged separately by Stripe.

Consumer setup — save a card

💳 Hosted Card Setup Page — no frontend code needed.

Simply redirect your user to:
https://AgentPayment/setup-card.html?agent_id=YOUR_AGENT_ID&api_key=YOUR_API_KEY&callback_url=YOUR_CALLBACK_URL

URL parameters:
  agent_id — the consumer agent ID saving the card
  api_key — the agent's API key
  callback_url — (optional) redirect URL after card is saved. Receives ?status=success&payment_method_id=xxx&agent_id=xxx

The page handles Stripe.js card collection securely — card details never touch your server.

Or integrate manually — Step 1: Create a SetupIntent to collect card details:

terminal
curl -X POST https://AgentPayment/api/v1/payment-methods/card/setup \
  -H "X-API-Key: apn_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"agent_id": "agent_your_id"}'

# Returns: client_secret, setup_intent_id, customer_id

Step 2: Use the client_secret with Stripe.js to collect card details, then confirm:

terminal
curl -X POST https://AgentPayment/api/v1/payment-methods/card/confirm \
  -H "X-API-Key: apn_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "agent_your_id",
    "payment_method_id": "pm_xxx"
  }'

Provider setup — receive card payments

Providers must complete Stripe Connect onboarding once to receive card payments directly:

terminal
curl -X POST https://AgentPayment/api/v1/billing/connect/onboard \
  -H "X-API-Key: apn_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"agent_id": "agent_your_id"}'

# Returns: onboarding_url — open in browser to complete KYC
Stripe Connect onboarding takes ~5 minutes. Once complete, card payments route directly to your Stripe account — we never hold your funds.

Pay with card

card_payment.py
payment = client.create_payment(
    from_agent_id="agent_sender_id",
    to_agent_id="agent_receiver_id",
    amount=25.00,
    currency="USD",
    payment_method="stripe_card"
)

ACH Bank Transfer

Bank transfers via Plaid (account linking) + Stripe Connect (processing). Best for high-value settlements. AgentPayment fee: 0.5% (Free) / 0.3% (Pro) / 0.2% (Business). Stripe ACH fees are charged separately by Stripe. Settlement: 2-3 business days.

Consumer setup — link a bank account

🏦 Hosted Bank Setup Page — no frontend code needed.

Simply redirect your user to:
https://AgentPayment/setup-bank.html?agent_id=YOUR_AGENT_ID&api_key=YOUR_API_KEY&callback_url=YOUR_CALLBACK_URL

URL parameters:
  agent_id — the consumer agent ID linking the bank
  api_key — the agent's API key
  callback_url — (optional) redirect URL after bank is linked. Receives ?status=success&payment_method_id=xxx&agent_id=xxx

The page handles Plaid Link securely — bank credentials never touch your server.

Or integrate manually — Step 1: Get a Plaid link token:

terminal
curl -X POST https://AgentPayment/api/v1/payment-methods/bank-account/link-token \
  -H "X-API-Key: apn_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"agent_id": "agent_your_id"}'

# Returns: link_token — use with Plaid Link to connect bank

Step 2: After user completes Plaid Link, exchange the public token:

terminal
curl -X POST https://AgentPayment/api/v1/payment-methods/bank-account \
  -H "X-API-Key: apn_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "agent_your_id",
    "public_token": "public-sandbox-xxx",
    "account_id": "account_id_from_plaid"
  }'

Provider setup — receive ACH payments

Same as card — complete Stripe Connect onboarding once (see Provider Setup above).

Pay with ACH

ach_payment.py
payment = client.create_payment(
    from_agent_id="agent_sender_id",
    to_agent_id="agent_receiver_id",
    amount=500.00,
    currency="USD",
    payment_method="bank"
)

External Payments (Accountless)

Any AI agent — even one with no AgentPayment account — can pay an invoice from a registered provider. This is the Accountless Payment Protocol pattern: the payer discovers payment requirements, sends funds, and receives an access token to prove payment.

No registration required on the payer side. Works with any ETH wallet, Stripe card, or ACH bank account.

How it works

  1. Provider (registered) creates an invoice as normal
  2. Provider shares the invoice_id with the external payer
  3. External payer fetches payment details — no API key needed
  4. External payer sends ETH / card / ACH payment
  5. Platform issues a signed access_token
  6. Payer passes access_token to provider to unlock the service
  7. Provider verifies token — no API key needed to verify

Step 1 — Provider creates invoice

from agent_payment_sdk import AgentPaymentClient

provider = AgentPaymentClient(api_key="your_api_key")

invoice = provider.create_invoice(
    to_agent_id=None,          # no consumer account required
    amount=5.00,
    currency="USD",
    payment_rail="crypto",
    description="AI data feed access — 1 hour"
)
invoice_id = invoice["invoice_id"]
# Share invoice_id with the external payer

Step 2 — External payer fetches payment info

No SDK or account needed. Any HTTP client works.

# No API key required
info = AgentPaymentClient.get_invoice_pay_info(
    invoice_id=invoice_id,
    base_url="https://AgentPayment"
)
# Returns: amount, currency, receiver_wallet, accepted_rails
print(info["accepted_rails"])
# [{"rail": "crypto", "receiver_wallet": "0x...", "network": "base-mainnet"}]
GET/api/v1/invoices/{invoice_id}/pay-info

Public — no authentication required. Returns payment details.

Step 3 — External payer pays (crypto)

from agent_payment_sdk import AgentPaymentClient

# Payer has NO AgentPayment account — just an ETH wallet
receipt = AgentPaymentClient.pay_external_invoice(
    invoice_id=invoice_id,
    rail="crypto",
    private_key="0x...",       # payer's ETH private key
    base_url="https://AgentPayment"
)

access_token = receipt["access_token"]
# Pass access_token to the provider to unlock the service

Step 3 (alternative) — External payer pays (card)

receipt = AgentPaymentClient.pay_external_invoice(
    invoice_id=invoice_id,
    rail="card",
    payment_method_id="pm_...",   # Stripe Payment Method ID from Stripe.js
    payer_email="agent@example.com",
    base_url="https://AgentPayment"
)
POST/api/v1/invoices/{invoice_id}/pay-external

Public — no authentication required.

FieldRequiredDescription
railYescrypto, card, or ach
tx_hashCrypto onlyOn-chain tx hash of your ETH transfer to provider wallet
payer_walletCrypto onlyYour ETH wallet address
payment_method_idCard/ACH onlyStripe pm_... token from Stripe.js
payer_emailNoOptional — for receipt

Step 4 — Provider verifies access token

# Provider verifies before granting service access
result = AgentPaymentClient.verify_external_payment(
    invoice_id=invoice_id,
    access_token=token_from_payer,
    base_url="https://AgentPayment"
)

if result["valid"]:
    grant_access_to_service()
    print(f"Verified — payer: {result['payer_wallet']}")
GET/api/v1/invoices/{invoice_id}/access/{token}

Public — no authentication required. Returns {"valid": true} if payment confirmed.

Access tokens expire after 24 hours. The payer must re-pay to get a new token after expiry.

Partial & Installment Payments

Invoices can be paid in multiple installments. A consumer with a billing rule capped below the invoice amount automatically pays their maximum — the remainder stays pending for later.

How partial payments work

  1. Provider creates invoice for $100
  2. Consumer has billing rule max $40 — auto-pays $40 instantly
  3. Invoice status becomes PARTIAL_PAID, amount_remaining: 60
  4. Consumer raises their limit or manually pays the rest
  5. Invoice becomes PAID when fully settled

Check invoice balance

invoice = provider.get_invoice(invoice_id)
print(invoice["amount_paid"])       # 40.0
print(invoice["amount_remaining"])  # 60.0
print(invoice["status"])            # PARTIAL_PAID
print(invoice["partial_payments"])  # 1

Pay the remaining balance

# Consumer pays the full remaining balance
consumer = AgentPaymentClient(api_key="consumer_api_key")
result = consumer._request(
    "POST",
    f"/api/v1/invoices/{invoice_id}/pay-remaining"
)
print(result["status"])  # PAID

Pay a specific partial amount

# Pay only $25 of the $60 remaining
result = consumer._request(
    "POST",
    f"/api/v1/invoices/{invoice_id}/pay-remaining",
    json={"partial_amount": 25.00}
)
print(result["amount_remaining"])  # 35.0
POST/api/v1/invoices/{invoice_id}/pay-remaining

Authenticated — requires consumer API key. Optional body: {"partial_amount": float}

List invoices with payment progress

# See all invoices with paid/remaining amounts
invoices = consumer._request("GET", "/api/v1/invoices")
for inv in invoices["invoices"]:
    print(f"{inv['invoice_id']}: "
          f"${inv['amount_paid']} paid, "
          f"${inv['amount_remaining']} remaining, "
          f"status: {inv['status']}")
Use partial payments for usage-based billing — provider invoices the full monthly amount, consumer pays in weekly installments as their budget allows.

Agent-to-Agent Billing

The pull payment model — provider agents autonomously invoice consumer agents, which auto-approve and pay instantly based on billing rules. Zero human intervention required.

How it works

  1. Consumer agent sets an auto-approval billing rule once (max amount + preferred rail)
  2. Provider agent serves a request and creates an invoice against the consumer
  3. System checks billing rule → if approved, payment processes instantly
  4. Both agents receive confirmation with transaction ID and tx hash

Step 1 — Consumer sets billing rule

consumer.py
consumer = AgentPaymentClient(api_key="apn_consumer_key")

rule = consumer.set_billing_rule(
    max_amount=10.00,           # auto-approve invoices up to $10
    preferred_rail="crypto",    # crypto | card | bank
    approved_provider_id="agent_provider_id"
)
print(rule["message"])  # Auto-approve invoices from agent_provider_id up to $10.0

Step 2 — Provider creates invoice

provider.py
provider = AgentPaymentClient(api_key="apn_provider_key")

invoice = provider.create_invoice(
    to_agent_id="agent_consumer_id",
    amount=3.00,
    description="API usage — 150 requests @ $0.02/req",
    payment_rail="crypto"
)

print(invoice["status"])      # PAID (auto-approved instantly)
print(invoice["invoice_id"])   # uuid
print(invoice["paid_at"])      # 2026-03-17T...
If the invoice amount is within the consumer's auto-approval rule, payment is instant. Otherwise it stays PENDING until manually approved via approve_invoice().

Recurring Billing

Providers register a billing schedule once — the platform fires it automatically at the chosen interval. Two models: webhook-based (Model A) or fully autonomous (Model B).

Model A — Webhook-Based

Platform fires a webhook to your callback_url at each interval. You calculate actual usage and call POST /invoices with the real amount.

Model A — Register
provider = AgentPaymentClient(api_key="apn_provider_key")

schedule = provider.create_recurring_billing(
    consumer_id="agent_consumer_id",
    frequency="1h",                # 30m, 1h, 6h, 1d, 7d, 30d
    payment_rail="CRYPTO",
    callback_url="https://your-service.com/billing-webhook",
    max_per_period=100.00,         # safety cap per cycle
    description="API usage billing"
)

At each interval, your callback_url receives:

Webhook Payload
{
  "event": "billing_due",
  "recurring_id": "f55ecdcf-...",
  "provider_id": "agent_xyz",
  "consumer_id": "agent_abc",
  "period_start": "2026-04-04T15:00:00",
  "period_end": "2026-04-04T16:00:00",
  "payment_rail": "CRYPTO",
  "max_per_period": 100.0
}

Then create an invoice for the actual usage:

provider_webhook_handler.py
# In your webhook handler:
usage = calculate_usage(period_start, period_end)

invoice = provider.create_invoice(
    to_agent_id="agent_consumer_id",
    amount=usage,
    payment_rail="CRYPTO",
    description="API usage 15:00-16:00 UTC"
)
# Consumer billing rule auto-pays if within limit

Model B — Fully Autonomous

Platform calls your usage_endpoint at each interval, creates the invoice, and triggers auto-payment. Zero involvement after setup.

Model B — Register
schedule = provider.create_recurring_billing(
    consumer_id="agent_consumer_id",
    frequency="1h",
    payment_rail="CRYPTO",
    usage_endpoint="https://your-service.com/usage",
    max_per_period=100.00,
    description="API usage billing"
)
# AgentPayment auto-generates a secure token — store it once:
token = schedule["usage_auth_token"]  # e.g. "a3f9c2e1d4b7..."
Zero-effort security. AgentPayment auto-generates a cryptographically secure usage_auth_token at registration and returns it once. The platform sends it as Authorization: Bearer <token> on every usage pull — verify it on your endpoint. After that, everything runs autonomously. If ever compromised, rotate with POST /api/v1/recurring-billing/{id}/rotate-token.

Your usage_endpoint receives a POST and must return:

Usage Endpoint Contract
# Platform sends:
{
  "recurring_id": "f55ecdcf-...",
  "consumer_id": "agent_abc",
  "period_start": "2026-04-04T15:00:00",
  "period_end": "2026-04-04T16:00:00"
}

# Your response:
{ "amount": 42.50 }  # Return 0 to skip invoicing this period

Manage Schedules

manage.py
# List active schedules
schedules = provider.list_recurring_billing()

# Cancel a schedule
provider.cancel_recurring_billing(recurring_id="f55ecdcf-...")
Consumer prerequisite: The consumer must have an active billing rule approving the provider. See A2A Billing for setup.

Frequency Options

ValueInterval
30mEvery 30 minutes (minimum)
1hEvery hour
6hEvery 6 hours
1dDaily
7dWeekly
30dMonthly (maximum)

Complete A2A Example

A real-world example: a data provider agent sells market data to a consumer agent. Two independent Python processes — exactly how your clients will build.

Provider agent (DataFeed API — sells market data)

provider_agent.py
from http.server import HTTPServer, BaseHTTPRequestHandler
from agent_payment_sdk import AgentPaymentClient
import json, threading, time

PROVIDER_API_KEY  = "apn_your_provider_key"
CONSUMER_ID       = "agent_consumer_id"
PRICE_PER_CALL    = 0.60   # $0.60 per API call
CALLS_PER_INVOICE = 5      # invoice every 5 calls = $3.00

provider     = AgentPaymentClient(api_key=PROVIDER_API_KEY)
call_counter = 0
pending      = []

class DataFeedHandler(BaseHTTPRequestHandler):
    def do_GET(self):
        global call_counter, pending
        if self.path.startswith("/data"):
            call_counter += 1
            pending.append(call_counter)
            payload = {"market": "ETH/USD", "price": 2000.00 + call_counter * 0.50}
            self._respond(200, payload)

            # Invoice after every 5 calls
            if len(pending) >= CALLS_PER_INVOICE:
                calls, pending = pending[:], []
                threading.Thread(target=self._invoice, args=(calls,)).start()

    def _invoice(self, calls):
        amount  = round(len(calls) * PRICE_PER_CALL, 2)
        invoice = provider.create_invoice(
            to_agent_id=CONSUMER_ID,
            amount=amount,
            description=f"DataFeed API: {len(calls)} calls x ${PRICE_PER_CALL}",
            payment_rail="card"  # card | crypto | bank
        )
        print(f"Invoice ${amount} → {invoice['status']} in {invoice.get('ms', '~2000')}ms")

    def _respond(self, code, data):
        body = json.dumps(data).encode()
        self.send_response(code)
        self.send_header("Content-Type", "application/json")
        self.end_headers()
        self.wfile.write(body)

    def log_message(self, *args): pass

print("Provider API running on :8765 — invoicing every 5 calls")
HTTPServer(("0.0.0.0", 8765), DataFeedHandler).serve_forever()

Consumer agent (ResearchBot — calls API, pays automatically)

consumer_agent.py
from agent_payment_sdk import AgentPaymentClient
import requests, time

CONSUMER_API_KEY = "apn_your_consumer_key"
PROVIDER_ID      = "agent_provider_id"

consumer = AgentPaymentClient(api_key=CONSUMER_API_KEY)

# Step 1 — set billing rule once (auto-pays any invoice up to $50)
consumer.set_billing_rule(
    max_amount=50.00,
    preferred_rail="card",  # card | crypto | bank
    approved_provider_id=PROVIDER_ID
)
print("Billing rule set — invoices will auto-pay")

# Step 2 — call provider API 5 times (triggers $3.00 invoice automatically)
for i in range(1, 6):
    resp = requests.get(
        "http://localhost:8765/data/market",
        headers={"X-Agent-ID": "agent_consumer_id"}
    )
    data = resp.json()
    print(f"Call #{i} — ETH/USD ${data['price']} — $0.60 queued")
    time.sleep(2)

# After 5 calls: provider auto-invoices $3.00, billing rule fires, PAID instantly
print("Done — check Terminal 1 for invoice confirmation")
Run provider_agent.py in Terminal 1 first, then consumer_agent.py in Terminal 2. After 5 API calls the provider auto-invoices $3.00 — paid instantly with zero human involvement. Verify crypto payments on BaseScan.

Provider Setup

To receive card and ACH payments, providers must complete Stripe Connect onboarding once. This takes ~5 minutes and lets Stripe route payments directly to your account.

Step 1 — Start onboarding

terminal
curl -X POST https://AgentPayment/api/v1/billing/connect/onboard \
  -H "X-API-Key: apn_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"agent_id": "agent_your_id"}'

Open the onboarding_url in your browser and complete Stripe's KYC flow.

Step 2 — Check status

terminal
curl "https://AgentPayment/api/v1/billing/connect/status?agent_id=agent_your_id" \
  -H "X-API-Key: apn_your_api_key"

# Returns: {"onboarded": true, "charges_enabled": true, "payouts_enabled": true}
Crypto payments do not require Connect onboarding — only a verified wallet address.

Wallet Setup

To use the crypto payment rail (ETH on Base Mainnet), you need a Base-compatible wallet. This takes about 5 minutes.

Step 1 — Get a wallet

You need a wallet that supports Base Mainnet. Two easy options:

WalletBest forGet it
MetaMaskBrowser extension, most popularmetamask.io
Coinbase WalletMobile, beginner friendlywallet.coinbase.com
Your wallet gives you a public address (e.g. 0x67d3...FE0F) and a private key. AgentPayment only ever needs your public address — never share your private key with anyone.

Step 2 — Add Base Mainnet to your wallet

Base is a fast, low-cost Ethereum L2. Add it to MetaMask:

Base Mainnet settings
Network Name : Base
RPC URL      : https://mainnet.base.org
Chain ID     : 8453
Symbol       : ETH
Explorer     : https://basescan.org

Or visit chainlist.org/chain/8453 and click "Add to MetaMask" — one click setup.

Step 3 — Fund your wallet with ETH on Base

You need a small amount of ETH on Base to pay for gas fees (typically $0.001–$0.01 per transaction). Two ways to get it:

MethodHow
Bridge from EthereumUse bridge.base.org to move ETH from Ethereum mainnet to Base
Buy directlyOn Coinbase, select "Base" network when withdrawing ETH
$5–10 worth of ETH is enough for hundreds of transactions on Base. Gas fees are very low (~$0.001 per tx).

Step 4 — Register your wallet with AgentPayment

For sandbox agents, just update your wallet address directly:

sandbox_wallet.py
import requests

requests.patch(
    "https://AgentPayment/api/v1/agents/me/wallet",
    json={"wallet_address": "0xYourWalletAddress"},
    headers={"X-API-Key": "apn_your_sandbox_key"}
)
# Done — no signature required for sandbox

For live agents, wallet registration requires cryptographic verification to prove ownership. Follow the steps below.

🔒 We only store your public wallet address after cryptographic verification. Private keys are never sent to our servers.

Live wallet verification — Step 1: Request a challenge

Step 1 — Request a challenge

verify_wallet.py
import requests

headers = {"X-API-Key": "apn_your_api_key"}

r = requests.post(
    "https://AgentPayment/api/v1/agents/me/wallet/challenge",
    json={"wallet_address": "0xYourWalletAddress"},
    headers=headers
)
challenge = r.json()["challenge"]
# AgentPayment wallet verification for agent_abc123: 4f2a9...

Step 2 — Sign the challenge locally

sign.py
# pip install eth-account web3
from eth_account.messages import encode_defunct
from eth_account import Account

msg = encode_defunct(text=challenge)
signed = Account.sign_message(msg, private_key="0xYourPrivateKey")
signature = signed.signature.hex()
# Private key never leaves your machine

Step 3 — Submit signature

verify.py
r = requests.post(
    "https://AgentPayment/api/v1/agents/me/wallet/verify",
    json={
        "wallet_address": "0xYourWalletAddress",
        "signature": signature
    },
    headers=headers
)
print(r.json())
# {"status": "verified", "wallet_address": "0x...", "agent_id": "agent_abc123"}
Challenges expire in 10 minutes. Sandbox agents can update wallet address directly without verification.

Account Recovery

If you lose your Agent ID or API key, you can recover them using your signup email. No authentication required for these endpoints.

Look up your Agent ID

lookup.py
import requests

r = requests.post(
    "https://AgentPayment/api/v1/agents/lookup",
    json={"email": "you@example.com"}
)
# Your Agent ID will be emailed to you

Rotate your API key

This deactivates all existing API keys and emails you a new one. Make sure to update your code with the new key.

rotate_key.py
r = requests.post(
    "https://AgentPayment/api/v1/agents/rotate-key",
    json={
        "email": "you@example.com",
        "agent_id": "agent_yourAgentId"
    }
)
# New API key will be emailed to you — old keys are immediately deactivated
Use the self-service recovery page at AgentPayment/forgot — or go straight to the Agent Dashboard to manage all your agents and keys.

API Reference

Base URL: https://AgentPayment/api/v1

Agents

GET/agents/me

Get current authenticated agent details including plan, wallet, and balance.

GET/agents/{agent_id}

Get agent details by ID. Returns public info only.

GET/agents/my-agents

List all agents under your account. Returns agents_used, agents_limit, agents_remaining, and full agent list. Requires root agent API key.

POST/agents/create-named

Create a worker agent under your account. Body: {"name": "string", "wallet_address": "0x... (optional)"}. Returns agent_id and api_key — save the key immediately.

POST/agents/{agent_id}/rotate-key

Rotate API key for a worker agent. Caller must be the root/owner agent. Old key deactivated instantly.

POST/agents/lookup

Look up agent ID by email address. Sends agent ID to the registered email. No authentication required.

POST/agents/rotate-key

Rotate API key. Provide email and agent_id — deactivates old keys and emails a new one. No authentication required.

POST/agents/me/wallet/challenge

Request a challenge string to sign for wallet verification.

POST/agents/me/wallet/verify

Submit signed challenge to verify and save wallet address.

Payments

POST/payments/create

Create a direct payment between two agents. Supports crypto, stripe_card, bank.

GET/payments/{payment_id}

Get payment details including tx hash and explorer URL.

GET/payments/history/{agent_id}

Get full payment history for an agent.

POST/payments/broadcast

Broadcast a pre-signed raw transaction. Client signs with their own private key — platform never holds funds. Required fields: from_agent_id, to_agent_id, raw_tx, amount_wei.

GET/payments/nonce

Get current nonce for a wallet address. Required: ?address=0x...

GET/payments/gas-price

Get current gas price on Base Mainnet in wei and gwei.

Payment Methods

POST/payment-methods/card/setup

Create a Stripe SetupIntent to save a card. Returns client_secret.

POST/payment-methods/card/confirm

Confirm and save card after SetupIntent completes.

POST/payment-methods/bank-account/link-token

Get a Plaid link token to start bank account connection.

POST/payment-methods/bank-account

Save a bank account using Plaid public token and account ID.

GET/payment-methods/list/{agent_id}

List all saved payment methods for an agent.

Agent-to-Agent Billing

POST/invoices

Create an invoice from provider to consumer. Auto-pays if billing rule matches.

POST/invoices/{invoice_id}/pay

Manually approve and pay a pending invoice.

GET/invoices

List invoices for current agent. Use ?role=provider or ?role=consumer.

POST/billing-rules

Set auto-approval billing rule for a trusted provider.

GET/billing-rules

List all active billing rules for current agent.

Connect (Provider Onboarding)

POST/billing/connect/onboard

Create Stripe Connect account and get onboarding URL for provider.

GET/billing/connect/status

Check Connect onboarding status for a provider agent.

Error Codes

All errors return a JSON body with a detail field describing the issue.

HTTP CodeErrorMeaning
400Bad requestMissing or invalid parameters
400sandbox_live_mismatchCannot mix sandbox and live agents
400verification_requiredLive agents must use challenge/signature for wallet
401UnauthorizedInvalid or missing API key
402insufficient_balanceInsufficient ETH or account balance
402card_declinedStripe declined the card
402connect_requiredProvider must complete Stripe Connect onboarding
403agent_limit_reachedPlan agent limit reached — upgrade to create more
403agent_limit_reachedPlan agent limit reached — upgrade to create more
403agent_limit_reachedPlan agent limit reached — upgrade to create more
404Not foundAgent or resource does not exist
409ConflictDuplicate resource (e.g. card already saved)
429Rate limitedToo many requests — 3/min, 10/hour per IP
500Server errorContact support@AgentPayment

Multi-Agent Management

Each account can run multiple agents under a single email. Your root agent (created at signup) is the account owner. Sub-agents are workers — each with their own agent ID and API key for making payments.

PlanMax Agents
Free5
Pro50
BusinessUnlimited
EnterpriseUnlimited
Your root agent's API key is the master credential. Use it to create, list, and manage all worker agents.

Create a Worker Agent

Use your root agent's API key to create additional agents under your account.

POST /api/v1/agents/create-named

Creates a new worker agent under your account. Returns the agent ID and API key — save the key immediately, it won't be shown again.

curl -X POST https://api.AgentPayment/api/v1/agents/create-named \
  -H "X-API-Key: your_root_api_key" \
  -H "Content-Type: application/json" \
  -d '{"name": "ResearchBot", "wallet_address": "0x..."}'
{
  "agent_id": "agent_b26fad67a6dc",
  "name": "ResearchBot",
  "api_key": "apn_xxx",
  "plan": "free",
  "warning": "SAVE THIS API KEY NOW — it cannot be retrieved later"
}

SDK equivalent:

from agent_payment_sdk import AgentPaymentClient

client = AgentPaymentClient(api_key="your_root_api_key")

# Create a worker agent
agent = client.create_agent(
    name="ResearchBot",
    wallet_address="0x..."  # optional
)

List Your Agents

Returns all agents under your account including usage vs plan limit.

GET /api/v1/agents/my-agents

Lists all agents created under your account with plan limit info.

curl https://api.AgentPayment/api/v1/agents/my-agents \
  -H "X-API-Key: your_root_api_key"
{
  "account_agent_id": "agent_acb7de7a8916",
  "plan": "free",
  "agents_used": 2,
  "agents_limit": 5,
  "agents_remaining": 3,
  "agents": [
    {
      "agent_id": "agent_acb7de7a8916",
      "name": "My Root Agent",
      "wallet_address": "0x67d3...",
      "plan": "free",
      "created_at": "2026-03-15T01:16:14"
    },
    {
      "agent_id": "agent_b26fad67a6dc",
      "name": "ResearchBot",
      "wallet_address": null,
      "plan": "free",
      "created_at": "2026-03-27T22:12:03"
    }
  ]
}

Rotate a Worker Agent's API Key

If a worker agent's API key is lost or compromised, rotate it using your root agent's API key.

POST /api/v1/agents/{agent_id}/rotate-key

Rotates the API key for the specified agent. Caller must be the account owner (root agent).

curl -X POST https://api.AgentPayment/api/v1/agents/agent_b26fad67a6dc/rotate-key \
  -H "X-API-Key: your_root_api_key"
{
  "message": "API key rotated successfully",
  "api_key": "apn_new_key_here"
}
Save the new API key immediately — it won't be shown again. The old key is deactivated instantly.