Menu

Making a small API discoverable by AI agents: what worked, what did not
📰

Making a small API discoverable by AI agents: what worked, what did not

#devcommunity#dev#agents#real#payment
Long article (392 words) — no AI summary yet.
Reading 0:00
15s threshold

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.

1. Make the unpaid call return a real 402

Not a 401, not a 403, not a JSON error. The x402 v2 shape that directories and agents actually parse:

HTTP/1.1 402 Payment Required

a base64 PAYMENT-REQUIRED header containing accepts[] with scheme: exact , network: eip155:8453 , the USDC asset, payTo , and the amount in token atomic units

the same challenge in the body for older clients

Probes 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.

2.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.