Skip to content
BrainyShorts Docs
Esc
↑↓navigate↵open⌘Jpreview

Refresh analytics from the platforms

Pulls fresh metrics and follower counts for the owner’s connected accounts before reading GET /api/cli/analytics or GET /api/cli/accounts/overview. Same guards as the dashboard refresh: at most 5 accounts per call, and each account syncs at most once every 5 minutes. Accounts inside that window are skipped and counted in skipped, so calling again is safe. MCP: brainy_refresh_analytics.

POST/api/cli/analytics/refresh
Authorization
AuthorizationBearer token (ba_sk_...) · headerrequired

API key from /dashboard/api-keys. Keys expire after 365 days.

or
AuthorizationBearer token (ba_mcp_access_...) · headerrequired

The OAuth access token the hosted MCP server issues (brainy:read for GET routes, brainy:write for everything else). One login serves MCP, the CLI and the desktop app. A token without the needed scope gets 403 Insufficient scope.

Request body
application/json
account_idsstring<uuid>[]

Omit to refresh every refreshable account.

max items 12
platformstring | null
Allowed:instagramtiktokyoutubelinkedinxnull
Responses
200

OK. refreshed may be 0 when every account is inside its cooldown.

successboolean
messagestring
refreshedinteger
failedinteger
skippedinteger
retryAfterSecondsinteger
400

Invalid request, or more than 5 accounts selected

errorstringrequired
codestring
401

Missing, invalid, expired, or revoked API key

errorstringrequired
codestring
404

No refreshable account matches

errorstringrequired
codestring
409

LINKEDIN_ANALYTICS_PERMISSION_REQUIRED: the user must connect LinkedIn analytics

errorstringrequired
codestring
502

Every attempted refresh failed; code says why (for example a reconnect is required)

errorstringrequired
codestring
Try it
Server
Authorization
Bodyapplication/json
Request
curl -X POST "https://www.brainyshorts.com/api/cli/analytics/refresh" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "account_ids": [
    "497f6eca-6276-4993-bfeb-53cbbbba6f08"
  ],
  "platform": "instagram"
}'
Response
{
  "success": true,
  "message": "string",
  "refreshed": 0,
  "failed": 0,
  "skipped": 0,
  "retryAfterSeconds": 0
}