Analytics Overview
The Analytics API provides insights and performance data for your connected Facebook, Instagram, and LinkedIn accounts. Retrieve metrics on reach, engagement, followers, post performance, and demographics.
Base URL:
https://analyze.oneupapp.io
Authentication
All analytics endpoints require an apiKey parameter validated by the VerifyApiKeyV2 middleware.
| Error | Status | Response |
|---|---|---|
| Missing key | 401 | { "message": "Please provide a valid API key" } |
Common Parameters
All analytics endpoints share the following query parameters:
| Parameter | Required | Description |
|---|---|---|
apiKey | Yes | Your personal API key generated from the API Access page. |
social_network_id | Yes | The social account ID to retrieve analytics for. |
preset | No | Date preset: last_7_days, last_30_days, or last_90_days. |
start_date | Required without preset | Start date in Y-m-d format. |
end_date | Required without preset | End date in Y-m-d format. Must be > start_date (minimum 1 day range) and <= yesterday. |
timezone | No | Valid PHP timezone identifier (default: UTC). |
Response Patterns
Stats with Period Comparison
Every endpoint returns metrics comparing the current period to the previous period:
{
"key": "likes",
"name": "Likes",
"value_current_period": 1234,
"value_last_period": 1000,
"percentage_change": "+23.40%"
}
Percentage change formula: ((current - last) / last) * 100
- If
last = 0andcurrent > 0, percentage change is100. - If both are
0, percentage change is0.
Post Performance
Overview endpoints include top and bottom performing posts:
{
"most_engaging": [
{
"id": "...",
"caption": "...",
"permalink_url": "...",
"engagement_rate": 5.23
}
],
"least_engaging": [],
"most_reach": [],
"least_reach": [],
"most_shared": [],
"least_shared": []
}
Top and bottom 3 posts per category. LinkedIn personal profiles return post_performance: [].
Caching
All analytics endpoints use Cache::flexible() with a 1 hour primary TTL and 2 hours stale-while-revalidate.
Summary Table
| Platform | Endpoint | Content Type |
|---|---|---|
/api/facebook/overview | Page-level metrics + post performance | |
/api/facebook/posts | Posts (excl. reels/stories) + hashtags | |
/api/facebook/reels | Reels only | |
/api/facebook/stories | Stories only | |
/api/facebook/demographics | Followers by city & country | |
/api/instagram/overview | Account-level metrics + post performance | |
/api/instagram/posts | Posts (excl. stories) | |
/api/instagram/stories | Stories only | |
/api/instagram/demographics | Followers + engaged audience demographics (age, gender, city, country) | |
/api/linkedin/overview | Account metrics (org or personal) + post performance | |
/api/linkedin/posts | Posts (organization only) |