DEV Community

Alex Spinov
Alex Spinov

Posted on

Dev.to Has a Free API — Analyze Your Article Performance in 20 Lines of Python

You're Writing Blind

If you're publishing on Dev.to, you probably check your dashboard occasionally. But do you actually know:

  • Which tags get you the most views?
  • What day of the week gets the most engagement?
  • Which article format performs best?

Dev.to has a free API that gives you all this data. Let me show you.

Setup

Get your API key: Settings → Extensions → DEV Community API Keys → Generate.

1. Your Top Articles

import requests

API_KEY = "your-api-key"
headers = {"api-key": API_KEY}

# Get your articles (up to 1000)
articles = []
for page in range(1, 11):
    batch = requests.get(
        f"https://dev.to/api/articles/me?per_page=100&page={page}",
        headers=headers
    ).json()
    if not batch: break
    articles.extend(batch)

print(f"Total articles: {len(articles)}")

# Sort by views
top = sorted(articles, key=lambda a: a.get("page_views_count", 0), reverse=True)

print("\n📊 Top 10 Articles:")
for i, a in enumerate(top[:10], 1):
    views = a.get("page_views_count", 0)
    reactions = a.get("positive_reactions_count", 0)
    print(f"{i}. [{views}v, {reactions}❤] {a[title][:60]}")
Enter fullscreen mode Exit fullscreen mode

2. Best Tags by Views

from collections import Counter

tag_views = Counter()
tag_count = Counter()

for a in articles:
    views = a.get("page_views_count", 0)
    for tag in a.get("tag_list", []):
        tag_views[tag] += views
        tag_count[tag] += 1

print("\n🏷️ Tags ranked by total views:")
for tag, views in tag_views.most_common(15):
    avg = views // tag_count[tag]
    print(f"  #{tag}: {views} total views ({tag_count[tag]} articles, {avg} avg)")
Enter fullscreen mode Exit fullscreen mode

3. Engagement Rate

print("\n💡 Engagement rate (reactions per view):")
for a in top[:20]:
    views = a.get("page_views_count", 0)
    reactions = a.get("positive_reactions_count", 0)
    if views > 0:
        rate = reactions / views * 100
        print(f"  {rate:.1f}% — {a[title][:50]}")
Enter fullscreen mode Exit fullscreen mode

4. Growth Over Time

from collections import defaultdict

monthly = defaultdict(lambda: {"articles": 0, "views": 0})

for a in articles:
    month = a["published_at"][:7]  # YYYY-MM
    monthly[month]["articles"] += 1
    monthly[month]["views"] += a.get("page_views_count", 0)

print("\n📈 Monthly Growth:")
for month in sorted(monthly.keys()):
    m = monthly[month]
    print(f"  {month}: {m[articles]} articles, {m[views]} views")
Enter fullscreen mode Exit fullscreen mode

My Results (290+ Articles)

I ran this on my own account:

  • Best tags: #security + #api = highest views per article
  • Best format: "[X] Has a Free API" articles = 20-30 views each
  • Best day: Tuesdays and Wednesdays
  • Worst performing: Generic listicles with no code examples

The API

Endpoint Auth What You Get
GET /api/articles/me API key Your articles with views/reactions
GET /api/articles?tag={tag} None Articles by tag
GET /api/articles/{id} None Single article details
GET /api/tags None Popular tags

Full analytics toolkit: dev-to-analytics


Run this on your Dev.to account and share what you find! What's your best-performing tag? 👇

Top comments (0)