cd /news/ai-agents/getting-a-paid-x402-api-discovered-b… · home › topics › ai-agents › article
[ARTICLE · art-177012] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=· neutral

Getting a paid x402 API discovered by AI agents: 5 things I learned listing on the PayAI Bazaar and the MCP Registry

A developer running a pay-per-call Japan data API over x402 and a remote MCP server documented how they got the service indexed by AI agents, finding that discovery crawlers probe resource URLs without parameters, so bare requests must return a 402 with payment requirements rather than a 400. They also found that PayAI Bazaar listings appeared about a minute after a first settled payment per route, that facilitators maintain separate indexes, and that MCP Registry search matches names only, making specific names essential. The developer reported that listing works but outside paid traffic remains close to zero, calling discovery "a prerequisite, not demand.

recommendation

Make bare resource URLs return 402 with payment metadata instead of 400, validate bad parameters before payment, and settle one self-payment per route to trigger bazaar indexing.

more in playbook: Designing agent systems
by read2 min views15 publishedNov 27, 2026

I run a small pay-per-call API with Japan data for AI agents (official ticket-sale openings, JMA weather warnings, prefecture minimum wages, foreign-worker rights). It costs 0.01 USDC per call over x402 (HTTP 402 + USDC on Base) and is also exposed as a remote MCP server. Building the endpoints was the easy part. Getting agents to find them took most of the work. Here is what actually moved the needle, so you don't have to rediscover it.

Discovery crawlers probe your resource URL without parameters. My /api/v1/warnings returned 400 missing office when called bare, so crawlers never saw a price and the route was never indexed.

Fix: with no parameters → 402 with the payment requirements. After payment, return a sensible default (I return Tokyo with defaulted_office: true and a note). Invalid parameters (office=zzz) still get a 400 before the 402, so nobody pays for a query that can't succeed.

GET /api/v1/warnings            -> 402 (price visible to crawlers)
GET /api/v1/warnings?office=zzz -> 400 (validated before payment)
GET /api/v1/warnings?office=130000 + X-PAYMENT -> 200

I put the bazaar discovery metadata in my 402 responses, and only some routes appeared in the PayAI Bazaar. The missing routes showed up about a minute after their first settled payment through the facilitator. I made one 0.01 USDC self-payment per route (to my own payTo address). After that, discovery/resources?payTo=<my address> listed all of them.

Also note that facilitators don't share an index. Settling through PayAI got me listed on PayAI only. The Coinbase CDP Bazaar is a separate index, fed by settles through the CDP facilitator.

On Cloudflare Workers, settlement happens before your handler fetches data. If the handler then dies from the free plan's 10 ms CPU limit, the buyer has paid and gets nothing. Parsing the full 1.26 MB JMA map JSON took ~18 ms of CPU locally, so I dropped the "nationwide summary" idea. Keep the paid path cheap, and do the heavy parsing at build time.

mcp-publisher supports HTTP domain auth. You serve one text line at /.well-known/mcp-registry-auth:

v=MCPv1; k=ed25519; p=<base64 public key>

Then mcp-publisher login http --domain <your-domain> --private-key <hex> and mcp-publisher publish. Your namespace is the reverse-DNS form of the domain (mine is dev.pages.hodoyoku/japan-data). Keep the private key out of anything you deploy.

The registry's ?search= matches names only. "japan" already returns 100+ servers, so a generic "Japan data" name gets buried. Terms like foreign-worker rights or minimum wage had zero competing servers when I checked, so specific names win.

https://hodoyoku.pages.dev/mcp (tools/list is free)https://hodoyoku.pages.dev/.well-known/x402 https://registry.modelcontextprotocol.io/v0/servers?search=hodoyoku Honest status: listing works, but outside paid traffic is still close to zero. Discovery was a prerequisite, not demand. If you build agents that touch Japan (travel, HR, payroll, relocation), I'd love to hear which data you'd actually pay a cent per call for.

Setup guide, tool list and curl examples: https://hodoyoku.pages.dev/agents

── more in #ai-agents 4 stories · sorted by recency
── more on @payai bazaar 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/getting-a-paid-x402-…] indexed:0 read:2min 2026-11-27 · —