{"slug": "making-a-small-api-discoverable-by-ai-agents-what-worked-what-did-not", "title": "Making a small API discoverable by AI agents: what worked, what did not", "summary": "A developer behind ChinaWire, a small paid API for Chinese web content, documented how they made the service discoverable to AI agents using the x402 v2 payment protocol. Key steps included returning a properly shaped 402 Payment Required response with a PAYMENT-REQUIRED header before request validation, publishing /openapi.json with x-payment-info, /.well-known/x402, /llms.txt, robots.txt and sitemap.xml, and registering routes via the x402 registry. The developer reported that switching from an sslip.io host to a normal domain behind Cloudflare with Full (strict) was what finally got directory crawlers probing the API.", "body_md": "I run ChinaWire, a small paid API for Chinese web content. Getting it technically correct was the easy part; getting agents to find it was the hard part. Here is what moved the needle, in order.\n\nNot a 401, not a 403, not a JSON error. The x402 v2 shape that directories and agents actually parse:\n\n`HTTP/1.1 402 Payment Required`` PAYMENT-REQUIRED` header containing `accepts[]` with `scheme: exact`, `network: eip155:8453`, the USDC asset, `payTo`, and the amount in token atomic units\nProbes must reach the 402 *before* query/body validation rejects the request. If `/v1/thing` returns 422 without a parameter, a directory will mark it as broken.\n\n`/openapi.json` with `x-payment-info` per operation`/.well-known/x402` listing the paid resource URLs`/llms.txt` - a plain-text map for agents`robots.txt` that allows agent crawlers, and a `sitemap.xml`\nThese are cheap and they gave every crawler something to chew on.\n\n`/api/x402/registry/register-origin` with the signed payload registered every route in my OpenAPI.`sslip.io`): directory crawlers treated it as a free host.\nA normal domain behind Cloudflare, with `Full (strict)`, was the switch that made crawlers start probing.\n\n`PAYMENT-SIGNATURE` header path separately so you can tell probes from payers.\nIf you are building an x402 service, the conformance checklist is the easy 20%. The other 80% is being in the places an agent already reads.", "url": "https://wpnews.pro/news/making-a-small-api-discoverable-by-ai-agents-what-worked-what-did-not", "canonical_source": "https://dev.to/chinawire/making-a-small-api-discoverable-by-ai-agents-what-worked-what-did-not-339a", "published_at": "2026-12-04 12:41:31+00:00", "updated_at": "2026-12-04 12:43:46.033776+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "ai-tools", "developer-tools"], "entities": ["ChinaWire", "x402", "Cloudflare", "sslip.io", "USDC"], "also_reported_by": [], "takeaway": "To make an x402 API discoverable, return a conformant 402 with a PAYMENT-REQUIRED header before query validation, publish /openapi.json, /.well-known/x402, /llms.txt, robots.txt and sitemap.xml, and host on a normal domain behind Cloudflare Full (strict) rather than a free subdomain.", "recommendation": {"advice": "Serve a valid x402 402 response before validation, publish OpenAPI, /.well-known/x402 and llms.txt, and use a real domain behind Cloudflare Full (strict) so directory crawlers will probe your API.", "playbook": "agent-architecture", "playbook_url": "https://wpnews.pro/playbooks/agent-architecture"}, "alternates": {"html": "https://wpnews.pro/news/making-a-small-api-discoverable-by-ai-agents-what-worked-what-did-not", "markdown": "https://wpnews.pro/news/making-a-small-api-discoverable-by-ai-agents-what-worked-what-did-not.md", "text": "https://wpnews.pro/news/making-a-small-api-discoverable-by-ai-agents-what-worked-what-did-not.txt", "jsonld": "https://wpnews.pro/news/making-a-small-api-discoverable-by-ai-agents-what-worked-what-did-not.jsonld"}}