{"openapi":"3.1.0","info":{"title":"Attention Trends","version":"0.2.0","description":"Topic attention trends from Wikipedia pageviews (CC0 data): a Google-Trends-style signal for AI agents. Pay per call in USDC via x402 — no account, no API key.","x-guidance":"Call GET /trend?topic=<free text>&lang=en&days=30 to learn whether attention on a topic is rising, falling, stable or spiking (normalized 0-100 series, % change, spikes). Call GET /compare?topics=a,b,c to compare 2-5 topics on one scale. Call GET /top?lang=en for the most-read articles yesterday. Pay with x402 (exact scheme, USDC). Invalid input returns 400 and is not charged.","contact":{"email":"shopttyass@gmail.com"}},"servers":[{"url":"https://attention-trends.shopttyass-85f.workers.dev"}],"paths":{"/trend":{"get":{"operationId":"trend","summary":"Interest over time for one topic","description":"Wikipedia pageviews trend for any topic: interest over time as a measure of topic popularity and public attention. Free text (brand, person, product, event) is resolved to the matching Wikipedia article. Returns daily views normalized 0-100, 7-day and window % change, direction (rising, falling, stable, spiking), peak day and spike detection. Similar in purpose to Google Trends search interest, but it measures Wikipedia reading, not searches.","tags":["Trends"],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.005000"},"protocols":[{"x402":{}}]},"parameters":[{"name":"topic","in":"query","required":true,"description":"Free-text topic, resolved to the best-matching Wikipedia article (e.g. 'bitcoin', 'Taylor Swift', 'AI Act')","schema":{"type":"string","description":"Free-text topic, resolved to the best-matching Wikipedia article (e.g. 'bitcoin', 'Taylor Swift', 'AI Act')"}},{"name":"lang","in":"query","required":false,"description":"Wikipedia language code (default en)","schema":{"type":"string","description":"Wikipedia language code (default en)","default":"en"}},{"name":"days","in":"query","required":false,"description":"Window length in days, ending yesterday UTC","schema":{"type":"integer","minimum":7,"maximum":365,"default":30,"description":"Window length in days, ending yesterday UTC"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"topic":{"type":"string"},"lang":{"type":"string"},"article":{"type":"object","properties":{"title":{"type":"string"},"url":{"type":"string"},"description":{"type":["string","null"]},"wikidata":{"type":["string","null"]},"matchedBy":{"type":"string","enum":["exact","redirect","search"]},"alternatives":{"type":"array","items":{"type":"object"}}}},"window":{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"},"days":{"type":"integer"}}},"summary":{"type":"object","properties":{"days":{"type":"integer"},"total":{"type":"integer"},"avgDaily":{"type":"number"},"medianDaily":{"type":"number"},"peak":{"type":"object","properties":{"date":{"type":"string"},"views":{"type":"integer"}}},"last7Avg":{"type":"number"},"prev7Avg":{"type":"number"},"change7dPct":{"type":["number","null"],"description":"Last 7 days vs previous 7 days, %"},"changeHalfPct":{"type":["number","null"],"description":"Second half of the window vs first half, %"},"slopePctPerWeek":{"type":"number","description":"Log-linear trend, % per week"},"direction":{"type":"string","enum":["rising","falling","stable","spiking"]},"spikes":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"views":{"type":"integer"},"ratioToMedian":{"type":"number"},"robustZ":{"type":"number"}}}}}},"series":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"views":{"type":"integer"},"index":{"type":"integer","description":"0-100, 100 = peak day"}}}},"note":{"type":"string"}},"required":["topic","article","summary","series"]}}}},"400":{"description":"Invalid input (not charged: settlement only happens on success)"},"402":{"description":"Payment Required (x402 v2 challenge in the PAYMENT-REQUIRED header)"}}}},"/compare":{"get":{"operationId":"compare","summary":"Compare attention for 2-5 topics","description":"Compare the popularity of 2-5 topics (brands, competitors, products, people, keywords) by Wikipedia pageviews. Returns one jointly normalized 0-100 interest-over-time series per topic, share of attention, the most popular and the fastest-rising topic, and per-topic trend direction and spikes. A Google-Trends-style popularity comparison based on Wikipedia reading rather than searches. Suited to competitor analysis, brand tracking and content planning.","tags":["Trends"],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.010000"},"protocols":[{"x402":{}}]},"parameters":[{"name":"topics","in":"query","required":true,"description":"2-5 comma-separated topics, e.g. 'ChatGPT,Claude,Gemini'","schema":{"type":"string","description":"2-5 comma-separated topics, e.g. 'ChatGPT,Claude,Gemini'"}},{"name":"lang","in":"query","required":false,"schema":{"type":"string","default":"en"}},{"name":"days","in":"query","required":false,"schema":{"type":"integer","minimum":7,"maximum":365,"default":30}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"lang":{"type":"string"},"window":{"type":"object"},"leader":{"type":["string","null"]},"fastestRising":{"type":["string","null"]},"topics":{"type":"array","items":{"type":"object","properties":{"topic":{"type":"string"},"article":{"type":["object","null"]},"shareOfAttentionPct":{"type":"number"},"summary":{"type":"object","properties":{"days":{"type":"integer"},"total":{"type":"integer"},"avgDaily":{"type":"number"},"medianDaily":{"type":"number"},"peak":{"type":"object","properties":{"date":{"type":"string"},"views":{"type":"integer"}}},"last7Avg":{"type":"number"},"prev7Avg":{"type":"number"},"change7dPct":{"type":["number","null"],"description":"Last 7 days vs previous 7 days, %"},"changeHalfPct":{"type":["number","null"],"description":"Second half of the window vs first half, %"},"slopePctPerWeek":{"type":"number","description":"Log-linear trend, % per week"},"direction":{"type":"string","enum":["rising","falling","stable","spiking"]},"spikes":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"views":{"type":"integer"},"ratioToMedian":{"type":"number"},"robustZ":{"type":"number"}}}}}},"series":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"value":{"type":"integer"}}}}}}},"note":{"type":"string"}},"required":["topics"]}}}},"400":{"description":"Invalid input (not charged: settlement only happens on success)"},"402":{"description":"Payment Required (x402 v2 challenge in the PAYMENT-REQUIRED header)"}}}},"/top":{"get":{"operationId":"top","summary":"Most-read Wikipedia articles for a day","description":"What is trending right now: the most-read Wikipedia articles for a language and day (default yesterday UTC), with views and rank, cleaned of the Main Page, special and other non-article pages. A daily signal of trending topics, breaking news and current events in 300+ Wikipedia language editions. Suited to trend discovery, news monitoring and content ideas.","tags":["Trends"],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.005000"},"protocols":[{"x402":{}}]},"parameters":[{"name":"lang","in":"query","required":false,"schema":{"type":"string","default":"en"}},{"name":"date","in":"query","required":false,"description":"YYYY-MM-DD (default: yesterday UTC)","schema":{"type":"string","description":"YYYY-MM-DD (default: yesterday UTC)"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"lang":{"type":"string"},"date":{"type":"string"},"articles":{"type":"array","items":{"type":"object","properties":{"rank":{"type":"integer"},"title":{"type":"string"},"views":{"type":"integer"},"url":{"type":"string"}}}}},"required":["articles"]}}}},"400":{"description":"Invalid input (not charged: settlement only happens on success)"},"402":{"description":"Payment Required (x402 v2 challenge in the PAYMENT-REQUIRED header)"}}}},"/mcp":{"post":{"operationId":"mcp","summary":"Remote MCP server (Streamable HTTP)","description":"JSON-RPC MCP endpoint exposing the same three tools; paid per call with x402 inside MCP (_meta x402/payment).","security":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"JSON-RPC response"}}}},"/health":{"get":{"operationId":"health","summary":"Health check","security":[],"responses":{"200":{"description":"OK"}}}}}}