DEV Community

logan miller
logan miller

Posted on • Originally published at agentdatum.com

Paying for API data with x402: a working example using AgentDataHub

My agents need fresh data every day. Gold signals, macro snapshots, on-chain crypto metrics. The usual options don't fit a machine that runs at 3am with no human around.

API keys break when quotas reset. Prepaid plans go dark when the card expires and nobody notices. I wanted the agent to just pay per call and move on. That's what x402 does, and AgentDataHub gave me 267 endpoints to test it on. Here's what I learned, including the one real transaction below.

The numbers that mattered

AgentDataHub is a structured data market built for AI agents. The parts I could verify:

  • 267 resources, of which 266 are paid per call over x402
  • Starting price is $0.01 per call
  • A free tier exists: 1000 calls/month anonymous, 5000/month when you bind a wallet
  • It's already listed on Bazaar and Agentic.Market, with the endpoints indexed

That last point is why I picked it. I didn't want to negotiate a contract just to try a data feed.

How the protocol actually runs

No signup. The client makes a normal GET. The server answers with 402 Payment Required and a Payment-Required header holding a base64 JSON blob:

curl -s -i https://agentdatum.com/api/v1/d/geopol-risk

HTTP/1.1 402 Payment Required
Payment-Required: eyJ4NDAyVmVyc2lvbiI6MSwiYWNjZXB0cyI6W3sic2NoZW1lIjoiZXhhY3QiLCJuZXR3b3JrIjoiYmFzZSIsIm1heEFtb3VudFJlcXVpcmVkIjoiNDkwMDAiLCJwYXlUbyI6IjB4Q2QyNjU4NzBBMjBkYjI1MjUwNTM1Y2I4YTBEM0JCMDg1MDQxNzkwMiIsImFzc2V0IjoiMHg4MzM1ODlmQ0Q2ZURiNkUwOGY0YzdDMzJENGY3MWI1NGJkQTAyOTEzIn1dfQ==
Enter fullscreen mode Exit fullscreen mode

Decoded, that header tells the client: pay 49000 micro-USDC (that's $0.049) on Base to 0xCd265870A20DB25250535cb8a0D3BB0850417902. Any x402-compatible client signs the USDC transfer, attaches the proof, and re-sends the request. The server returns 200 with the data.

The difference from a normal API: the agent pays from its own wallet. No key to leak, no monthly invoice, no human in the loop.

A real transaction, not a demo

I didn't trust the docs. So I ran one paid call from a test wallet against the geopol-risk endpoint. The test wallet paid $0.049. On the receiving side, the AgentDataHub collection wallet 0xCd265870A20DB25250535cb8a0D3BB0850417902 balance moved from 1.4 to 1.741 USDC. The Bazaar indexer picked it up.

In Python, using any x402 client, the call is roughly:

from x402_client import X402Client  # use your x402-compatible client

client = X402Client(wallet=agent_wallet)  # wallet holds Base USDC
data = client.get("https://agentdatum.com/api/v1/d/geopol-risk")

print(data["risk_score"])  # real JSON, no API key needed
Enter fullscreen mode Exit fullscreen mode

The client handles the 402, the signature, and the retry. Your job is just the URL and a wallet with USDC.

What I'd tell a friend

Coverage is wide (267 resources) but shallow per market. If you need deep order-book history for a serious trading strategy, look elsewhere for that one feed. x402 is early; the wallet-plus-USDC step adds friction for a total beginner, though it's clean once the agent runs unattended.

One thing the Bazaar ranking taught me: being found depends on real call volume, not SEO tricks. An endpoint gets indexed when something actually pays for it. So write the integration, ship it, and let usage do the talking.

The paid tier is real money leaving a wallet. Before you wire this into a loop, decide which data is worth buying per call versus caching.

Where to start

If you're building an agent that needs live data, the free tier on AgentDataHub is enough to experiment. The full catalog is at https://agentdatum.com/.well-known/ai-catalog.json. Try a free call, then let your agent pay for one premium feed and watch the loop close.

Top comments (0)