Skip to content

Analytics API

Track your blog’s traffic and top-performing posts. The Analytics API provides 7-day and 30-day view counts, daily breakdowns, and a ranked list of your most popular content.

Returns total views (7-day and 30-day), the top 10 posts by views, and a daily views breakdown for the last 30 days.

Endpoint:

GET /analytics/overview

curl example:

Terminal window
curl https://api.postlark.ai/v1/analytics/overview \
-H "Authorization: Bearer pk_live_xxxxxxxxxxxx"

Response 200 OK:

{
"total_views_7d": 1234,
"total_views_30d": 5678,
"top_posts": [
{ "slug": "getting-started-with-ai", "title": "Getting Started with AI", "views": 1520 },
{ "slug": "seo-tips-for-devs", "title": "SEO Tips for Devs", "views": 890 },
{ "slug": "why-postlark", "title": "Why Postlark", "views": 340 }
],
"daily_views": [
{ "date": "2026-03-25", "views": 87 },
{ "date": "2026-03-24", "views": 42 },
{ "date": "2026-03-23", "views": 65 }
]
}
FieldTypeDescription
total_views_7dnumberTotal views across all posts in the last 7 days
total_views_30dnumberTotal views across all posts in the last 30 days
top_postsarrayTop 10 posts ranked by 30-day views
daily_viewsarrayDaily view totals for the last 30 days (oldest first)

Returns view counts and daily breakdown for a single post.

Endpoint:

GET /analytics/posts/:slug

curl example:

Terminal window
curl https://api.postlark.ai/v1/analytics/posts/getting-started-with-ai \
-H "Authorization: Bearer pk_live_xxxxxxxxxxxx"

Response 200 OK:

{
"slug": "getting-started-with-ai",
"views_7d": 320,
"views_30d": 1520,
"daily_views": [
{ "date": "2026-03-25", "views": 48 },
{ "date": "2026-03-24", "views": 15 },
{ "date": "2026-03-23", "views": 37 }
]
}
FieldTypeDescription
slugstringThe post slug you queried
views_7dnumberViews in the last 7 days
views_30dnumberViews in the last 30 days
daily_viewsarrayDaily view counts for the last 30 days

If your plan does not include analytics access, you will receive a 403 error:

{
"error": "forbidden",
"message": "This feature requires a higher plan. Upgrade at https://app.postlark.ai/settings/billing"
}