Skip to main content

Website traffic-rank API

Top website / web traffic leaderboard via the Trends API live feeds. Competitive intel as JSON.

License: MIT PyPI Python

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 data is [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.

Metadata

Release files for web-traffic-api 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for web-traffic-api 1.0.1
File Size Uploaded
web_traffic_api-1.0.1.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for web-traffic-api 1.0.1
File Interpreter ABI Platform
web_traffic_api-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.1 kB

Release files / web_traffic_api-1.0.1.tar.gz

Download URL web_traffic_api-1.0.1.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5b47e6de1f44b37bedc41b97e869b1d411d230ca1a8b67d23d0f88b6c19b90e5
BLAKE2b-256 checksum
How to use checksums
ea98475eb151972ddafccbf0d74f6f5f50acd78822cc03692a79f8f4a8e14fd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release files / web_traffic_api-1.0.1-py3-none-any.whl

Download URL web_traffic_api-1.0.1-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b821c30a2a610ff7931aa38e329c2d0f1988531ff950f443b011a6467104885
BLAKE2b-256 checksum
How to use checksums
9a70bf23dadc611b2846d8587cfe27b9da6d5d00de449c4933179b97ce7eb23f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page