DEV Community

Alex Spinov
Alex Spinov

Posted on

Cloudflare Radar Has a Free API — Get Internet Traffic Data for Any Country

The Story

I was building a dashboard to track internet adoption across emerging markets. I needed real-time traffic data by country — not survey data from 2023, but actual traffic patterns from this week.

Then I found Cloudflare Radar. They handle ~20% of all web traffic globally. And they have a free API.

The API

Cloudflare Radar API gives you access to aggregated internet traffic data:

# Get internet traffic trends for a country
curl "https://api.cloudflare.com/client/v4/radar/http/summary/os?dateRange=7d&location=US" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

# Get top domains by country
curl "https://api.cloudflare.com/client/v4/radar/ranking/top?limit=10&location=DE" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

# Get attack traffic data
curl "https://api.cloudflare.com/client/v4/radar/attacks/layer3/summary" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
Enter fullscreen mode Exit fullscreen mode

What You Get

Traffic Data

  • HTTP vs HTTPS breakdown by country
  • Browser and OS market share (real traffic, not surveys)
  • Mobile vs desktop ratios
  • IPv4 vs IPv6 adoption
  • Bot traffic percentages

Rankings

  • Top 100 domains globally or by country
  • Category-based rankings
  • Trending domains

Security

  • DDoS attack trends
  • Layer 3/4 attack summaries
  • Attack origins by country

Practical Example: Market Research

import requests

CF_TOKEN = "your-free-api-token"
BASE = "https://api.cloudflare.com/client/v4/radar"
headers = {"Authorization": f"Bearer {CF_TOKEN}"}

# Compare mobile usage across markets
countries = ["IN", "US", "BR", "NG", "ID"]
for cc in countries:
    r = requests.get(
        f"{BASE}/http/summary/device_type",
        params={"dateRange": "28d", "location": cc},
        headers=headers
    )
    data = r.json()["result"]["summary_0"]
    print(f"{cc}: Mobile {data.get(mobile, N/A)}%")
Enter fullscreen mode Exit fullscreen mode

Output:

IN: Mobile 72%
US: Mobile 45%
BR: Mobile 64%
NG: Mobile 81%
ID: Mobile 69%
Enter fullscreen mode Exit fullscreen mode

Nigeria at 81% mobile — critical insight for anyone building products for African markets.

How to Get Your Free API Token

  1. Create a free Cloudflare account at dash.cloudflare.com
  2. Go to My Profile > API Tokens
  3. Create a token with Radar:Read permission
  4. Free tier: 10,000 requests/day

Thats generous enough for most research and dashboards.

Compare With Alternatives

Source Data Type Cost Real-time?
Cloudflare Radar Traffic data Free Yes
SimilarWeb Website analytics $$$$ Monthly
StatCounter Browser stats Free (limited) Monthly
Ahrefs SEO data $99+/mo Weekly
BuiltWith Tech stacks $295+/mo Monthly

Cloudflare is the only one that offers real traffic data for free.

For more free APIs, check out my curated list of 200+ free APIs.


What data sources do you use for market research? I am always looking for new free APIs. Share yours in the comments!

Follow me for daily discoveries of useful APIs and developer tools.

Top comments (0)