Skip to main content
Agent endpoints are in beta. MPP equivalent: GET /agent/mpp/top-up (same query params). Overview: Agentic payments. x402 scripts: x402 Subscription and top-up.
GET /agent/x402/top-up adds credits to your agent’s limit. Always call GET /agent/x402/subscription first — if plan_active !== true, subscribe or renew before topping up. Minimum top-up is $20 USDC.

Pricing

Payment is made in USDC on Base or Solana. The full amount_usd goes to Mobula (not a facilitator fee).

Query parameters


Request flow

  1. Check status first — Call GET /agent/x402/subscription (costs $0.001 USDC). If plan_active !== true, subscribe or renew before continuing.
  2. Initiate top-up — Call GET /agent/x402/top-up?agent_id=<user_id>&amount_usd=<amount> with no payment → 402 Payment Required with the required USDC amount.
  3. Pay and confirm — Sign the payment and retry with an x-payment header → 200 OK with credits_added and new_credits_limit.

Reference scripts

Run from the monorepo root. Scripts call GET /agent/x402/subscription automatically before topping up.
Example Scripts. Checks plan stats first ($0.001), then pays amount_usd to top up. Uses @solana/kit, @x402/core, @x402/svm. Inline base58ToBytes below; or use the same helper as in the x402 Subscribe to a plan guide.
Prerequisites: Solana wallet with USDC (mainnet: amount_usd + $0.001 for the status check) and SOL for fees. Optional: API_URL (default https://api.mobula.io).
Environment variables: Full walkthrough: x402 Subscription and top-up.