{"uid":"cap_6TGSdxSOMsc8I0M2mZRR3","slug":"x402-agent-pay-energy-buy-order-75d2a4a8","name":"x402-agent-pay Energy Buy Order","description":"Buy agent energy (kWh) up to a max price — matches cheapest resting sellers, settles USDC to seller wallets on Base L2","url":"https://x402-agent-pay.com/labs/api/energy/buy","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"data":{"type":"object","description":"Response payload"},"success":{"type":"boolean"},"settlement_tx":{"type":"string","description":"On-chain settlement transaction hash"}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_9pM8ncrNer19SjT6VHFQM","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Buys agent energy (kWh) up to a specified max price by matching the cheapest resting sellers and settling USDC to seller wallets on Base L2","exampleAgentPrompt":"Buy energy for my agent — I want up to 10 kWh and I'm willing to pay no more than 0.05 USDC per kWh; match whatever the cheapest resting sellers have and settle on Base.","exampleUseCases":[{"title":"Autonomous agent energy top-up","prompt":"My agent is running low on energy credits — buy 5 kWh at the best available price, but don't pay more than 0.04 USDC per kWh, and settle it on Base L2 right now."},{"title":"Microgrid energy procurement for IoT fleet","prompt":"I need to purchase 50 kWh for my IoT device fleet from the cheapest sellers available — cap the price at 0.06 USDC per kWh and send the USDC settlement on Base."},{"title":"Cost-optimized agent power purchasing","prompt":"Find and buy the cheapest available energy for my AI agent, up to 20 kWh with a max price of 0.03 USDC per kWh — match resting sellers and confirm the on-chain settlement tx."}],"resultDescription":"Returns a success boolean, a response data payload confirming the energy purchase, and an on-chain settlement transaction hash on Base L2 showing the USDC payment to the matched seller's wallet.","failureModes":["No resting sellers available at or below the specified max price — order not filled","Insufficient USDC balance to cover the purchase plus $0.02 call fee","x402 payment authentication failure — agent wallet not authorized","Base L2 network congestion causing settlement delays or failures","Invalid kWh quantity or max price parameters in request body","Settlement transaction hash unavailable if on-chain confirmation is pending"],"whenToPreferThis":"Choose this endpoint when an AI agent or IoT device needs to autonomously purchase energy (kWh) on a decentralized marketplace with best-price matching against resting sell orders and on-chain USDC settlement on Base L2. Ideal for agents that require energy credits programmatically without manual intervention, particularly in microgrid or machine-to-machine commerce scenarios where cost-capped limit buying is important.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T18:30:58.536Z","isFirstParty":false}