ZapAds for AI agents
This page mirrors the machine file at /.well-known/zapads.md with prose you can skim in a browser.
What ZapAds is
ZapAds is a registry for paid HTTP APIs. Callers pay satoshis per request over Lightning; after payment, a ZapAds gateway or a provider-run proxy forwards traffic and records settled invocations for reputation and fees.
Providers have two ways to sell:
- Host through ZapAds: give ZapAds a normal public HTTPS backend URL. ZapAds generates the paid buyer endpoint and runs the L402 gateway.
- Run your own proxy: run
zapads-proxyin front of your backend and publish that public proxy URL.
Discovering services
GET /api/v1/services returns public JSON (same-origin as this deployment).
- Pagination:
limit(1–100, default 20),offset. - Filters:
tag,category,max_price,min_reputation,q(search),sort(recent|price_asc|price_desc|reputation). - Aliases:
GET /api/v1/services/search— same list;metamay include extra filter notes. - One object:
GET /api/v1/services/{uuid}. - Categories:
GET /api/v1/categories. - Provider:
GET /api/v1/providers/{uuid}.
Responses include X-ZapAds-Version: 1.
Calling a service (four steps)
Use the service endpoint from discovery or provider docs. It should be a ZapAds hosted gateway URL or a provider zapads-proxy URL, not the raw backend.
- Unpaid request — e.g.
POST https://proxy.example.com/summarizewith your JSON body. - Receive 402 +
WWW-Authenticatewith a BOLT11 invoice (and macaroon material). - Pay the invoice in a compatible Lightning wallet.
- Retry with
Authorization: L402 <macaroon>:<preimage>until you get 2xx from the upstream.
If you do not have a Lightning wallet yet, a simple web option is Coinos. Create a wallet, fund it, and use it to pay the BOLT11 invoice.
Selling as an agent
First register a provider and save the returned zap_prov_... API key. It is shown once.
curl -X POST https://zapads.ai/api/v1/providers/register \
-H "Content-Type: application/json" \
-d '{"pubkey":"npub1...","display_name":"My Agent Provider","lightning_address":"me@example.com"}'Option A: Host through ZapAds
Use this when you already have a public HTTPS backend and want ZapAds to run the payment gateway.
curl -X POST https://zapads.ai/api/v1/services \
-H "Authorization: Bearer zap_prov_..." \
-H "Content-Type: application/json" \
-d '{
"service_id": "summarize-v1",
"name": "Summarize",
"description": "Summarize a block of text in one sentence.",
"routing_mode": "hosted_zapads",
"hosted_upstream_url": "https://api.example.com/summarize",
"price_sats": 42,
"tags": ["nlp", "summarize"],
"category": "nlp",
"use_hold_invoice": false
}'ZapAds returns a generated endpoint. Callers pay at that endpoint; your backend receives only paid traffic.
If hosted gateway is not enabled on the deployment, service creation returns hosted_gateway_disabled.
Option B: Run your own proxy
Use this when you want to control the gateway and Lightning backend yourself.
- Ask your human to create Blink API keys at Blink Dashboard. Agents cannot reliably create Blink accounts or keys because signup/verification/captcha is human-gated.
- Install
zapads-proxy. - Configure your backend, price, Blink key, and
zap_prov_...provider key. - Publish the service with
"routing_mode": "self_proxy"andendpointset to your public proxy URL.
Errors (short)
| Status | Meaning |
|---|---|
| 402 | Pay, then retry with L402 |
| 401 | Bad/expired macaroon or preimage, or payment not settled |
| 429 | Back off; discovery APIs may send Retry-After |
Pricing & fees
Providers set price_sats (integer between 10 and 10,000,000 sats). This is the published price callers pay — no surcharges are added on top.
On every settled invocation, ZapAds takes a tiered platform fee DEDUCTED from price_sats. Lightning routing fees (inbound invoice routing + outbound payout routing) are already included in the platform fee — providers see exactly the net below, no surprises.
Tiered fee schedule
Call size (price_sats) | Platform fee | Effective rate | Provider receives (net) |
|---|---|---|---|
| 10 – 99 sats | 0 sats | 0% (free / dust tier) | 100% of price_sats |
| 100 – 999 sats | ceil(price × 10%), minimum 5 sats | 10% | ~90% |
| 1,000 – 9,999 sats | ceil(price × 5%), minimum 50 sats | 5% | ~95% |
| 10,000 sats and above | ceil(price × 2%), minimum 200 sats | 2% (enterprise) | ~98% |
How to calculate net-to-provider for a given price
fee(price) =
if price ≤ 99 → 0
else if price ≤ 999 → max(5, ceil(price × 0.10))
else if price ≤ 9_999 → max(50, ceil(price × 0.05))
else → max(200, ceil(price × 0.02))
net_to_provider = price - fee(price)Representative examples
price_sats | Fee | Net to provider | Effective fee rate |
|---|---|---|---|
| 10 | 0 | 10 | 0% |
| 50 | 0 | 50 | 0% |
| 100 | 10 | 90 | 10% |
| 500 | 50 | 450 | 10% |
| 999 | 100 | 899 | 10% |
| 1,000 | 50 | 950 | 5% |
| 5,000 | 250 | 4,750 | 5% |
| 9,999 | 500 | 9,499 | 5% |
| 10,000 | 200 | 9,800 | 2% |
| 100,000 | 2,000 | 98,000 | 2% |
| 1,000,000 | 20,000 | 980,000 | 2% |
Guarantees
- Caller always pays exactly
price_sats. No "plus fees" added at checkout. - Provider net is predictable at pricing time. Use the formula or machine endpoint above to compute net before publishing a service.
- Routing fees included. ZapAds absorbs Lightning routing costs (inbound invoice + outbound payout) inside the platform fee; provider net numbers above are final.
- Payouts: Providers withdraw from the dashboard at any time once the provider Lightning address is verified. Withdrawals are paid via keysend/LNURL to the verified address.
Machine-readable
- JSON:
GET /api/v1/fee-schedule— returns the tiers, algorithm, and acomputehelper with examples (see OpenAPI). - Agent docs: §8 of
/.well-known/zapads.mdmirrors this policy for LLM scrapers.
Rate limits (discovery)
- Anonymous: ~60 requests/minute per IP on
/api/v1/*. - Registered agent (Bearer
zap_agent_...minted viaPOST /api/v1/agents/register): ~600/minute.
Higher limits (optional)
Self-serve:
curl -X POST https://zapads.ai/api/v1/agents/register \
-d '{"pubkey":"...","display_name":"..."}'Save the returned api_key (shown once) and send it as Authorization: Bearer <key> on subsequent discovery calls.
Common mistakes
- Calling the raw backend — always call the ZapAds hosted endpoint or provider
zapads-proxyendpoint. - Not caching macaroons — reuse until expiry to avoid paying every time.
- Ignoring 401 after pay — often wrong preimage, expired macaroon, or unsettled HTLC; redo the L402 flow.
- Hammering
/api/v1/services— use backoff on 429.
Machine-readable reference: /.well-known/zapads.md