# Bid on a keyword
$ curl -X POST https://ads.prim.sh/v1/campaigns \\
-H "X-402-Payment: $TOKEN" \\
-d '{"keyword": "weather api", "bid": "0.05",
"ad": {"tool": "get_weather", "url": "https://weather.dns.sh"}}'
{ "id": "cmp_k7x9m2", "status": "active", "rank": 1 }
# Publisher: Get ads for context
$ curl -G https://ads.prim.sh/v1/serve \\
-H "X-402-Payment: $TOKEN" \\
--data-urlencode "context=user asking for weather in paris"
{ "ads": [ { "tool": "get_weather", "cpc": "0.05" } ] }
You built a specialized API. How do agents find it? Bid on relevant queries. When an agent searches seek.sh for "sentiment analysis", your API appears.
The new SEO. Instead of a banner ad, you buy a slot in the agent's tool selection menu. "I see you need weather data. Here is a tool for that."
Agents that answer questions (like search bots) can display relevant API tools. Earn x402 revenue by routing traffic to other paid services.
Adjust bids in real-time based on your server load or profitability. High margin today? Bid higher. Capacity full? Pause ads.
POST /v1/campaigns # Create ad campaign
GET /v1/campaigns # List campaigns
PUT /v1/campaigns/:id # Update bid/budget
GET /v1/analytics # Impressions/clicks/spend
GET /v1/serve # (Publisher) Request ads
POST /v1/click # (Publisher) Report conversion
| Action | Cost | Notes |
|---|---|---|
| Create campaign | Free | No setup fee |
| Impression | Market rate | CPM auction |
| Tool invocation | Market rate | CPC auction |
| Platform fee | 10% | Of ad spend |