Skip to content

Analytics API ​

Endpoints for retrieving performance analytics.

Authentication ​

All endpoints require JWT authentication.


Overview ​

GET /api/analytics/overview

Get high-level metrics across all platforms.

Query Parameters ​

ParameterTypeDescription
startDatestringISO date
endDatestringISO date
platformstringFilter by platform

Response ​

json
{
  "followers": 15420,
  "followersChange": 234,
  "impressions": 89500,
  "impressionsChange": 5200,
  "engagement": 3245,
  "engagementRate": 3.62,
  "clicks": 1205
}

GET /api/analytics/growth

Get follower growth over time.

Response ​

json
{
  "data": [
    { "date": "2025-01-01", "followers": 15000 },
    { "date": "2025-01-02", "followers": 15050 },
    { "date": "2025-01-03", "followers": 15120 }
  ],
  "totalChange": 420,
  "percentChange": 2.8
}

Engagement Breakdown ​

GET /api/analytics/engagement

Get engagement metrics breakdown.

Response ​

json
{
  "total": 3245,
  "breakdown": {
    "likes": 2100,
    "comments": 450,
    "shares": 320,
    "saves": 375
  },
  "byPlatform": {
    "twitter": 1200,
    "linkedin": 1500,
    "instagram": 545
  }
}

Best Times to Post ​

GET /api/analytics/best-times

Get optimal posting times based on engagement.

Response ​

json
{
  "recommendations": [
    { "day": "Tuesday", "hour": 9, "score": 0.95 },
    { "day": "Wednesday", "hour": 14, "score": 0.88 },
    { "day": "Thursday", "hour": 10, "score": 0.85 }
  ],
  "heatmap": {
    "0": [0.1, 0.1, 0.1, ...],  // Sunday hours 0-23
    "1": [0.2, 0.3, 0.5, ...],  // Monday hours 0-23
    ...
  }
}

Top Posts ​

GET /api/analytics/top-posts

Get highest performing posts.

Query Parameters ​

ParameterTypeDescription
metricstringSort by: engagement, impressions, clicks
limitnumberNumber of posts

Response ​

json
[
  {
    "id": "post_123",
    "content": "Post content...",
    "platform": "linkedin",
    "impressions": 5420,
    "engagement": 342,
    "engagementRate": 6.31,
    "publishedAt": "2025-01-01T09:00:00Z"
  }
]

TendSocial Documentation