API Reference

Analytics

The Analytics API returns growth metrics, engagement data, and audience demographics for your connected accounts. Pull data for dashboards, reports, or milestone-based automations.

Scope requiredanalytics:read


Overview

Get a high-level summary of account performance over a specified time period.

GET /v1/analytics/overview

Query parameters

ParameterTypeRequiredDescription
account_idstringYesThe account to retrieve analytics for.
periodstringNoTime range: 7d, 30d, 90d, or custom. Default: 30d.
start_datestringNoISO 8601 date. Required when period=custom.
end_datestringNoISO 8601 date. Required when period=custom.

Request

curl https://api.outfame.com/v1/analytics/overview?account_id=acc_7Gx2kLm9Qr&period=30d \
  -H "Authorization: Bearer sk_live_your_api_key"

Response

{
  "account_id": "acc_7Gx2kLm9Qr",
  "period": "30d",
  "start_date": "2026-01-10",
  "end_date": "2026-02-09",
  "followers_gained": 1247,
  "followers_lost": 83,
  "net_growth": 1164,
  "growth_rate": 8.52,
  "engagement_rate": 4.17,
  "engagement_rate_change": 0.34,
  "total_likes_received": 18432,
  "total_comments_received": 2891,
  "profile_visits": 34210,
  "reach": 287400,
  "impressions": 512300
}

Growth

Get daily follower growth data, ideal for rendering time-series charts.

GET /v1/analytics/growth

Query parameters

ParameterTypeRequiredDescription
account_idstringYesThe account ID.
periodstringNo7d, 30d, 90d, or custom. Default: 30d.
granularitystringNodaily, weekly, or monthly. Default: daily.

Request

curl https://api.outfame.com/v1/analytics/growth?account_id=acc_7Gx2kLm9Qr&period=7d \
  -H "Authorization: Bearer sk_live_your_api_key"

Response

{
  "account_id": "acc_7Gx2kLm9Qr",
  "period": "7d",
  "granularity": "daily",
  "data_points": [
    { "date": "2026-02-03", "followers": 14520, "gained": 47, "lost": 3, "net": 44 },
    { "date": "2026-02-04", "followers": 14564, "gained": 52, "lost": 5, "net": 47 },
    { "date": "2026-02-05", "followers": 14611, "gained": 61, "lost": 4, "net": 57 },
    { "date": "2026-02-06", "followers": 14668, "gained": 38, "lost": 6, "net": 32 },
    { "date": "2026-02-07", "followers": 14700, "gained": 55, "lost": 2, "net": 53 },
    { "date": "2026-02-08", "followers": 14753, "gained": 49, "lost": 7, "net": 42 },
    { "date": "2026-02-09", "followers": 14832, "gained": 86, "lost": 7, "net": 79 }
  ],
  "summary": {
    "total_gained": 388,
    "total_lost": 34,
    "net_growth": 354,
    "avg_daily_growth": 50.6,
    "best_day": "2026-02-09",
    "worst_day": "2026-02-06"
  }
}

Engagement

Retrieve engagement metrics broken down by content type and time period.

GET /v1/analytics/engagement

Query parameters

ParameterTypeRequiredDescription
account_idstringYesThe account ID.
periodstringNo7d, 30d, 90d, or custom. Default: 30d.

Response

{
  "account_id": "acc_7Gx2kLm9Qr",
  "period": "30d",
  "overall": {
    "engagement_rate": 4.17,
    "avg_likes_per_post": 342,
    "avg_comments_per_post": 28,
    "avg_saves_per_post": 45,
    "avg_shares_per_post": 12
  },
  "by_content_type": {
    "photo": { "engagement_rate": 3.82, "count": 12 },
    "video": { "engagement_rate": 5.14, "count": 8 },
    "carousel": { "engagement_rate": 4.67, "count": 5 },
    "reel": { "engagement_rate": 6.23, "count": 10 },
    "story": { "engagement_rate": 2.91, "count": 45 }
  },
  "top_posts": [
    {
      "post_id": "p_abc123",
      "type": "reel",
      "likes": 1247,
      "comments": 89,
      "saves": 210,
      "shares": 45,
      "engagement_rate": 8.92,
      "posted_at": "2026-02-05T18:30:00Z"
    },
    {
      "post_id": "p_def456",
      "type": "carousel",
      "likes": 892,
      "comments": 67,
      "saves": 156,
      "shares": 33,
      "engagement_rate": 6.41,
      "posted_at": "2026-02-02T14:00:00Z"
    }
  ]
}

Audience

Returns audience demographics and composition data for the specified account.

GET /v1/analytics/audience

Query parameters

ParameterTypeRequiredDescription
account_idstringYesThe account ID.

Response

{
  "account_id": "acc_7Gx2kLm9Qr",
  "total_followers": 14832,
  "demographics": {
    "age": {
      "13-17": 2.1,
      "18-24": 28.4,
      "25-34": 38.7,
      "35-44": 18.2,
      "45-54": 8.3,
      "55+": 4.3
    },
    "gender": {
      "male": 41.2,
      "female": 56.8,
      "other": 2.0
    },
    "top_countries": [
      { "code": "US", "name": "United States", "percentage": 42.1 },
      { "code": "GB", "name": "United Kingdom", "percentage": 12.8 },
      { "code": "CA", "name": "Canada", "percentage": 8.4 },
      { "code": "AU", "name": "Australia", "percentage": 6.2 },
      { "code": "DE", "name": "Germany", "percentage": 4.1 }
    ],
    "top_cities": [
      { "name": "Los Angeles", "country": "US", "percentage": 8.7 },
      { "name": "New York", "country": "US", "percentage": 6.2 },
      { "name": "London", "country": "GB", "percentage": 5.9 },
      { "name": "Toronto", "country": "CA", "percentage": 3.4 },
      { "name": "Sydney", "country": "AU", "percentage": 2.8 }
    ]
  },
  "quality_score": 87,
  "bot_percentage": 1.2,
  "active_percentage": 72.4,
  "most_active_hours": [18, 19, 20, 21, 12, 13]
}

Chart data format

All time-series endpoints return data in a format compatible with popular charting libraries like Chart.js, Recharts, and D3. The data_points array contains objects with a date key and numeric values that can be mapped directly to chart axes.

// Recharts example
import { LineChart, Line, XAxis, YAxis } from "recharts";

const { data_points } = await outfame.analytics.growth("acc_7Gx2kLm9Qr");

<LineChart data={data_points}>
  <XAxis dataKey="date" />
  <YAxis />
  <Line type="monotone" dataKey="followers" stroke="#e63d8e" />
</LineChart>

Error codes

StatusCodeDescription
400invalid_periodInvalid period value. Use 7d, 30d, 90d, or custom.
400invalid_date_rangestart_date must be before end_date. Maximum range is 365 days.
404account_not_foundNo account with this ID exists.
403insufficient_scopeAPI key or token requires the analytics:read scope.