Pages in API reference

Accounts

Turn X analytics on or off

PATCH/api/accounts/:accountId/analytics

Opt 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.optInRequired is false) and return 400.
  • A plan without X returns 403 UPGRADE_REQUIRED.
  • Returns the account with its analytics state.
Key scope
accounts:write
MCP tool
accounts_set_analytics

Headers

  • Authorizationstringrequired

    Bearer <API key>. Create a key in the dashboard under API keys.

Path parameters

  • accountIdstringrequired

    Account id (UUID): id from accounts_list

Body

  • enabledbooleanrequired

    true starts the metered X analytics sync for the account; false stops it

Errors return { error: { code, message } }; every code is in Error codes.