Website traffic-rank API
Top website / web traffic leaderboard via the Trends API live feeds. Competitive intel as JSON.
Key: trendsapi.ai/#get-key. HTTP contract: trendsapi-ai/trendsapi.
JS: web-traffic-api.
Authentication
pip install web-traffic-api
export TRENDSAPI_KEY=your_key
Python 3.9+. The wrapper re-exports TrendsAPI, AsyncTrendsAPI, and TrendsAPIError from the official client.
from web_traffic_api import TrendsAPI
client = TrendsAPI() # TRENDSAPI_KEY
# client = TrendsAPI(api_key="YOUR_KEY")
get_top_websites() presets type: "Top Websites". Official full client (every source, no preset): trendsapi.
Methods
| 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.
from web_traffic_api import TrendsAPI
client = 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).
Async
import asyncio
from web_traffic_api import AsyncTrendsAPI
async def main():
client = AsyncTrendsAPI()
return await client.get_top_websites(limit=25)
asyncio.run(main())
Each 200 is one billed request.
Call (curl)
| 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}'
Source notes
- There is no
source: web traffic(that string is 400). - Parsed
datais[rank, hostname]pairs. - This is third-party rank estimation, not Google Analytics.
Errors
| 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. GitHub: trendsapi-ai/web-traffic-api.
License
MIT. See LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file web_traffic_api-1.0.1.tar.gz.
File metadata
- Download URL: web_traffic_api-1.0.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b47e6de1f44b37bedc41b97e869b1d411d230ca1a8b67d23d0f88b6c19b90e5
|
|
| MD5 |
f9a5b8db9ca3ff5ffeaca4051f35648e
|
|
| BLAKE2b-256 |
ea98475eb151972ddafccbf0d74f6f5f50acd78822cc03692a79f8f4a8e14fd0
|
File details
Details for the file web_traffic_api-1.0.1-py3-none-any.whl.
File metadata
- Download URL: web_traffic_api-1.0.1-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b821c30a2a610ff7931aa38e329c2d0f1988531ff950f443b011a6467104885
|
|
| MD5 |
9689bc55e51efc0e3c5bf32c9d985022
|
|
| BLAKE2b-256 |
9a70bf23dadc611b2846d8587cfe27b9da6d5d00de449c4933179b97ce7eb23f
|