Turn X analytics on or off
PATCH
/api/accounts/:accountId/analyticsOpt an X account in to analytics, or out again.
- Every X read is billed, so X analytics are off until the account opts in, and the reads count against the plan's 30-day X units like publishing (Max and Scale).
- When on, Ampost reads the metrics of the posts it published to the account during their first 29 days (daily for 3 days, then weekly) and the follower count once a day; three post reads or one follower read cost one X unit.
- The sync pauses when the units run out and resumes when they reset.
- Other platforms need no opt-in (
analytics.optInRequiredis false) and return 400. - A plan without X returns 403 UPGRADE_REQUIRED.
- Returns the account with its
analyticsstate.
- Key scope
- accounts:write
- MCP tool
- accounts_set_analytics
Headers
AuthorizationstringrequiredBearer <API key>. Create a key in the dashboard under API keys.
Path parameters
accountIdstringrequiredAccount id (UUID):
idfrom accounts_list
Body
enabledbooleanrequiredtruestarts the metered X analytics sync for the account;falsestops it
Errors return { error: { code, message } }; every code is in Error codes.