API reference
AceChange Agent API — documentation
The precise reference: base URL, auth, every endpoint, MCP tools, events and errors. Non-custodial throughout.
Live: /health · machine-readable /agent · guide: connect · open-source SDK on GitHub.
Base & authentication
Base URL: https://www.acechange.io/wp-json/acechange-agent/v1
- Headers:
X-Ace-Agent-Key,X-Ace-Agent-Timestamp(unix seconds, ±300s),X-Ace-Agent-Sign. - Signature =
HMAC-SHA256( METHOD + "\n" + ROUTE + "\n" + TS + "\n" + BODY , key )wherekey = hex(sha256(secret)). - ROUTE = the namespaced route, e.g.
/acechange-agent/v1/pay(the/wp-json-prefixed form is also accepted). BODY = raw body;""for GET. est_usd(> 0) is REQUIRED on swap/pay/cross-chain so spend caps apply.- The open-source SDKs (Python/TypeScript) sign for you.
Endpoints
Discovery & limits
/agentPublic capability card: auth spec, all endpoints, MCP tools, error codes.
/healthPublic status: enabled, micro_configured, cross_chain_configured.
/currenciesSupported Base micro tokens.
/limitsThis key's caps: max_tx_usd, daily_usd_cap, per_min.
Micro-swap (Base, 0x gasless)
/swap/quote{sell,buy,amount,taker} → price + the EIP-712 trade to sign.
/swap/submit{signed,est_usd} → relays the signed trade to the 0x relayer.
/swap/status?trade_hash= → trade status.
Cross-chain (real BTC / USDT / XMR)
/ff/currenciesValid cross-chain currency codes.
/ff/estimate{from,to,amount,type?,direction?} → rate + amounts.
/ff/create{from,to,amount,toAddress,type?,tag?,est_usd,idempotency_key?} → deposit + receive block.
/ff/status?order= → mapped status (scoped to your key).
/ff/emergency{order_id,choice(EXCHANGE|REFUND),address?} → act on a stuck swap.
Pay anyone
/pay{to,token,amount,from?,est_usd} → unsigned tx to sign; your spend caps applied.
Commerce
/commerce/merchant{receive_address,label?,webhook_url?,fee_bps?} → merchant_id + webhook_secret (once).
/commerce/product{name,price_usd,description?,currency?}.
/commerce/productsList your products.
/commerce/checkout{product_id|amount,expires_in?} → pay_to (merchant), EIP-681, x402, checkout_url.
/commerce/confirm{order_id,x_payment|tx_hash} → verify + mark paid + webhook.
/commerce/order?order= → public status (buyer poll).
/commerce/watch?order= → public, on-chain auto-confirm (IP-rate-limited).
/commerce/refund{order_id,to_address} → reverse transfer the merchant signs.
/commerce/deliver{order_id} → mark delivered.
Billing & usage
/billing/subscription{amount_usd,period(day|week|month),label?}.
/billing/subscriptionsList subscriptions.
/billing/cancel{subscription_id}.
/billing/usage{meter,units,unit_price_usd}.
/billing/invoice{meter} → one checkout for the metered total.
Pay-per-call
/x402/premium402 + USDC requirements; pay with X-PAYMENT, get the resource.
/l402/premium402 + Lightning invoice; pay, retry with Authorization: L402 <token>:<preimage>.
/x402/info | /l402/infoRail status.
Events & webhooks
/eventsYour recent events.
/webhooks/register{url} (public HTTPS) → secret; events POSTed with X-Ace-Event-Signature.
/webhooksList webhooks.
/webhooks/delete{url}.
Wallet registry
/wallet/provisionSDK config (no key material).
/wallet/register{owner_address,label?}.
/wallet/smart-account{smart_account,owner_address,label?} (ERC-4337).
/wallet/session{session_address,per_tx_usd,daily_usd,allowed_tokens,allowed_recipients,expires_in?}.
/wallet/policy?session= → policy.
/wallet/revoke{session_address} → kill switch.
Funding & visibility
/fund/link?wallet=&amount=&crypto=&network= → fiat on-ramp link to the agent wallet.
/activityYour activity history + totals.
/activity/view?key=&token= → read-only human dashboard feed.
MCP tools
POST /mcp (JSON-RPC 2.0): initialize (negotiates protocolVersion, latest 2025-06-18), tools/list (public), tools/call (agent-auth; business errors return result.isError=true).
ace_currencies ace_limits ace_activity ace_events ace_fund ace_swap_quote ace_swap_submit ace_swap_status ace_pay ace_ff_currencies ace_ff_estimate ace_ff_create ace_ff_status ace_register_merchant ace_create_product ace_create_checkout ace_order_status ace_create_subscription ace_record_usage ace_invoice
Events
Subscribe via POST /webhooks/register (signed X-Ace-Event-Signature) or pull GET /events:
swap.submitted swap.created swap.completed swap.refunded swap.expired payment.built order.paid order.refunded order.delivered subscription.due invoice.created
Error codes
Shape: { code, message, data:{status} } — branch on code.
| code | HTTP | meaning |
|---|---|---|
agent_disabled | 503 | module off |
agent_auth | 401 | bad/missing key, timestamp or signature |
rate_limited | 429 | velocity / IP limit — back off |
est_usd_required | 400 | pass est_usd > 0 |
tx_too_large | 403 | over per-tx cap |
daily_cap | 403 | over daily USD cap (UTC day) |
*_not_configured | 503 | rail not set up by the operator |
ff_upstream / upstream | 502 | cross-chain provider error (message carries a provider code) |
forbidden | 403 | order/resource belongs to another key |
no_order | 404 | unknown order |