Analytics
Get Analytics
Returns normalized metrics for a Onepostly post or a platform-native post id. Pass only accountId to get live account insights for Instagram and Facebook.
x-api-key<token>Workspace API key, sent in the x-api-key header. Keys start with op_ and are created in the dashboard.
post?stringOnepostly post id or platform-native post id. Native ids also need accountId. You can omit it when you pass destinationId.
1 <= lengthaccountId?stringConnection id. Required with a platform-native post id, and picks the destination when a Onepostly post has several. Passed on its own, it returns live account insights for Instagram and Facebook.
1 <= lengthdestinationId?stringDestination id. It identifies one destination on its own, so post and accountId become optional.
1 <= lengthmetrics?stringComma-separated metric names for account insights. Each platform has its own default set.
1 <= length <= 500period?string"day""week""days_28""lifetime"since?integer0 < valueuntil?integer0 < valuebreakdown?stringInstagram account insights breakdown, such as follower_type, media_product_type, age, city or country.
1 <= length <= 64timeframe?stringInstagram demographics timeframe, such as this_week, this_month or last_30_days.
1 <= length <= 32metricType?string1 <= length <= 32Normalized analytics. Metrics refresh about hourly for posts under 30 days old and about weekly after that.
application/json- response
analytics*import { Configuration, AnalyticsApi } from "@onepostly/sdk";const analyticsApi = new AnalyticsApi( new Configuration({ apiKey: process.env.ONEPOSTLY_API_KEY }));const response = await analyticsApi.getAnalytics({ post: "1699f415-7fb6-43f4-9d2a-c447491f32a8", metrics: "views,reach,profile_views", period: "day",});console.log(response);{ "analytics": { "post": "b3e1a7c2-8f4d-4e6a-9c1b-2d3e4f5a6b7c", "status": "ready", "fetchedAt": "2026-08-25T10:00:00.000Z", "subjects": [ { "scope": "destination", "subjectId": "d4e5f6a7-8b9c-4d0e-8f1a-2b3c4d5e6f7a", "accountId": "a1b2c3d4-e5f6-4a7b-8c9d-e0f1a2b3c4d5", "platform": "instagram", "externalPostId": "17895695668004550", "status": "ready", "metrics": { "impressions": 1234, "reach": 987, "likes": 123, "comments": 12, "shares": 4, "saves": 2, "plays": 456, "engagement": 0.14 }, "fetchedAt": "2026-08-25T10:00:00.000Z", "expiresAt": "2026-09-01T10:00:00.000Z", "error": null } ] }}