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

> Source: <https://dev.to/member_0fbab672/getting-a-paid-x402-api-discovered-by-ai-agents-5-things-i-learned-listing-on-the-payai-bazaar-and-8le>
> Published: 2026-11-27 01:01:44+00:00

**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 the playbook "Designing agent systems": <https://wpnews.pro/playbooks/agent-architecture>

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.

``` php
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](https://hodoyoku.pages.dev/agents)
