Management SDK
Use the StableOps Agent Payments management SDK in a trusted TypeScript service to configure Agents, wallets, policies, budgets, approvals, and payment queries.
@stableops/agent-payments-api-sdk is the dedicated Agent Payments management client. Run it only in a trusted operator service, never in an Agent runtime or browser bundle.
Install
pnpm add @stableops/agent-payments-api-sdkCreate a management client
The management API key scopes the organization, environment, and product:
import { StableOpsAgentPayments } from '@stableops/agent-payments-api-sdk'
const apiKey = process.env.STABLEOPS_API_KEY?.trim()
if (!apiKey) throw new Error('Missing STABLEOPS_API_KEY')
const management = new StableOpsAgentPayments({
apiKey,
})ak_sandbox_ or ak_live_.Available resources
| Resource | Main operations |
|---|---|
management.agents | Manage Agents, Agent Keys, and immutable policy versions |
management.wallets | Pair, list, bind, and unbind customer-owned wallets |
management.budgets | Read or update organization and Agent daily budgets within platform ceilings |
management.approvals | Read approval records |
management.payments | Filter or export payments, and read state transitions and settlement receipts |
Amount fields use two different units and must not be mixed:
- Spending-policy and budget fields such as
automaticPaymentThresholdAtomic,perPaymentLimitAtomic,agentDailyLimitAtomic, andlimitAtomicalways use the six-decimal USDC budget unit, so1000000always means 1 USDC. - Payment, approval, and receipt fields such as
maxAmountAtomicuse the network token's onchain atomic unit and must be interpreted withassetDecimals. Base and the other six-decimal configurations use1000000for 1 USDC.
If a paid service requires BNB Smart Chain, first confirm that it accepts the corresponding asset and complete the Permit2 approval. On that network, a 1 USDC x402 quote and maxAmountAtomic are 1000000000000000000, while the policy per-payment limit and daily budget remain 1000000. StableOps rounds budget usage upward so very small payments still count toward the budget.
Policy versions are immutable; create and explicitly activate a new version to change rules. See the supported scope in the introduction for the complete decimals table.
Filter and export payment usage
The payment query accepts payment and resource states, Agent identity, origin, time range, and the immutable business context attached to an Intent:
const page = await management.payments.listPage({
status: 'settled',
resourceStatus: 'response_received',
workflowId: 'research-weekly',
toolName: 'market-data',
purposeCode: 'RESEARCH_DATA',
costCenter: 'research',
createdFrom: '2026-08-01T00:00:00.000Z',
createdTo: '2026-08-31T23:59:59.999Z',
limit: 50,
})
const csv = await management.payments.exportCsv({
workflowId: 'research-weekly',
createdFrom: '2026-08-01T00:00:00.000Z',
createdTo: '2026-08-31T23:59:59.999Z',
})CSV exports apply the same filters and are limited to 10,000 rows. StableOps prefixes spreadsheet formula characters in caller-controlled context fields; still treat exports as sensitive financial records.
Agent Keys are shown once
const credential = await management.agents.createKey('agent_...', {
name: 'production-runtime',
})
if (!credential.secret) throw new Error('The one-time Agent Key was not returned')
console.log(`STABLEOPS_AGENT_KEY=${credential.secret}`) // Print only during secure initial setup.The API cannot return the plaintext again. Revoke and replace a lost or exposed key.
Make approval decisions in the console
Management API keys may read the approval queue. Approval and rejection are high-risk operations and remain in the StableOps console. The management SDK does not accept dashboard access tokens or expose approval and rejection methods.
See the quickstart for the complete wallet, policy, and payment flow.
How is this guide?
Last updated
Test x402 Payments
Use StableOps Agent Payments MCP to inspect, preview, approve, and purchase x402 resources while enforcing wallet, policy, budget, and signer controls.
Signer
Use StableOps Agent Payments Signer CLI to validate pairing challenges, run a loopback sidecar, and sign constrained payments with local keys or AWS KMS.