Analytics
Account stats, creator media, and per-post metrics for TikTok.
TikTok analytics has three surfaces. Account level stats, the creator recent public videos and per-post metrics. Pass post as described in Analytics. Use the internal id for Onepostly posts. Use the native video id plus accountId for outside videos.
Account stats
Live follower, following, likes and video counts for a connected account.
const stats = await connections.getConnectionStats({ id: accountId });
// stats.stats.followerCount, followingCount, likesCount, videoCount| Field | Meaning |
|---|---|
followerCount | Followers of the creator |
followingCount | Accounts the creator follows |
likesCount | Total likes received across all content |
videoCount | Number of the creator videos |
Creator media
Paginated list of the creator public videos with per-video metrics. Private posts do not appear, and photo posts are not returned by the TikTok video list.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
limit | integer 1-20 | No | 10 | Page size |
cursor | string | No | No | Pagination cursor from the previous response nextCursor |
const page = await connections.listConnectionMedia({ id: accountId, limit: 10 });
// page.items[].id, title, coverUrl, shareUrl, createdAt, durationSec, metrics
// page.nextCursor for the next pageEach item includes id, title, description, coverUrl, shareUrl, createdAt, durationSec and metrics with likes, comments, shares and views. nextCursor with value null means no more pages.
Post analytics
Same surface as other platforms.
import { Configuration, AnalyticsApi } from "@onepostly/sdk";
const analyticsApi = new AnalyticsApi(
new Configuration({ apiKey: process.env.ONEPOSTLY_API_KEY }),
);
const { analytics } = await analyticsApi.getAnalytics({ post: postId });Daily timeline
Day by day cumulative metrics per subject. Optional from and to bound the inclusive UTC date range. The default window covers the last 366 days.
const { timeline } = await analyticsApi.getAnalyticsTimeline({
post: postId,
from: "2026-08-01",
to: "2026-08-28",
});
// timeline.subjects[].points[].day, metrics, deltaEach metrics object holds cumulative totals as captured on that UTC day. delta compares them against the previous stored day. A delta entry stays null when either side has no value. Days without a stored snapshot have no data. The API does not backfill them.
Outside posts
Videos published outside Onepostly work the same way once they are synced. Sync by URL or native video id then read analytics with that id plus accountId. Omit url and postId to refresh the recent posts of the account in bulk.
const { found, post } = await posts.syncExternal({
syncExternalBody: { accountId, url: "https://www.tiktok.com/@you/video/7234567890123456789" },
});
if (!found || !post) throw new Error("Post not found on the account.");
const { analytics } = await analyticsApi.getAnalytics({
post: post.externalPostId,
accountId,
});Normalized fields
| Field | Meaning on TikTok |
|---|---|
plays and impressions | Video views. Same value, both exposed for cross-platform consistency |
likes | Like count |
comments | Comment count |
shares | Share count |
engagement | Likes plus comments plus shares |
reach | Always null. TikTok does not expose reach |
saves | Always null. TikTok does not expose saves |
Pending semantics
Errors
| Code | Cause | Fix |
|---|---|---|
NOT_PUBLISHED | Destination not published yet | Wait for publish |
ANALYTICS_PENDING | Metrics not ready yet | Retry later |
VIDEO_NOT_FOUND | TikTok has not produced metrics for the video yet | Retry later |
ANALYTICS_FAILED | Hard failure fetching metrics | Retry. Contact support if it persists |