Complete API reference for managed agent wallets, USDC payments, spending policies, and x402 micropayments.
Introduction
NexusPay is a managed payment infrastructure for AI agents. It provides agent wallets backed by real USDC on Base, policy-gated spending, instant P2P transfers between agents, and x402 micropayment paywalls — all via a single REST API.
ℹBase URL: https://nexuspay.app/api. All amounts are denominated in USDC (dollars). The API accepts and returns decimal values — 10.50 means $10.50 USDC.
Authentication
All API requests must include an API key in the X-Api-Key header. Keys are created per-agent and scoped to their associated wallet.
Keys are hashed with SHA-256 before storage — NexusPay never holds your plaintext key after creation. Store it immediately on first issue.
⚠API keys grant full access to the associated agent wallet. Never expose them client-side or commit them to source control.
Wallets
Agent wallets hold USDC balances and interact with the Base blockchain via Coinbase CDP. Each wallet has a unique on-chain address, an internal agent ID, and an optional spending policy.
List wallets
GEThttps://nexuspay.app/wallets
Returns all agent wallets with current balances and status.
On-chain transactions settle USDC on Base via the Coinbase CDP SDK. Every transaction is validated against the agent's active spending policy before settlement. Balances are decremented atomically before on-chain submission — if the chain call fails, the balance is refunded and the transaction is marked FAILED.
List transactions
GEThttps://nexuspay.app/transactions
Returns the transaction history with optional filters.
Parameter
Type
Description
agentId
string
Filter by agent. If omitted, returns all transactions.
⚠If the agent's spending policy blocks the transaction, the API returns HTTP 403 with policy_rejected and a breakdown of which checks failed — no funds are moved.
P2P Transfers
Agent-to-agent transfers swap balances within NexusPay's internal ledger — no gas fees, no on-chain latency. Both wallets update atomically in a single database transaction. P2P transfers are still subject to the sender's spending policy.
Transfer between agents
POSThttps://nexuspay.app/p2p
Parameter
Type
Description
fromAgentIdREQUIRED
string
Sender agent ID.
toAgentIdREQUIRED
string
Recipient agent ID. Must be an existing active wallet.
amountUsdcREQUIRED
number
Amount to transfer in USDC.
memo
string
Optional note stored with the transfer (e.g. 'Tool access fee').
Policies define the spend rules for an agent wallet. Every outgoing transaction (including P2P) is validated against the agent's active policy. A transaction is rejected if any enabled check fails — the API returns exactly which check blocked it.
x402 implements the HTTP 402 Payment Required standard for machine-to-machine micropayments. Register any API endpoint with a USDC price — when an agent hits it without a valid payment proof, they receive a 402 response with payment instructions. NexusPay auto-handles payment and retry transparently.
ℹSub-cent pricing is fully supported (e.g. 0.0001 USDC = $0.0001). This makes per-request monetisation economically viable for the first time.
NexusPay issues DID-compatible verifiable credentials so agents can prove their identity and spending authority to third-party services — without sharing private keys.
Issue credential
POSThttps://nexuspay.app/identity
Parameter
Type
Description
agentIdREQUIRED
string
Agent to issue the credential for.
claims
object
Arbitrary claims to embed in the credential JWT.
expiresInSeconds
number
Credential TTL in seconds. Defaults to 3600 (1 hour).
nexuspay-agentkit is an official action provider for Coinbase AgentKit. Drop it into any AgentKit-powered agent to give it managed USDC wallets, spending policies, P2P transfers, and x402 micropayments — no custom tool-wrapping required.
Installation
bash
npm install nexuspay-agentkit @coinbase/agentkit
Then wire it into your AgentKit setup:
typescript
import { AgentKit } from "@coinbase/agentkit";
import { getLangChainTools } from "@coinbase/agentkit-langchain";
import { nexusPayActionProvider } from "nexuspay-agentkit";
import { createReactAgent } from "@langchain/langgraph/prebuilt";
import { ChatOpenAI } from "@langchain/openai";
const agentKit = await AgentKit.from({
cdpApiKeyName: process.env.CDP_API_KEY_NAME!,
cdpApiKeyPrivateKey: process.env.CDP_API_KEY_PRIVATE_KEY!,
actionProviders: [
nexusPayActionProvider({
baseUrl: process.env.NEXUSPAY_URL!, // your NexusPay deployment
apiKey: process.env.NEXUSPAY_API_KEY!, // from Dashboard → API Keys
}),
],
});
const tools = await getLangChainTools(agentKit);
const agent = createReactAgent({
llm: new ChatOpenAI({ model: "gpt-4o" }),
tools,
});
ℹThe plugin works with any LLM framework that AgentKit supports — LangChain, LangGraph, Vercel AI SDK, and plain tool arrays. nexusPayActionProvider is framework-agnostic.
Actions reference
Every action returns a JSON string. The agent can read and reason over the response automatically.
Action
Description
nexuspay_get_balance
Get USDC balance for an agent wallet
nexuspay_list_wallets
List all agent wallets and balances
nexuspay_create_wallet
Create a new CDP-backed agent wallet on Base
nexuspay_send_payment
Send USDC on-chain to any address
nexuspay_p2p_transfer
Instant zero-gas transfer between agents
nexuspay_pay_x402
Pay an x402 paywall to gain API access
nexuspay_list_transactions
List recent transactions with filters
nexuspay_check_policies
Check spending limits for an agent
nexuspay_create_policy
Set spending limits for an agent wallet
Example prompts your agent will understand naturally:
text
"Check the balance of agent-researcher before sending the payment"
"Transfer $2.50 to agent-writer for the content it generated"
"Pay the inference API at /api/premium/gpt4 using agent-alpha's wallet"
"Set a $10 daily limit on agent-beta's spending"
"Show me the last 10 transactions from agent-alpha"
Multi-agent example
Agent-to-agent payments are instant and zero-gas using P2P transfers. Orchestrators can pay sub-agents programmatically without any human intervention.
typescript
// Agent B just completed its task — pay it from the orchestrator
await agent.invoke({
messages: [{
role: "user",
content: `
Agent B finished the data analysis task.
Transfer $5 USDC from agent-orchestrator to agent-analyst as payment.
Then confirm the remaining balance on agent-orchestrator.
`,
}],
});
// The agent will call:
// nexuspay_p2p_transfer({ fromAgentId: "agent-orchestrator", toAgentId: "agent-analyst", amountUsdc: 5 })
// nexuspay_get_balance({ agentId: "agent-orchestrator" })
ℹP2P transfers settle instantly with no gas fees. On-chain settlement via nexuspay_send_payment is for external addresses and takes one Base block (~2 s).
Error Reference
All errors return a consistent shape with an HTTP status code and a human-readable message.