Reconnect accounts for Analytics scopes

If an account was connected before a platform granted analytics scopes, reconnect the account so UniPost receives a token with the new permissions.

When reconnect is needed

UniPost cannot silently add provider permissions to an existing OAuth token. If a platform account was connected before analytics scopes were available, the user must reconnect that account through the same connection mode they used originally.

Workflow

  1. Check the account status with GET/v1/accounts/{account_id}/health or list accounts with GET/v1/accounts.
  2. If the account is disconnected or needs updated permissions, send the user through OAuth again.
  3. For workspace-owned accounts, start OAuth with POST/v1/oauth/connect.
  4. For customer-owned accounts, create a hosted Connect Session.
  5. After reconnect, call the same Analytics API again.

TikTok analytics scopes

TikTok Analytics uses the approved user.info.profile, user.info.stats, and video.list scopes. For follower count, the required scope is user.info.stats, and the UniPost API remains GET/v1/accounts/{account_id}/metrics.

YouTube account metrics scope

YouTube V1 account metrics use the YouTube Data API channel statistics endpoint and the existing youtube.readonly OAuth scope. You do not need a YouTube Analytics API scope or a new UniPost API key scope for GET/v1/accounts/{account_id}/metrics. Reconnect only when the stored Google token is invalid, lacks youtube.readonly, or no longer resolves to the expected channel.

YouTube Analytics V2 reports use yt-analytics.readonly and are exposed through GET/v1/accounts/{account_id}/youtube/analytics/summary, GET/v1/accounts/{account_id}/youtube/analytics/trend, and GET/v1/accounts/{account_id}/youtube/analytics/videos. Existing YouTube accounts connected before that scope was granted must reconnect before V2 reports are available.

Common scope map

PlatformAnalytics scopesCommon UniPost API
Instagraminstagram_business_basic, instagram_business_manage_insightsGET/v1/accounts/{account_id}/metrics
Threadsthreads_basic, threads_manage_insightsGET/v1/accounts/{account_id}/metrics
Pinterestpins:read, boards:read, user_accounts:readGET/v1/posts/{post_id}/analytics
TikTokuser.info.profile, user.info.stats, video.listGET/v1/accounts/{account_id}/metrics
YouTube V1youtube.readonlyGET/v1/accounts/{account_id}/metrics
YouTube V2yt-analytics.readonlyGET/v1/accounts/{account_id}/youtube/analytics/summary
Facebook Pagepages_read_engagement, read_insightsGET/v1/posts/{post_id}/analytics

Reference