Top website / web traffic leaderboard via the Trends API live feeds. Competitive intel as JSON.
Key: trendsapi.ai/#get-key. HTTP contract and every source: trendsapi-ai/trendsapi.
pip install web-traffic-api
export TRENDSAPI_KEY=your_keyPython 3.9+. Same key as the HTTP API.
fromweb_traffic_apiimportTrendsAPIclient=TrendsAPI() # TRENDSAPI_KEY# client = TrendsAPI(api_key="YOUR_KEY")get_top_websites() presets type: "Top Websites". Official full client (every source, no preset): trendsapi.
| Method | REST mode | Returns |
|---|---|---|
get_top_websites(limit=, offset=, category=) | get_top_trends | GetTopTrendsResponse |
get_top_trends(type=, ...) | get_top_trends | GetTopTrendsResponse |
source is lowercase (google search). type is exact (Top Websites). Mixing them is a 400.
fromweb_traffic_apiimportTrendsAPIclient=TrendsAPI() # TRENDSAPI_KEY# client = TrendsAPI(api_key="YOUR_KEY")sites=client.get_top_websites(limit=25)
print(sites.data[0]) # [1, "google.com"]sites=client.get_top_websites(limit=25)| Field | Meaning |
|---|---|
as_of_ts | Snapshot time |
type | Feed name |
limit, offset, count | Pagination |
data | [rank, label] rows |
Python: hot.data. JS: hot.data. Optional offset= and category= (Amazon Best Sellers by Category, Top Websites only).
importasynciofromweb_traffic_apiimportAsyncTrendsAPIasyncdefmain():
client=AsyncTrendsAPI()
returnawaitclient.get_top_websites(limit=25)
asyncio.run(main())Each 200 is one billed request.
npm install web-traffic-apiNode 18+, Deno, Bun, Workers. Same API key. Field tables above apply.
| Method | REST mode | Returns |
|---|---|---|
getTopWebsites({ limit, offset, category }) | get_top_trends | live feed |
getTopTrends({ type, ... }) | get_top_trends | live feed |
import{TrendsAPI}from"web-traffic-api";constclient=newTrendsAPI({apiKey: process.env.TRENDSAPI_KEY!});constsites=awaitclient.getTopWebsites({limit: 25});console.log(sites.data[0]);// [1, "google.com"]| Field | Value |
|---|---|
| Endpoint | POST https://api.trendsapi.ai/api |
| Auth | Authorization: Bearer $TRENDSAPI_KEY |
| Mode | get_top_trends |
type | Top Websites (exact capitalization) |
| Optional | category, limit, offset |
curl -sS -X POST https://api.trendsapi.ai/api \
-H "Authorization: Bearer $TRENDSAPI_KEY" \
-H "Content-Type: application/json" \
-d '{"mode":"get_top_trends","type":"Top Websites","limit":25}'- There is no
source: web traffic(that string is 400). - Parsed
datais[rank, hostname]pairs. - This is third-party rank estimation, not Google Analytics.
| HTTP | Client |
|---|---|
| 200 | Parsed payload. Python dataclasses / JS typed objects |
| 400 | Raises. Fix source or type spelling |
| 401 | Raises. Check TRENDSAPI_KEY |
| 404 | Raises. No series for that keyword. Do not retry |
| 429 | Raises. Quota |
| 5xx | Client retries, then raises |
The HTTP body field is a JSON string. SDKs decode it. Raw curl must parse body a second time.
Site: https://trendsapi.ai/trends/web-traffic.
MIT. See LICENSE.