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.
Overview
Section titled “Overview”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/overviewcurl example:
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 } ]}| Field | Type | Description |
|---|---|---|
total_views_7d | number | Total views across all posts in the last 7 days |
total_views_30d | number | Total views across all posts in the last 30 days |
top_posts | array | Top 10 posts ranked by 30-day views |
daily_views | array | Daily view totals for the last 30 days (oldest first) |
Post Analytics
Section titled “Post Analytics”Returns view counts and daily breakdown for a single post.
Endpoint:
GET /analytics/posts/:slugcurl example:
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 } ]}| Field | Type | Description |
|---|---|---|
slug | string | The post slug you queried |
views_7d | number | Views in the last 7 days |
views_30d | number | Views in the last 30 days |
daily_views | array | Daily view counts for the last 30 days |
Error Responses
Section titled “Error Responses”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"}See Also
Section titled “See Also”- Authentication — how to authenticate API requests
- Plans — plan comparison and feature access
- Rate Limits — request quotas per plan