Skip to main content
This endpoint has been updated to include Post edit metadata. Learn more about these metadata on the “Edit Posts” fundamentals pageThis endpoint is often used with the Direct Messages endpoints. We have launched new v2 Direct Messages endpoints. Note that the Enterprise and Premium Account Activity APIs support v2 one-to-one messages, but do not yet support group conversations.   
Overview Enterprise The Account Activity API provides you the ability to subscribe to realtime activities related to a user account via webhooks. This means that you can receive realtime Posts, Direct Messages, and other account events from one or more of your owned or subscribed accounts through a single connection. You will receive all related activities below for each user subscription on your webhook registration: Please note - We do not deliver home timeline data via the Account Activity API. Please use the GET statuses/home_timeline to pull this data.  

Video series

Check out our four-part video series on the Account Activity API to get up to speed!

Feature summary

Manage webhooks and subscribed users

⏱ 10 min read The enterprise Account Activity API provides you webhook-based JSON messages any time there are events associated with X accounts subscribed to your service. X delivers those activities to your registered webhook. In the following steps, you will learn how to manage webhooks and subscribed users. You will learn how to register, view, and remove, both webhooks and subscribed users. We’ll be using simple cURL commands to make requests to the various API endpoints. cURL is a command-line tool for getting or sending requests using the URL syntax. You will need: Before you get started, we recommend you check out our Github repo here that provides a sample web app and helper scripts to get started with X’s Account Activity API

Managing a webhook:

Using a webhook provides you the ability to subscribe to realtime activities related to a user account through a single connection. 
Let’s begin with registering a new webhook URL for the given application context.The URL will be validated via a CRC request before saving. Once you’ve registered a webhook, make sure to document the webhook ID as you will need it later on.Copy the following cURL request into your command line after making changes to the following:
  • URL <URL> e.g. https://yourdomain.com/webhooks/twitter/
  • Consumer key <CONSUMER_KEY> e.g. xvz1evFS4wEEPTGEFPHBog
  • Access token <ACCESS_TOKEN> e.g.  370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb

Managing subscribed users:

Once you’ve registered a Webhook, you can add a subscribed user to the Account Activity API to begin receiving their account activities.
We’ll begin with subscribing a user so you receive all event types.Copy the following cURL request into your command line after making changes to the following:
  • Webhook ID <:WEBHOOK_ID> e.g. 1234567890
  • Consumer key name <CONSUMER_KEY> e.g. xvz1evFS4wEEPTGEFPHBog
  • Subscribing user’s access token <SUBSCRIBING_USER'S_ACCESS_TOKEN> e.g. 370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb
Great job! You should now able to manage your webhooks and subscribed users.

Referenced articles

A video walkthrough of the Account Activity API

In this video walkthrough, you will learn about the capabilities of the premium and enterprise tiers of the Account Activity API. By the end of this video, you will learn abo