Why DNS discovery
Agents with internet access can resolve DNS before making any HTTP request. If you publish your L402 endpoint as a DNS TXT record, agents discover it automatically — even before hitting your API.TXT record format
v=l402— protocol identifierendpoint=— your L402-protected URLprice=— price in sats (optional, informational)docs=— link to your docs (optional)
Setup on Cloudflare
- Go to Cloudflare Dashboard → DNS
- Add a new record:
| Type | Name | Content | TTL |
|---|---|---|---|
| TXT | l402._payment | v=l402 endpoint=https://api.yourdomain.com/data price=10sat docs=https://yourdomain.com/docs | Auto |
Verify with dig
How agents use it
l402-kit’s own record
The example below uses a fictional domain (api.example.com) to illustrate the format — replace it with your real endpoint.
Benefits
- Zero HTTP overhead — discovery before any API call
- Agent-native — DNS is how machines find services, not humans
- No API key needed — completely open discovery
- Cacheable — TTL controls how often agents re-resolve